Search completed in 1.31 seconds.
How to enable locale switching in a XULRunner application - Archive of obsolete content
This article is for developers who have localised their XUL application using DTD entity files and want to provide their users with a mechanism to switch the
locale in the application itself. Normally the application
locale is inherited from the OS environment of the host system, however there are situations when you might want to give users the option to override the default setting and choose a different
locale. Here is an outline of the solution: 1. Modify the application preferences First, you need to tell XULRunner that your application wishes to ignore the default OS
locale and that it will do its own choosing instead. ...
...ver there are situations when you might want to give users the option to override the default setting and choose a different
locale. Here is an outline of the solution: 1. Modify the application preferences First, you need to tell XULRunner that your application wishes to ignore the default OS
locale and that it will do its own choosing instead. Edit the application preferences file and set "intl.
locale.matchOS" to false. Your application is now going to ignore the OS
locale, so it would be a good idea to define one to fall back on using the preference "general.useragent.
locale". ...
...ner that your application wishes to ignore the default OS
locale and that it will do its own choosing instead. Edit the application preferences file and set "intl.
locale.matchOS" to false. Your application is now going to ignore the OS
locale, so it would be a good idea to define one to fall back on using the preference "general.useragent.
locale". ...
...And 20 more matches
JS_GetLocaleCallbacks
Get and set
locale specific string conversion and error message callbacks. Syntax JS
LocaleCallbacks * JS_Get
LocaleCallbacks(JSRuntime *rt); void JS_Set
LocaleCallbacks(JSRuntime *rt, JS
LocaleCallbacks *callbacks); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. callbacks JS
LocaleCallbacks * Pointer to a JS
LocaleCallbacks struct. ...
...lbacks(JSRuntime *rt, JS
LocaleCallbacks *callbacks); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. callbacks JS
LocaleCallbacks * Pointer to a JS
LocaleCallbacks struct. ...
...
LocaleCallbacks *callbacks); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. callbacks JS
LocaleCallbacks * Pointer to a JS
LocaleCallbacks struct. ...
...And 19 more matches
Date.prototype.toLocaleString() - JavaScript
The to
LocaleString() method returns a string with a language sensitive representation of this date. The new
locales and options arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function. In older implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation-dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...plementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation-dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.to
LocaleString([
locales[, options]]) Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.DateTimeFormat() construc...
...if the weekday, year, month, and day properties are all undefined, then year, month, and day are assumed to be "numeric". Return value A string representing the given date according to language-specific conventions. Performance When formatting large numbers of dates, it is better to create an Intl.DateTimeFormat object and use the function provided by its format property. ...
...And 16 more matches
Bootstrapping a new locale
(see also https://developer.mozilla.org/en/Create_a_new_localization) The documentation here is no longer being maintained and is inaccurate. L10n documentation has moved to https://mozilla-l10n.github.io/localizer-documentation/ . To learn how to bootstrap a new
locale for Mozilla projects, please see those documents. In Mozilla, we use the the Mercurial version control system (Hg) to help manage our localizations. When a localization team is registered and your Hg repository is set up for a
locale, you can then clone the existing Mozilla release branch (i.e. where active development of the upcoming release of Firefox occurs) and then begin the necessary work for translation. Hg allows localizers to work locally on their machines and then "push" changes to their official Mozilla re...
...efox occurs) and then begin the necessary work for translation. Hg allows localizers to work locally on their machines and then "push" changes to their official Mozilla repository. Installing Mercurial Depending on your operating system, you will need to install the correct version of Hg on your machine. This document will give you the basic information on how to do that. Install the compare-
locales utility The next step is to install compare-
locales. $ sudo easy_install compare-
locales This will download and install the utility. Clone the source code The next step is to download a copy of the source code to your local system, using Mercurial. You will need to "hg clone" the existing release branch for Mozilla so you have all the files locally for you to begin localization. Make su...
... If you are interested in localizing Thunderbird 3, SeaMonkey 2 or other Mozilla projects based on Gecko 1.9.1 you'll need to follow the instructions on getting the source-code of the comm-central repository. Create a bare-bones localization Next, create a base localization. This is done by cloning the en-US (United States English) files into your localization. ...
...And 14 more matches
Date.prototype.toLocaleTimeString() - JavaScript
The to
LocaleTimeString() method returns a string with a language sensitive representation of the time portion of this date. The new
locales and options arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function. In older implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...plementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.to
LocaleTimeString([
locales[, options]]) Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.DateTimeFormat() cons...
...econd properties are all undefined, then hour, minute, and second are assumed to be "numeric". Return value A string representing the time portion of the given Date instance according to language-specific conventions. Performance When formatting large numbers of dates, it is better to create an Intl.DateTimeFormat object and use the function provided by its format property. ...
...And 13 more matches
Date.prototype.toLocaleDateString() - JavaScript
The to
LocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new
locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. In older implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...plementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.to
LocaleDateString([
locales [, options]]) Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.DateTimeFormat() con...
...nth, day properties are all undefined, then year, month, and day are assumed to be "numeric". Return value A string representing the date portion of the given Date instance according to language-specific conventions. Performance When formatting large numbers of dates, it is better to create an Intl.DateTimeFormat object and use the function provided by its format property. ...
...And 11 more matches
Number.prototype.toLocaleString() - JavaScript
In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. ...
...In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. ...
... The to
LocaleString() method returns a string with a language-sensitive representation of this number. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numObj.to
LocaleString([
locales [, options]]) Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.NumberFormat() constructor for details on these parameters and how to use th...
...And 11 more matches
String.prototype.localeCompare() - JavaScript
The
localeCompare() method returns a number indicating whether a reference string comes before, or after, or is the same as the given string in sort order. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The new
locales and options arguments let applications specify the language whose sort order should be used and customize the behavior of the function. In older implementations, which ignore the
locales and options arguments, the
locale and sort order used are entirely implementation-dependent. ...
...se clone https://github.com/mdn/interactive-examples and send us a pull request. The new
locales and options arguments let applications specify the language whose sort order should be used and customize the behavior of the function. In older implementations, which ignore the
locales and options arguments, the
locale and sort order used are entirely implementation-dependent. Syntax referenceStr.
localeCompare(compareString[,
locales[, options]]) Parameters compareString The string against which the referenceStr is compared.
locales and options These arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. ...
... See the Intl.Collator() constructor for details on these parameters and how to use them. ...
...And 11 more matches
nsILocaleService
intl/
locale/idl/nsI
LocaleService.idlScriptable The
Locale service interface. 1.0 66 Introduced Gecko 1.6 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/intl/ns
localeservice;1. ...
... intl/
locale/idl/nsI
LocaleService.idlScriptable The
Locale service interface. 1.0 66 Introduced Gecko 1.6 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/intl/ns
localeservice;1. ...
... intl/
locale/idl/nsI
LocaleService.idlScriptable The
Locale service interface. 1.0 66 Introduced Gecko 1.6 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Implemented by: @mozilla.org/intl/ns
localeservice;1. ...
...And 10 more matches
Object.prototype.toLocaleString() - JavaScript
The to
LocaleString() method returns a string representing the object. This method is meant to be overridden by derived objects for
locale-specific purposes. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax obj.to
LocaleString() Return value A string representing the object. Description Object's to
LocaleString returns the result of calling toString(). This function is provided to give objects a generic to
LocaleString method, even though not all may use it. See the list below. ...
...ject, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax obj.to
LocaleString() Return value A string representing the object. Description Object's to
LocaleString returns the result of calling toString(). This function is provided to give objects a generic to
LocaleString method, even though not all may use it. See the list below. ...
.../interactive-examples and send us a pull request. Syntax obj.to
LocaleString() Return value A string representing the object. Description Object's to
LocaleString returns the result of calling toString(). This function is provided to give objects a generic to
LocaleString method, even though not all may use it. See the list below. ...
...And 10 more matches
Intl.Locale - JavaScript
Unicode represents
locales with a string, called a
locale identifier. The
locale identifier consists of a language identifier and extension tags. Language identifiers are the core of the
locale, consisting of language, script, and region subtags. Additional information about the
locale is stored in the optional extension tags. Extension tags hold information about
locale aspects such as calendar type, clock type, and numbering system type. Traditionally, the Intl API used strings to represent
locales, just as Unicode does. ...
...This is a simple and lightweight solution that works well. Adding a
Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags. ...
...This is a simple and lightweight solution that works well. Adding a
Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags. Constructor Intl.
Locale() Creates a new
Locale object. ...
...And 9 more matches
String.prototype.toLocaleUpperCase() - JavaScript
If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...And 9 more matches
BigInt.prototype.toLocaleString() - JavaScript
In implementations that ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation-dependent. ...
...In implementations that ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation-dependent. ...
... The to
LocaleString() method returns a string with a language-sensitive representation of this BigInt. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax bigIntObj.to
LocaleString([
locales [, options]]) Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations that ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation-dependent. See the Intl.NumberFormat() constructor for details on these parameters and how to use t...
...And 8 more matches
String.prototype.toLocaleLowerCase() - JavaScript
If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...If multiple
locales are given in an Array, the best available
locale is used. The default
locale is the host environment's current
locale. ...
...And 8 more matches
Array.prototype.toLocaleString() - JavaScript
Return value A string representing the elements of the array. ...
... Return value A string representing the elements of the array. ...
... The to
LocaleString() method returns a string representing the elements of the array. The elements are converted to Strings using their to
LocaleString methods and these Strings are separated by a
locale-specific String (such as a comma ","). Syntax arr.to
LocaleString([
locales[, options]]); Parameters
locales Optional A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the
locales argument, see the Intl page. ...
...And 6 more matches
compare-locales
compare-
locales is a Python script that helps localizers to check their work without running Firefox or another application. If you want to run compare-
locales on Windows, be sure to first install MozillaBuild. Installation compare-
locales needs to be installed, and it requires that you have Python 2.7 or 3.5+ installed on your machine. The easiest way is to just run $ pip install -U compare-
locales Running it compare-
locales gathers the directories to compare from a TOML file, usually found in $APP/
locales/l10n.toml. The details of the configuration file are described in the l10n-config docs. You pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the
locale codes of the
locales you want to compare. If you want to test the locali...
...-
locales gathers the directories to compare from a TOML file, usually found in $APP/
locales/l10n.toml. The details of the configuration file are described in the l10n-config docs. You pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the
locale codes of the
locales you want to compare. ...
... the directories to compare from a TOML file, usually found in $APP/
locales/l10n.toml. The details of the configuration file are described in the l10n-config docs. You pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the
locale codes of the
locales you want to compare. ...
...And 5 more matches
Intl.Locale.prototype.collation - JavaScript
Description Collation is the process of ordering strings of characters. It is used whenever strings must be sorted and placed into a certain order, from search query results to ordering records in a database. While the idea of placing strings in order might seem trivial, the idea of order can vary from region to region and language to language. The collation property helps to make it easier for JavaScript programmers to access the collation type used by a particular
locale. Below is a table with the available collation types, taken from the Unicode collation specification. ...
... It is used whenever strings must be sorted and placed into a certain order, from search query results to ordering records in a database. While the idea of placing strings in order might seem trivial, the idea of order can vary from region to region and language to language. The collation property helps to make it easier for JavaScript programmers to access the collation type used by a particular
locale. Below is a table with the available collation types, taken from the Unicode collation specification. Valid collation types Collation Type Description big5han Pinyin ordering for Latin, big5 charset ordering for CJK characters (used in Chinese) compat A previous version of the ordering, for compatibility dict Dictionary style ordering (such a...
...Thus...
...And 5 more matches
Intl.Locale.prototype.numberingSystem - JavaScript
A table of the standard Unicode numeral systems can be seen below. ...
... Description A numeral system is a system for expressing numbers. The numberingSystem property helps to represent the different numeral systems used by various countries, regions, and cultures around the world. As with most internationalization schemas, the numeral systems that can be represented in a
Locale object by numberingSystem are standardized by Unicode. A table of the standard Unicode numeral systems can be seen below. ...
...To set the numberingSystem value via the string argument to the
Locale constructor, first add the -u extension key. Ne...
...And 4 more matches
Date.prototype.toLocaleFormat() - Archive of obsolete content
The non-standard to
LocaleFormat() method converts a date to a string using the specified formatting. Intl.DateTimeFormat is an alternative to format dates in a standards-compliant way. See also the newer version of Date.prototype.to
LocaleDateString(). This feature has been removed and will no longer work in Firefox 58+. See Warning: Date.prototype.to
LocaleFormat is deprecated for more information and migration help. Syntax dateObj.to
LocaleFormat(formatString) Parameters formatString A format string in the same format expected by the strftime() function in C. Return value A string representing the given date using the specified formatting. Description The to
LocaleFormat() method provides greater software control over the formatting of the generated date and/or time. Names ...
...rameters formatString A format string in the same format expected by the strftime() function in C. Return value A string representing the given date using the specified formatting. Description The to
LocaleFormat() method provides greater software control over the formatting of the generated date and/or time. Names for months and days of the week are localized using the operating system's
locale. However, ordering of the day and month and other localization tasks are not handled automatically since you have control over the order in which they occur. You should take care that the format string is localized properly according to the user's system settings. Be aware that the
locale used is not necessarily the same as the
locale of the browser. Extension and XULRunner developers should kno...
...y since you have control over the order in which they occur. You should take care that the format string is localized properly according to the user's system settings. Be aware that the
locale used is not necessarily the same as the
locale of the browser. ...
...And 3 more matches
IDBIndex.locale - Web APIs
Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. ...
... Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. ...
... Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. ...
...And 3 more matches
Intl.Locale.prototype.caseFirst - JavaScript
There are 3 values that the caseFirst property can have, outlined in the table below. caseFirst values Value Description upper Upper case to be sorted before lower case. lower Lower case to be sorted before upper case. false No special case ordering. ...
... There are 3 values that the caseFirst property can have, outlined in the table below. caseFirst values Value Description upper Upper case to be sorted before lower case. lower Lower case to be sorted before upper case. false No special case ordering. ...
...ressed in a
Locale's caseFirst property. There are 3 values that the caseFirst property can have, outlined in the table below. caseFirst values Value Description upper Upper case to be sorted before lower case. lower Lower case to be sorted before upper case. false No special case ordering. ...
...And 3 more matches
Intl.Locale.prototype.toString() - JavaScript
The Intl.
Locale.prototype.toString() returns the
Locale's full
locale identifier string. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax
locale.toString() Return value The
locale's Unicode
locale identifier string. Description The
Locale object is a JavaScript representation of a concept Unicode
locale identifier. Information about a particular
locale (language, script, calendar type, etc.) can be encoded in a
locale identifier string. To make it easier to work with these
locale identifiers, the
Locale object was introduced to JavaScript. ...
... Unicode
locale identifier string. Description The
Locale object is a JavaScript representation of a concept Unicode
locale identifier. Information about a particular
locale (language, script, calendar type, etc.) can be encoded in a
locale identifier string. To make it easier to work with these
locale identifiers, the
Locale object was introduced to JavaScript. Calling the toString method on a
Locale object will return the identifier string for that particular
Locale. The toString method allows
Locale instances to be provided as an argument to existing Intl constructors, serialized in JSON, or any other context where an exact string representation is useful. ...
...le identifiers, the
Locale object was introduced to JavaScript. Calling the toString method on a
Locale object will return the identifier string for that particular
Locale. The toString method allows
Locale instances to be provided as an argument to existing Intl constructors, serialized in JSON, or any other context where an exact string representation is useful. ...
...And 3 more matches
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. ...
... The Intl.RelativeTimeFormat.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in date and time formatting without having to fall back to the runtime's default
locale. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.RelativeTimeFormat.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. ...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in date and time formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 3 more matches
Making sure your theme works with RTL locales - Archive of obsolete content
Some languages are written from right to left. Of the languages Firefox and Thunderbird are shipped in, that includes Arabic and Hebrew, with Persian available as beta, for a total population in excess of 100 million potential users. The important thing to understand about these
locales, is that the entire interface is mirrored right-to-left. ...
...s mirrored right-to-left. That means that text that had a left margin will have a right margin instead (or -moz-margin-start), arrows that pointed right will have to point left and vice versa, and so on. ...
...rrows that pointed right will have to point left and vice versa, and so on. A screenshot of Firefox 2 in Hebrew What you need to do At this stage you might ask yourself, "How would I know what language is my theme installed on? Should I make a special theme for these
locales?" Don't despair: making a theme RTL-compatible is fairly easy! Gecko 1.9.2 and later Gecko 1.9.2 introduced the :-moz-
locale-dir CSS pseudoclass, which matches based on whether the user interface is being rendered left-to-right or right-to-left: :-moz-
locale-dir(ltr) matches if the user interface is being rendered left to right. :-moz-
locale-dir(rtl) matches if the user interface is being rendered right to left. Example toolbar[iconsize="large"][mode="icons"] #back-button { -moz-image-region: rect(0px 396px 34...
...And 2 more matches
nsILocale
Valid strings are stored in nsI
Locale.idl. Currently those are: NSI
LOCALE_COLLATE - Collation order. How strings are sorted. NSI
LOCALE_CTYPE - Character classification and case conversion. NSI
LOCALE_MONETARY - Monetary formatting. NSI
LOCALE_NUMERIC - Numeric, non-monetary formatting. ...
...Valid strings are stored in nsI
Locale.idl. Currently those are: NSI
LOCALE_COLLATE - Collation order. How strings are sorted. NSI
LOCALE_CTYPE - Character classification and case conversion. NSI
LOCALE_MONETARY - Monetary formatting. NSI
LOCALE_NUMERIC - Numeric, non-monetary formatting. ...
...Valid strings are stored in nsI
Locale.idl. Currently those are: NSI
LOCALE_COLLATE - Collation order. How strings are sorted. ...
...And 2 more matches
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
The JavaScript warning "Date.prototype.to
LocaleFormat is deprecated; consider using Intl.DateTimeFormat instead" occurs when the non-standard Date.prototype.to
LocaleFormat method is used. Message Warning: Date.prototype.to
LocaleFormat is deprecated; consider using Intl.DateTimeFormat instead Error type Warning. JavaScript execution won't be halted. What went wrong? The non-standard Date.prototype.to
LocaleFormat method is deprecated and shouldn't be used anymore. It uses a format string in the same format expected by the strftime() function in C. The function is no longer available in Firefox 58+. Examples Deprecated syntax The Date.prototype.to
LocaleFormat method is deprecated and will be removed (no cross-browser support, available in Firefox only). var today = new Date(); var date ...
...%B %Y'); console.log(date); // In German
locale // "Freitag, 10. ...
...es a format string in the same format expected by the strftime() function in C. The function is no longer available in Firefox 58+. Examples Deprecated syntax The Date.prototype.to
LocaleFormat method is deprecated and will be removed (no cross-browser support, available in Firefox only). var today = new Date(); var date = today.to
LocaleFormat('%A, %e. %B %Y'); console.log(date); // In German
locale // "Freitag, 10. Marz 2017" Alternative standard syntax using the ECMAScript Intl API The ECMA-402 (ECMAScript Intl API) standard specifies standard objects and methods that enable language sensitive date and time formatting (available in Chrome 24+, Firefox 29+, IE11+, Safari10+). You can now either use the Date.prototype.to
LocaleDateString method if you just want to format one date. var tod...
...And 2 more matches
Intl.Collator.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. ...
... array containing those of the provided
locales that are supported in collation without having to fall back to the runtime's default
locale. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.Collator.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information abou...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in collation without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. The language tags returned are those for which the runtime supports a
locale in collation that the
locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default
locale. Exa...
...And 2 more matches
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. ...
... The Intl.DateTimeFormat.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in date and time formatting without having to fall back to the runtime's default
locale. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.DateTimeFormat.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in date and time formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 2 more matches
Intl.DisplayNames.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...The Intl.DisplayNames.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in date and time formatting without having to fall back to the runtime's default
locale. Syntax Intl.DisplayNames.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in date and time formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 2 more matches
Intl.ListFormat.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
... The Intl.ListFormat.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in date and time formatting without having to fall back to the runtime's default
locale. Syntax Intl.ListFormat.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. ...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in date and time formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 2 more matches
Intl.Locale.prototype.baseName - JavaScript
The Intl.
Locale.prototype.baseName property returns a substring of the
Locale's string representation, containing core information about the
Locale. Description An Intl.
Locale object represents a parsed local and options for that
locale. The baseName property returns basic, core information about the
Locale in the form of a substring of the complete data string. Specifically, the property returns the substring containing the language, and the script and region if available. baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
...Name property returns basic, core information about the
Locale in the form of a substring of the complete data string. Specifically, the property returns the substring containing the language, and the script and region if available. baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
...ore information about the
Locale in the form of a substring of the complete data string. Specifically, the property returns the substring containing the language, and the script and region if available. baseName returns the language ["-" script] ["-" region] *("-" variant) subsequence of the unicode_language_id grammar. ...
...And 2 more matches
Intl.Locale.prototype.language - JavaScript
The Intl.
Locale.prototype.language property is an accessor property that returns the language associated with the
locale. Description Language is one of the core features of a
locale. The Unicode specification treats the language identifier of a
locale as the language and the region together (to make a distiction between dialects and variations, e.g. British English vs. American English). The language property of a
Locale returns strictly the
locale's language subtag. Examples Setting the language in the
locale identifer string argument In order to be a valid Unicode
locale identifier, a string must start with the language subtag. ...
...e and the region together (to make a distiction between dialects and variations, e.g. British English vs. American English). The language property of a
Locale returns strictly the
locale's language subtag. Examples Setting the language in the
locale identifer string argument In order to be a valid Unicode
locale identifier, a string must start with the language subtag. The main argument to the
Locale constructor must be a valid Unicode
locale identifier, so whenever the constructor is used, it must be passed an identifier with a language subtag. ...
...
locale's language subtag. Examples Setting the language in the
locale identifer string argument In order to be a valid Unicode
locale identifier, a string must start with the language subtag. The main argument to the
Locale constructor must be a valid Unicode
locale identifier, so whenever the constructor is used, it must be passed an identifier with a language subtag. ...
...And 2 more matches
Intl.Locale.prototype.numeric - JavaScript
numeric is a Boolean value, which means that it can be either true or false. If numeric is set to false, there will be no special handling of numeric values in strings. If numeric is set to true, then the
locale will take numeric characters into account when collating strings. This special numeric handling means that sequences of decimal digits will be compared as numbers. For example, the string "A-21" will be considered less than "A-123". ...
...ether the
locale has special collation handling for numeric characters. Description Like Intl.
Locale.caseFirst, numeric represents a modification to the collation rules utilized by the
locale. numeric is a Boolean value, which means that it can be either true or false. If numeric is set to false, there will be no special handling of numeric values in strings. If numeric is set to true, then the
locale will take numeric characters into account when collating strings. This special numeric handling means that sequences of decimal digits will be compared as numbers. For example, the string "A-21" will be considered less than "A-123". Examples Setting the numeric value via the
locale string In the Unicode
locale string spec, the values that numeric represents correspond to the key kn. kn is cons...
...e numeric characters into account when collating strings. This special numeric handling means that sequences of decimal digits will be compared as numbers. For example, the string "A-21" will be considered less than "A-123". Examples Setting the numeric value via the
locale string In the Unicode
locale string spec, the values that numeric represents correspond to the key kn. kn is considered a
locale string "extension subtag". These subtags add additional data about the
locale, and are added to
locale identifiers by using the -u extension key. Thus, the numeric value can be added to the inital
locale identifier string that is passed into the
Locale constructor. To set the numeric value, first add the -u extension key to the string. Next, add the -kn extension key to indicate that you are addi...
...And 2 more matches
Intl.NumberFormat.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. ...
... The Intl.NumberFormat.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in number formatting without having to fall back to the runtime's default
locale. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.NumberFormat.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are...
...ngs. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in number formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 2 more matches
Intl.PluralRules.supportedLocalesOf() - JavaScript
For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are lookup and best fit; the default is best fit. For information about this option, see the Intl page. ...
... The Intl.PluralRules.supported
LocalesOf() method returns an array containing those of the provided
locales that are supported in plural formatting without having to fall back to the runtime's default
locale. Syntax Intl.PluralRules.supported
LocalesOf(
locales[, options]) Parameters
locales A string with a BCP 47 language tag, or an array of such strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are lookup and best fit; the default is best fit. For information about this option, see the Intl page. ...
...h strings. For the general form of the
locales argument, see the Intl page. options Optional. An object that may have the following property:
localeMatcher The
locale matching algorithm to use. Possible values are lookup and best fit; the default is best fit. For information about this option, see the Intl page. Return value An array of strings representing a subset of the given
locale tags that are supported in plural formatting without having to fall back to the runtime's default
locale. Description Returns an array with a subset of the language tags provided in
locales. ...
...And 2 more matches
Make your xulrunner app match the system locale - Archive of obsolete content
This article is going to assume a lot of knowledge of xpcom and will be written for someone using python, but the ideas should be adaptable. Also, this may not be the proper way to do this and it may not work for you in all cases. Please update if there are more correct ways to do this. The first step is to get the code we're about to write to run before any of the
locale specific resources are loaded. Democracy does this by creating a command line handler called DemocracyCLH, and then creating a new object of our PyBridge component. The code described lives in the PyBridge component's onStartup method which gets called automatically. The second step is to figure out the system
locale. To be finished later. Then set the
locale preference. The following is python code to set this preferen...
...lled automatically. The second step is to figure out the system
locale. To be finished later. Then set the
locale preference. The following is python code to set this preference. ...
...ished later. Then set the
locale preference. The following is python code to set this preference. ...
... import components ps_cls = components.classes["@mozilla.org/preferences-service;1"] ps = ps_cls.getService(components.interfaces.nsIPrefService) branch = ps.getBranch("general.useragent.") branch.setCharPref("
locale", lang) I also set the LANGUAGE environment variable to match the system
locale so that python's gettext functionality will work (it pulls straight from LANGUAGE instead of using set
locale): os.environ["LANGUAGE"] = lang ...
Intl.Locale.prototype.calendar - JavaScript
While most of the world uses the Gregorian calendar, there are several regional calendar eras used around the world. The following table shows all the valid Unicode calendar key strings, along with a description of the calendar era they represent. ...
... iso8601 ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules) japanese Japanese Imperial calendar persian Persian calendar roc Republic of China calendar The islamicc calendar key has been deprecated. Please use islamic-civil. islamicc Civil (algorithmic) Arabic calendar Examples Adding a calendar in the
Locale string Calendar eras fall under the category of
locale key "extension keys". These keys add additional data about the
locale, and are added to
locale identifiers by using the -u extension. Thus, the calendar era type can be added to the inital
locale identifier string that is passed into the Intl.
Locale constructor. To add the calendar type, first add the -u extension to the string. Next, add th...
...dded to
locale identifiers by using the -u extension. Thus, the calendar era type can be added to the inital
locale identifier string that is passed into the Intl.
Locale constructor. To add the calendar type, first add the -u extension to the string. Next, add the -ca extension to indicate that you are adding a calendar type. Finally, add the calendar era to the string. let frBuddhist = new Intl.
Locale("fr-FR-u-ca-buddhist"); console.log(frBuddhist.calendar); // Prints "buddhist" Adding a calendar with a configuration object The Intl.
Locale constructor has an optional configuration object argument, which can contain any of several extension types, including calendars. Set the calendar property of the configuration object to your desired calendar era, and then pass it into the constructor. le...
... console.log(frBuddhist.calendar); // Prints "buddhist" Adding a calendar with a configuration object The Intl.
Locale constructor has an optional configuration object argument, which can contain any of several extension types, including calendars. Set the calendar property of the configuration object to your desired calendar era, and then pass it into the constructor. ...
Intl.Locale.prototype.hourCycle - JavaScript
Description There are 2 main types of time keeping conventions (clocks) used around the world: the 12 hour clock and the 24 hour clock. The hourCycle property makes it easier for JavaScript programmers to access the clock type used by a particular
locale. Like other additional
locale data, hour cycle type is an extension subtag, which extends the data contained in a
locale string. The hour cycle type can have several different values, which are listed in the table below. Valid hour cycle types Hour cycle type Description h12 Hour system using 1-12; corresponds to 'h' in patterns. ...
...o 'H' in patterns. The 24 hour clock, with midnight starting at 0:00. h11 Hour system using 0-11; corresponds to 'K' in patterns. The 12 hour clock, with midnight starting at 0:00 am. h24 Hour system using 1-24; corresponds to 'k' in pattern. The 24 hour clock, with midnight starting at 24:00. Examples These examples will show you how to add hour cycle data to your
Locale object. Adding an hour cycle via the
locale string In the Unicode
locale string spec, the hour cycle is a
locale string "extension subtag". These subtags add additional data about the
locale, and are added to
locale identifiers by using the -u extension key. Thus, the hour cycle type can be added to the inital
locale identifier string that is passed into the
Locale constructor. To add the hour ...
...o
locale identifiers by using the -u extension key. Thus, the hour cycle type can be added to the inital
locale identifier string that is passed into the
Locale constructor. To add the hour cycle type, first add the -u extension key to the string. Next, add the -hc extension key to indicate that you are adding an hour cycle. Finally, add the hour cycle type to the string. let fr24hour = new Intl.
Locale("fr-FR-u-hc-h23"); console.log(fr24hour.hourCycle); // Prints "h23" Adding an hour cycle via the configuration object argument The Intl.
Locale constructor has an optional configuration object argument, which can contain any of several extension types, including hour cycle types. Set the hourCycle property of the configuration object to your desired hour cycle type, and then pass it into the con...
...4hour.hourCycle); // Prints "h23" Adding an hour cycle via the configuration object argument The Intl.
Locale constructor has an optional configuration object argument, which can contain any of several extension types, including hour cycle types. Set the hourCycle property of the configuration object to your desired hour cycle type, and then pass it into the constructor. ...
Intl.Locale.prototype.maximize() - JavaScript
Description Sometimes, it is convenient to be able to identify the most likely
locale language identifier subtags based on an incomplete langauage ID. The Add Likely Subtags algorithm gives us this functionality. ...
... The Intl.
Locale.prototype.maximize() method gets the most likely values for the language, script, and region of the
locale based on existing values. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax
locale.maximize() Return value A
Locale instance whose baseName property returns the result of the Add Likely Subtags algorithm executed against
locale.baseName. Description Sometimes, it is convenient to be able to identify the most likely
locale language identifier subtags based on an incomplete langauage ID. The Add Likely Subtags algorithm gives us this functionality. For instance, given the language ID "en",...
... English can only be written in the Latin script, and is most likely to be used in the United States, as it is the largest English-speaking country in the world. This functionality is provided to JavaScript programmers via the maximize() method. maximize() only affects the main subtags that comprise the language identifier: language, script, and region subtags. Other subtags after the "-u" in the
locale indentifier are called extension subtags and are not affected by the maximize() method. Examples of these subtags include
Locale.hourCycle,
Locale.calendar, and
Locale.numeric. Examples Using maximize let my
Locale = new Intl.
Locale("fr", {hourCycle: "h24", calendar: "gregory"}); console.log(my
Locale.baseName); // Prints "fr" console.log(my
Locale.toString()); // Prints "fr-u-ca-gregory-hc-h24" ...
...The "Latn" and "FR" tags are added, // since French is only written in the Latin script and is most likely to be spoken in France. console.log(myLocMaximized.baseName); // Prints "fr-Latn-FR-u-ca-gregory-hc-h24". ...
Intl.Locale.prototype.minimize() - JavaScript
Description This method carries out the reverse of maximize(), removing any language, script, or region subtags from the
locale language identifier (essentially the contents of baseName). ...
... The Intl.
Locale.prototype.minimize() method attempts to remove information about the
locale that would be added by calling
Locale.maximize(). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax
locale.minimize() Return value A
Locale instance whose baseName property returns the result of the Remove Likely Subtags algorithm executed against
locale.baseName. Description This method carries out the reverse of maximize(), removing any language, script, or region subtags from the
locale language identifier (essentially the contents of baseName). This is useful when there are superfluous subtags in the language ide...
...e language identifier (essentially the contents of baseName). This is useful when there are superfluous subtags in the language identifier; for instance, "en-Latn" can be simplified to "en", since "Latn" is the only script used to write English. minimize() only affects the main subtags that comprise the language identifier: language, script, and region subtags. Other subtags after the "-u" in the
locale indentifier are called extension subtags and are not affected by the minimize() method. Examples of these subtags include
Locale.hourCycle,
Locale.calendar, and
Locale.numeric. Examples Using minimize let my
Locale = new Intl.
Locale("fr-Latn-FR", {hourCycle: "h24", calendar: "gregory"}); console.log(my
Locale.baseName); // Prints "fr-Latn-FR" console.log(my
Locale.toString()); // Prints "fr-Latn-...
...console.log(myLocMinimized.baseName); // Prints "fr-u-ca-gregory-hc-h24". // Note that the extension tags (after "-u") remain unchanged. ...
Intl.Locale.prototype.script - JavaScript
Description A script, sometimes called writing system, is one of the core attributes of a
locale. It indicates the set of symbols, or glyphs, that are used to write a particular language. For instance, the script associated with English is Latin, whereas the script typically associated with Korean is Hangul. In many cases, denoting a script is not strictly necessary, since the language (which is necessary) is only written in a single script. There are exceptions to this rule, however, and it is important to indicate the script whenever possible, in order to have a complete Unicode language identifier. ...
... whereas the script typically associated with Korean is Hangul. In many cases, denoting a script is not strictly necessary, since the language (which is necessary) is only written in a single script. There are exceptions to this rule, however, and it is important to indicate the script whenever possible, in order to have a complete Unicode language identifier. Examples Setting the script in the
locale identifer string argument The script is the second part of a valid Unicode language identifier string, and can be set by adding it to the
locale identifier string that is passed into the
Locale constructor. Note that the script is not a required part of a
locale identifier. let scriptStr = new Intl.
Locale("en-Latn-US"); console.log(scriptStr.script); // Prints "Latn" Setting the script via th...
...The script is the second part of a valid Unicode language identifier string, and can be set by adding it to the
locale identifier string that is passed into the
Locale constructor. Note that the script is not a required part of a
locale identifier. let scriptStr = new Intl.
Locale("en-Latn-US"); console.log(scriptStr.script); // Prints "Latn" Setting the script via the configuration object The
Locale constructor takes a configuration object, which can be used to set the script subtag and property. ...
...ring that is passed into the
Locale constructor. Note that the script is not a required part of a
locale identifier. let scriptStr = new Intl.
Locale("en-Latn-US"); console.log(scriptStr.script); // Prints "Latn" Setting the script via the configuration object The
Locale constructor takes a configuration object, which can be used to set the script subtag and property. ...
JS_SetDefaultLocale
This article covers features introduced in SpiderMonkey 24 Set and reset the default
locale for the ECMAScript Internationalization API. Syntax bool JS_SetDefault
Locale(JSRuntime *rt, const char *
locale); void JS_ResetDefault
Locale(JSRuntime *rt); Name Type Description rt JSRuntime * Pointer to a JS runtime
locale const char * String represents
locale. Description JS_SetDefault
Locale sets the default
locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). Note that the Internationalization API encourages clients to specify their own
locales. The
locale string remains owned by the caller. JS_ResetDefault
Locale resets the default
locale to OS defaults. See Also MXR ID Sear...
...ription JS_SetDefault
Locale sets the default
locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). Note that the Internationalization API encourages clients to specify their own
locales. The
locale string remains owned by the caller. JS_ResetDefault
Locale resets the default
locale to OS defaults. ...
...ault
locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). ...
Intl.Locale.prototype.region - JavaScript
Description The region is an essential part of the
locale identifier, as it places the
locale in a specific area of the world. Knowing the
locale's region is vital to identifying differences between
locales. For example, English is spoken in the United Kingdom and the United States of America, but there are differences in spelling and other language conventions between those two countries. Knowing the
locale's region helps JavaScript programmers make sure that the content from their sites and applications is correctly displayed when viewed from different areas of the world. ...
...e, English is spoken in the United Kingdom and the United States of America, but there are differences in spelling and other language conventions between those two countries. Knowing the
locale's region helps JavaScript programmers make sure that the content from their sites and applications is correctly displayed when viewed from different areas of the world. Examples Setting the region in the
locale identifer string argument The region is the third part of a valid Unicode language identifier string, and can be set by adding it to the
locale identifier string that is passed into the
Locale constructor. The region is a mandatory part of a let regionStr = new Intl.
Locale("en-Latn-US"); console.log(regionStr.region); // Prints "US" Setting the region via the configuration object The
Locale ...
...ing it to the
locale identifier string that is passed into the
Locale constructor. The region is a mandatory part of a let regionStr = new Intl.
Locale("en-Latn-US"); console.log(regionStr.region); // Prints "US" Setting the region via the configuration object The
Locale constructor takes a configuration object, which can be used to set the region subtag and property. ...
TypedArray.prototype.toLocaleString() - JavaScript
The to
LocaleString() method returns a string representing the elements of the typed array. The elements are converted to strings and are separated by a
locale-specific string (such as a comma ","). This method has the same algorithm as Array.prototype.to
LocaleString() and, as the typed array elements are numbers, the same algorithm as Number.prototype.to
LocaleString() applies for each element. TypedArray is one of the typed array types here. Syntax typedarray.to
LocaleString([
locales [, options]]); Parameters The
locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are en...
...he language whose formatting conventions should be used. In implementations, which ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.NumberFormat() constructor for details on these parameters and how to use them. Return value A string representing the elements of the typed array. ...
...ich ignore the
locales and options arguments, the
locale used and the form of the string returned are entirely implementation dependent. See the Intl.NumberFormat() constructor for details on these parameters and how to use them. Return value A string representing the elements of the typed array. Examples Using to
LocaleString var uint = new Uint32Array([2000, 500, 8123, 12, 4212]); uint.to
LocaleString(); // if run in a de-DE
locale // "2.000,500,8.123,12,4.212" uint.to
LocaleString('en-US'); // "2,000,500,8,123,12,4,212" uint.to
LocaleString('ja-JP', { style: 'currency', currency: 'JPY' }); // "?2,000,?500,?8,123,?12,?4,212" Specifications Specification ECMAScript (ECMA-262)The definition of 'TypedArray.prototype.to
LocaleString' in that specification. ...
Locale - MDN Web Docs Glossary: Definitions of Web-related terms
Locale is a set of language- or country-based preferences for a user interface. A program draws its
locale settings from the language of the host system. Among other things,
locales represent paper format, currency, date format, and numbers according to the protocols in the given region. ...
...
Locale is a set of language- or country-based preferences for a user interface. A program draws its
locale settings from the language of the host system. Among other things,
locales represent paper format, currency, date format, and numbers according to the protocols in the given region. ...
CompositionEvent.locale - Web APIs
Specifications Specification Status Comment Document Object Model (DOM) Level 3 Events Specification Obsolete No longer in the spec, but still supported. ...
... The
locale read-only property of the CompositionEvent interface returns the
locale of current input method (for example, the keyboard layout
locale if the composition is associated with IME). Syntax my
Locale = CompositionEvent.
locale Value A DOMString representing the
locale of current input method. Specifications Specification Status Comment Document Object Model (DOM) Level 3 Events Specification Obsolete No longer in the spec, but still supported. ...
IDBIndex.isAutoLocale - Web APIs
The isAuto
Locale read-only property of the IDBIndex interface returns a Boolean indicating whether the index had a
locale value of auto specified upon its creation (see createIndex()'s optionalParameters.) Syntax var myIndex = objectStore.index('index'); console.log(myIndex.isAuto
Locale); Value A Boolean. Example In the following example we open a transaction and an object store, then get the index lName from a simple contacts database. We then open a basic cursor on the index using IDBIndex.openCursor -- this works the same as opening a cursor directly on an ObjectStore using IDBObjectStore.openCursor except that the returned records are sorted based on the index, not the primary key. The isAuto
Locale value is logged to the console. function displayDataByIndex() { tableEntr...
...or except that the returned records are sorted based on the index, not the primary key. The isAuto
Locale value is logged to the console. ...
IDBLocaleAwareKeyRange - Web APIs
The IDB
LocaleAwareKeyRange interface of the IndexedDB API is a Firefox-specific version of IDBKeyRange -- it functions in exactly the same fashion, and has the same properties and methods, but it is intended for use with IDBIndex objects when the original index had a
locale value specified upon its creation (see createIndex()'s optionalParameters) -- that is, it has
locale aware sorting enabled. Methods This interface inherits all the methods of its parent interface, IDBKeyRange. Properties This interface inherits all the properties of its parent interface, IDBKeyRange. Bear in mind however that IDB
LocaleAwareKeyRange has its own implementation of IDBKeyRange.bound. This is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that's not...
...is interface inherits all the methods of its parent interface, IDBKeyRange. Properties This interface inherits all the properties of its parent interface, IDBKeyRange. Bear in mind however that IDB
LocaleAwareKeyRange has its own implementation of IDBKeyRange.bound. This is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that's not the case. With
locale-aware indexes, the meaning of < depends on the
locale, so for example in Lithuanian Y is sorted between I and K. The only difference between IDBKeyRange and IDB
LocaleAwareKeyRange is that the latter doesn't do the aforementioned check. Developers should always use IDB
LocaleAwareKeyRange when dealing with
locale-aware indexes. Examples function displayData() { var keyRangeValue = IDB
LocaleAwa...
:-moz-locale-dir(ltr) - CSS: Cascading Style Sheets
The :-moz-
locale-dir(ltr) CSS pseudo-class is a Mozilla extension that matches an element if the user interface is being displayed left-to-right. This is determined by the preference intl.uidirection.
locale (where
locale is the current
locale) being set to "ltr". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's
locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default
locale, since they can support both left-to-right and right-to-left layouts regardless of
locale specifics. This selector does not work properly from HTML; it always matches, regardless of whether the UI
locale is left-to-right or right-to-left. Syntax :-moz-l...
...gardless of whether the UI
locale is left-to-right or right-to-left. Syntax :-moz-
locale-dir(ltr) Examples This example doesn't work if you're not using Firefox, and may not work even in Firefox due to an issue with the selector not working propertly with HTML content. It was designed for use with XUL. HTML <p>If you're using a left-to-right interface, this should be red.</p> CSS p:-moz-
locale-dir(ltr) { color: red; } Result Specifications Not part of any standard. ...
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
The :-moz-
locale-dir(rtl) CSS pseudo-class is a Mozilla extension that matches an element if the user interface is being displayed right-to-left. This is determined by the preference intl.uidirection.
locale (where
locale is the current
locale) being set to "rtl". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's
locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default
locale, since they can support both left-to-right and right-to-left layouts regardless of
locale specifics. This selector does not work properly from HTML; it never matches, no matter whether the UI
locale is left-to-right or right-to-left. ...
...an vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default
locale, since they can support both left-to-right and right-to-left layouts regardless of
locale specifics. This selector does not work properly from HTML; it never matches, no matter whether the UI
locale is left-to-right or right-to-left. Syntax :-moz-
locale-dir(rtl) Examples This example will not work if you're not using Firefox, and might not work properly even in Firefox due to an issue with using this selector in HTML. HTML <p>If you're using a right-to-left interface, this should be red.</p> CSS p:-moz-
locale-dir(rtl) { color: red; } Result Specifications Not part of any standard. ...
Intl.Locale() constructor - JavaScript
The Intl.
Locale constructor is a standard built-in property of the Intl object that represents a Unicode
locale identifier. Syntax new Intl.
Locale(tag [, options]) Parameters tag The Unicode
locale identifier string. options An object that contains configuration for the
Locale. Keys are Unicode
locale tags, values are valid Unicode tag values. Examples Basic usage At its very simplest, the Intl.
Locale constructor takes a
locale identifier string as its argument: let us = new Intl.
Locale('en-US'); Using the
Locale constructor with an options object The constructor also takes an optional configuration object argument, which can contain any of several extension types. For example, set the hourCycle property of the configuration object to your desired hour cycle type, and then pas...
... string as its argument: let us = new Intl.
Locale('en-US'); Using the
Locale constructor with an options object The constructor also takes an optional configuration object argument, which can contain any of several extension types. ...
Intl.getCanonicalLocales() - JavaScript
The Intl.getCanonical
Locales() method returns an array containing the canonical
locale names. Duplicates will be omitted and elements will be validated as structurally valid language tags. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.getCanonical
Locales(
locales) Parameters
locales A list of String values for which to get the canonical
locale names. Return value An array containing the canonical
locale names. ...
...a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.getCanonical
Locales(
locales) Parameters
locales A list of String values for which to get the canonical
locale names. Return value An array containing the canonical
locale names. Examples Using getCanonical
Locales Intl.getCanonical
Locales('EN-US'); // ["en-US"] Intl.getCanonical
Locales(['EN-US', 'Fr']); // ["en-US", "fr"] Intl.getCanonical
Locales('EN_US'); // RangeError:'EN_US' is not a structurally valid language tag Specifications Specification ECMAScript Internationalization API (ECMA-402)The definition of 'Intl.getCanonical
Locales' in that specification. ...
appLocale - Archive of obsolete content
<< XUL Reference app
Locale Obsolete since Gecko 1.9.1 Type: nsI
Locale Returns the XPCOM object which holds information about the user's
locale. This is an object which implements nsI
Locale. Gecko 1.9.1 note This property was removed in Gecko 1.9.1. ...
L20n Javascript API
You can listen to the ready event (emitted by the Context instance when all the resources have been compiled) and use ctx.getSync and ctx.getEntitySync to get translations synchronously. Alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize. ...
...ranslations synchronously. Alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize. ...
...chronously. Alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize. ...
...And 25 more matches
Localizing with Koala
In a real-life situation, that would become for example "de" (for German) or "es-ES" (for Spanish in Spain). Translating to x-testing will basically consist of converting any strings to uppercase, for example "File" in original version (en-US) will become "FILE" in x-testing. ...
...la (bug 21930), it is recommended that you don't choose a path that contains spaces (like C:\Documents and Settings\user\...). Click "Open" to create the project. Koala will check for Mercurial. Make sure that your Mercurial installation is in your system's $PATH. Setup wizard will open. Configure the Application Choose "Firefox" as the application. Version: 3.6. Appname: browser. Included
locale: en-US (this is the original
locale you're translating from). Leave Location empty for now. Check the "Mercurial" checkbox. Note that you don't have to edit the Location field, it automatically fills in when you check the "Mercurial" checkbox: "C:\mozilla\l10n\application\Firefox\3.6". URL: http://hg.mozilla.org/releases/mozilla-1.9.2. Branch: default. Revision: leave empty. Click "OK". Koala ...
...zilla\l10n\application\Firefox> rmdir 3.6 C:\mozilla\l10n\application\Firefox> hg clone http://hg.mozilla.org/releases/mozilla-1.9.2 3.6 requesting all changes adding changesets adding manifests adding file changes added 33099 changesets with 158636 changes to 50664 files (+9 heads) updating working directory 40357 files updated, 0 files merged, 0 files removed, 0 files unresolved Configure the
Locale Locale ID: x-testing (put your
locale's code) Version: 3.6 Location: choose the folder where you want to keep the localized files or leave empty for now Check "Mercurial" if you wish to use Mercurial to keep the revision history of your files (very recommended) Existing localizations: URL: if you're editing an existing localization or you already have a repository set up (either on hg.mozilla...
...And 20 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
UL application. For example, in the Firefox browser window, everything other than the web page being displayed in the content area is chrome. Extensions also can be considered XUL applications with chrome. Three kinds of packages make up chrome The content package This package is used to contain the main XUL and JavaScript source files. Most extensions consist of a single content package2 The
locale package This package is used to contain language data that can be translated. To make an extension's GUI support multiple languages, you can include multiple
locale packages, one for each language. The skin package This is used to include source files used as visual elements in the GUI, including style sheets and images. Most extensions include only one skin package, but you can include multip...
...xul", and the type of the package is "content". Source files represented through chrome URLs run with UniversalXPConnect privileges; even if they haven't been granted "use XPConnect as local file" privileges, as discussed in Chapter 4, they will be able to use XPCOM functions (Figure 1). Extension/ chrome manifest Chrome/ #registered in the chrome content package #Run with privileges
locale package skin package Figure 1: Chrome packages and chrome registration (FIXME: Not really explicit and not a Figure) Cross-package overlays The "overlay" technique introduced in Chapter 3 required the use of the xul-overlay instruction in the XUL document that is the overlay target. It is also possible to coerce an overlay without using the xul-overlay instruction in the XUL document--this...
...rlay (FIXME: Not really explicit and not a Figure) Conclusion This has been a brief introduction to chrome that probably leaves a lot of unanswered questions. If you keep in mind the following three points at the very least, the next section, Developing a Simple Extension, should help flesh out your understanding. An extension's GUI, or chrome, can consist of three kinds of package: content,
locale, and skin. Use a cross-package overlay on top of browser.xul to add a button or menu item to the Firefox browser window. The chrome manifest plays two important roles: it registers the contents of the chrome packages, and invokes the cross-package overlay. Developing a Simple Extension: Hello World In this section, we will write an extremely simple "hello world" extension that only displays ...
...And 19 more matches
Creating localizable web applications
nippets used in the examples below come from an early version of the getpersonas.com website. In some cases, the code snippets were slightly changed to better illustrate the recommendations or for clarity. Cheatsheet Don't hardcode English text, formats (numbers, dates, addresses, etc.), word order or sentence structure. Don't put text or numbers in images. Don't forget about right-to-left
locales. Take advantage of printf() (or equivalents) and use variables in the English strings. Write semantic code (e.g. don't use text and <img/> for decorations; instead, use CSS). Document your code so that localizers know what they're translating (e.g. in gettext use comments and contexts). App Logic Detect the
locale correctly Be smart about detecting the user's
locale correctly. You can use...
...tly. You can use one or more of the following techniques: HTTP Accept-Language headers, the UA string, IP geolocation. See examples of the addons.mozillaorg code at /addons/trunk/site/app/config/language.php and /addons/trunk/site/app/config/language.inc.php. The LANGUAGE_CONFIG class expects arrays of valid languages & supported languages. Always give the user a possibility to change the
locale (e.g. by adding
locale dropdown menu at bottom of page) and remember this choice for the future visits. Use the
locale code in the URLs Depending on how you detect user's
locale, you may want to provide a way of overriding the autodetection. You can achieve this by setting a cookie when the user changes the
locale with the language dropdown, or by looking for
locale code in the URL. The latter ...
...http://example.com/foo/bar) or on its end (e.g. http://example.com/foo/bar/en-US). ...
...And 19 more matches
Localization - Archive of obsolete content
iles packaged with your add-on the title, description and homepage fields of your add-on's metadata the title and description fields of your add-on's preferences. It doesn't, yet, support localization of CSS or content scripts, or the add-on's title and description that appear in the Add-ons Manager. See Limitations below. ...
...omepage fields of your add-on's metadata the title and description fields of your add-on's preferences. It doesn't, yet, support localization of CSS or content scripts, or the add-on's title and description that appear in the Add-ons Manager. See Limitations below. Localized strings Translated strings are kept in a directory called "
locale" under your main add-on directory, one file for each
locale. ...
...sn't, yet, support localization of CSS or content scripts, or the add-on's title and description that appear in the Add-ons Manager. See Limitations below. Localized strings Translated strings are kept in a directory called "
locale" under your main add-on directory, one file for each
locale. ...
...And 18 more matches
Repackaging Firefox - Archive of obsolete content
view of the process and the pieces involved: You will need the following to get started: A Macintosh computer (even for repackaging Windows or Linux only); it may be either PowerPC or Intel based. The repackager tool. Currently that page mentions only Firefox 1.5.x, but it supports Firefox 2. The pristine Firefox 2 installer files (Windows .exe, Mac .dmg, or Linux .tar.gz) for each of the
locales you need. At the time of writing this document, the latest builds are here. A "distro" extension that makes the changes you desire. Once you have all the ingredients, the customization process is quite easy: Download the Firefox installer. Install the repackager tool like you would any Mac application. Make sure it starts up and launches the GUI. Put together your extension that customiz...
...EX The best way to get started is probably to look at a simple DEX and modify it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. ...
...ed is probably to look at a simple DEX and modify it for your own purposes. Download the sample. XPI files are specially crafted ZIP files in disguise. You can use any ZIP program (WinZIP on Windows, zip on Mac or Linux, etc) to extract it. ...
...And 16 more matches
L10n Checks
It allows Mozilla localizers to easily check their work. Installation (releases) L10n Checks needs to be installed. To do that, you must have Python 2.5, 2.6, or 2.7 installed on your machine. Once Python is installed, the easiest way to install L10n Checks (on Mac or Linux) is to just run: $ sudo easy_install -U l10n-checks or, if you're on Windows: $ easy_install -U l10n-checks Installation (development versions) L10n Checks needs to be installed, and it requires that you have Python and Mercurial installed on your machine. ...
...un: $ hg clone http://hg.mozilla.org/users/akalla_aviary.pl/silme-patched/ $ cd silme-patched/ $ sudo python setup.py install or, if you're on Windows: $ hg clone http://hg.mozilla.org/users/akalla_aviary.pl/silme-patched/ $ cd silme-patched/ $ python setup.py install Running it Mercurial source (source) mode L10n Checks gathers the directories to compare from an ini file, usually found in $APP/
locales/l10n.ini. You pass both the path to the ini file and the parent directory of the localizations as first arguments, followed by the
locale codes of the
locales you want to compare. If you want to test the localization for de, run: check-l10n-completeness browser/
locales/l10n.ini ../l10n/ de Add-ons (xpi) mode L10n Checks gathers the
locales to compare from the chrome.manifest file inside the xpi...
...ctory of the localizations as first arguments, followed by the
locale codes of the
locales you want to compare. If you want to test the localization for de, run: check-l10n-completeness browser/
locales/l10n.ini ../l10n/ de Add-ons (xpi) mode L10n Checks gathers the
locales to compare from the chrome.manifest file inside the xpi file. You pass the path to the xpi file (optionally) followed by the
locale codes of the
locales you want to compare. If you want to test the localization for de, run: check-l10n-completeness -i xpi my-extension.xpi de To check all
locales in an extension: check-l10n-completeness -i xpi my-extension.xpi Language packs (xpis) mode L10n Checks can compare two
locales found in different xpi files. ...
...And 16 more matches
Intl - JavaScript
ich are objects that enable language-sensitive string comparison. Intl.DateTimeFormat() Constructor for objects that enable language-sensitive date and time formatting. Intl.DisplayNames() Constructor for objects that enable the consistent translation of language, region and script display names. Intl.ListFormat() Constructor for objects that enable language-sensitive list formatting. Intl.
Locale() Constructor for objects that represents a Unicode
locale identifier. Intl.NumberFormat() Constructor for objects that enable language-sensitive number formatting. Intl.PluralRules() Constructor for objects that enable plural-sensitive formatting and language-specific rules for plurals. Intl.RelativeTimeFormat() Constructor for objects that enable language-sensitive relative time formatti...
...ts a Unicode
locale identifier. Intl.NumberFormat() Constructor for objects that enable language-sensitive number formatting. Intl.PluralRules() Constructor for objects that enable plural-sensitive formatting and language-specific rules for plurals. Intl.RelativeTimeFormat() Constructor for objects that enable language-sensitive relative time formatting. ...
...r. Intl.NumberFormat() Constructor for objects that enable language-sensitive number formatting. Intl.PluralRules() Constructor for objects that enable plural-sensitive formatting and language-specific rules for plurals. Intl.RelativeTimeFormat() Constructor for objects that enable language-sensitive relative time formatting. ...
...And 15 more matches
Complete - Archive of obsolete content
check extensions for compatibility before installing them. These version checks depend on the version numbers specified in the install.rdf file. There are two approaches: pessimistic and optimistic. The approach that is normally recommended is pessimisti...
...check extensions for compatibility before installing them. These version checks depend on the version numbers specified in the install.rdf file. There are two approaches: pessimistic and optimistic. The approach that is normally recommended is pessimistic. The extension is assumed to f...
...check extensions for compatibility before installing them. These version checks depend on the version numbers specified in the install.rdf file. There are two approaches: pessimistic and optimistic. The approach that is normally recommended is pessimistic. The extension is assumed to fail in any future version of...
...And 13 more matches
Chrome registration
viders: Content The main source file for a window description comes from the content provider, and it can be any file type viewable from within Mozilla. It will typically be a XUL file, since XUL is designed for describing the contents of windows and dialogs. The JavaScript files that define the user interface are also contained within the content packages, as well as most XBL binding files.
Locale Localizable applications keep all their localized information in
locale providers. This allows translators to plug in a different chrome package to translate an application without altering the rest of the source code. The two main types of localizable files are DTD files and Java-style properties files. Skin A skin provider is responsible for providing a complete set of files that describe th...
...g those found in XBL) loaded from skin packages will not execute. The chrome registry The Gecko runtime maintains a service known as the chrome registry that provides mappings from chrome package names to the physical location of chrome packages on disk. This chrome registry is configurable and persistent, and thus a user can install different chrome providers, and select a preferred skin and
locale. This is accomplished through xpinstall and the extension manager. In order to inform the chrome registry of the available chrome, a text manifest is used: this manifest is "chrome.manifest" in the root of an extension, or theme, or XULRunner application. The plaintext chrome manifests are in a simple line-based format. Each line is parsed individually; if the line is parsable the chrome regist...
...d: this manifest is "chrome.manifest" in the root of an extension, or theme, or XULRunner application. The plaintext chrome manifests are in a simple line-based format. Each line is parsed individually; if the line is parsable the chrome registry takes the action identified by that line, otherwise the chrome registry ignores that line (and prints a warning message in the runtime error console).
locale packagename
localename path/to/files skin packagename skinname path/to/files Note: The characters @ # ; : ? / are not allowed in the packagename. Firefox 2, Thunderbird 2, and SeaMonkey 1.1 will not find the chrome when packagename is mixed case. If the above example had a packagename of CamelCasePackage, you would get an error message similar to "No chrome registered for chrome://camelcasep...
...And 13 more matches
Localizations and character encodings - Developer guides
entation. Unfortunately, using UTF-8 and declaring that UTF-8 was used was not always the prevalent way of offering Web content. In the 1990s, it was common to leave the encoding undeclared and to use a region-specific encoding that wasn't able to represent all of Unicode. Firefox needs a fallback encoding that it uses for non-conforming legacy content that doesn't declare its encoding. ...
...encoding that it uses for non-conforming legacy content that doesn't declare its encoding. For most
locales, the fallback encoding is windows-1252 (often called ISO-8859-1), which was the encoding emitted by most Windows applications in the 1990s and a superset of the encoding emitted by most UNIX applications in the 1990s as a deployed in the America has and in Western Europe. However, there are
locales where Web publishing was common already in the 1990s but the windows-1252 encoding was not suitable for the local language. In these
locales, legacy content that doesn't declare its encoding is typically encoded using a legacy encoding other than windows-1252. In order to work with legacy content, some Firefox localizations need a non-windows-1252 fallback encoding. Unfortunately, this means th...
...but the windows-1252 encoding was not suitable for the local language. In these
locales, legacy content that doesn't declare its encoding is typically encoded using a legacy encoding other than windows-1252. In order to work with legacy content, some Firefox localizations need a non-windows-1252 fallback encoding. Unfortunately, this means that the Web-exposed functionality of Firefox differs by
locale and it is hard to read legacy content across
locales with different fallback encodings. ...
...And 11 more matches
Creating a Language Pack
You still need to specify which application you're localizing (e.g., for Firefox, that's browser, Thunderbird would be mail). Configure step You need to prepare the build directory, which is done with ./mach configure You only need to run this if the version number of Firefox changes. WINDOWS: Replace make with mozmake in the commands below! Creating a langpack We will now merge...
...hich application you're localizing (e.g., for Firefox, that's browser, Thunderbird would be mail). Configure step You need to prepare the build directory, which is done with ./mach configure You only need to run this if the version number of Firefox changes. WINDOWS: Replace make with mozmake in the commands below! Creating a langpack We will now merge the localized files from x-testing
locale with the en-US files from the original source. Every time you want to create a langpack, you need to be in the directory obj-firefox-build/browser/
locales. It is likely that you will continue to generate language packs as your progress just to test your work. While in that directory, issue the following command: $ make merge-x-testing
LOCALE_MERGEDIR=$(PWD)/mergedir x-testing: browser ...
...ed This step is not necessary anymore to create the language pack, because it is included in the next command. It is only useful if you want to preview the contents of the mergedir. You'll see that it contains the files which in your localization were missing some entities. All other files will be taken from x-testing directly. ...
...And 10 more matches
The Essentials of an Extension - Archive of obsolete content
here are many other tags that can be added, for contributors and translators. The full specification of the install.rdf file has all the details. Since extensions can be translated to multiple languages, it is often necessary to translate the extension's description, or even its name. A localized description and name can be added with the following code: <em:localized> <Description> <em:
locale>es-ES</em:
locale> <em:name>XUL School Hola Mundo</em:name> <em:description>Bienvenido a XUL School!</em:description> </Description> </em:localized> The es-ES
locale string indicates that this is the Spanish (es) localization for Spain (ES). You can add as many <em:localized> sections as you need. For Firefox 2, localizing this file is a little more complicated. We'll discuss localiza...
...an be seen as having two parts: (1) the chrome and (2) possibly a content area, like the one that displays web pages in a Firefox tab. Windows like the Downloads window are pure chrome. Most of the code for an extension resides in the chrome folder, just like in the Hello World example. As we saw in the directory structure of the unpacked extension, the chrome is composed of 3 sections: content,
locale and skin. The 3 are necessary for most extensions. If we open the chrome.manifest file (again, any text editor will do), we see that the same 3 sections are mentioned: content xulschoolhello content/ skin xulschoolhello classic/1.0 skin/
locale xulschoolhello en-US
locale/ The chrome.manifest file tells Firefox where to look for chrome files. The text is spac...
...t xulschoolhello content/ skin xulschoolhello classic/1.0 skin/
locale xulschoolhello en-US
locale/ The chrome.manifest file tells Firefox where to look for chrome files. The text is spaced to look like a table, but that is not necessary. The parser ignores repeated spaces. The first word in a line tells Firefox what it is that is being declared (content, skin,
locale, or others mentioned later on). The second is the package name, which we will explain shortly. Skin and
locale packages have a third value to specify what
locale or what skin they are extending. There can be multiple skin and
locale entries relating to different skins and
locales. ...
...And 9 more matches
Localizing without a specialized tool
eleases/mozilla-1.9.2 This will pull the Mozilla 1.9.2 sources from the remote repository and create a Mercurial clone in mozilla-1.9.2 inside your working directory. Next, again in your working dir, create a directory that will serve as localization base: $ mkdir l10n-mozilla-1.9.2 $ cd l10n-mozilla-1.9.2 Inside this directory you will put all the localization files in a folder named after your
locale, e.g. x-testing. Depending on your case, you can do it in one of the following ways: If no localization exists yet, create an empty folder and create a Mercurial repository in it: $ mkdir x-testing $ cd x-testing $ hg init If there is a BitBucket repository with localization files, you can pull from it. This will automatically create an "x-testing" directory in your current directory (you sho...
...9.2). $ hg clone http://bitbucket.org/mozillal10n/x-testing If there is an hg.mozilla.org repository with localization files, you can pull from it too: $ hg clone http://hg.mozilla.org/releases/l10n-mozilla-1.9.2/x-testing Eventually, you should end up with a folder hierarchy described above in the Folder structure section. You are now ready to start translating! Getting Started with Compare-
Locales You are going to need to create the structure of your localization, where, one-by-one, each of the files needing localization will be copied. This directory structure needs to mimic the same as the en-US source files concerning localization. You will use a tool called compare-
locales to do the comparison between your
locale's files and the en-US reference. First, install compare-
locales. You ca...
...re of your localization, where, one-by-one, each of the files needing localization will be copied. This directory structure needs to mimic the same as the en-US source files concerning localization. You will use a tool called compare-
locales to do the comparison between your
locale's files and the en-US reference. First, install compare-
locales. You can follow more detailed guidelines on compare-
locale's page, but running the following command from the command line should be enough: $ sudo easy_install -U compare-
locales To start, be sure to open your command line interface and change your directory to where you are keeping your localization files, the en-US sources $ cd /path/to/your/working/directory Now, you will need run compare
locales. To do this, enter the following commands, keeping ...
...And 8 more matches
Index - Web APIs
ty, Read-only, Reference, dependentLocality, payment An object based on AddressErrors includes a dependentLocality property when the address's dependentLocality property couldn't be validated. The returned string explains the error and should offer suggestions for how to correct it. 34 AddressErrors.languageCode API, Address, AddressErrors, Deprecated, Language, LanguageCode,
Locale, Payment Request, Payment Request API, Property, Reference, payment An object based on AddressErrors includes a languageCode property when the address's languageCode property couldn't be validated. The returned string explains the error and should offer suggestions for how to correct it. 35 AddressErrors.organization API, Address, AddressErrors, Error, Payment Request, Paymen...
...xact nature varies depending on the type of event that generated the CompositionEvent object. 652 CompositionEvent.initCompositionEvent() API, CompositionEvent, Deprecated, Method, Reference, initCompositionEvent The initCompositionEvent() method of the CompositionEvent interface initializes the attributes of a CompositionEvent object instance. 653 CompositionEvent.
locale API, CompositionEvent, Deprecated,
Locale, Property, Reference The
locale read-only property of the CompositionEvent interface returns the
locale of current input method (for example, the keyboard layout
locale if the composition is associated with IME). 654 Console API API, Debugging, Overview, console, dump, log, output, test The Console API provides functionality...
... IDBRequest object on which subsequent events related to this operation are fired. 2041 IDBIndex.getKey() API, Database, IDBIndex, IndexedDB, Method, Reference, Storage If a key is found it is set as the result of the request object: this returns the primary key of the record the key is associated with, not the whole record as IDBIndex.get does. ...
...And 8 more matches
Application Translation with Mercurial
"de" for German). The localization lead for your language knows the branch. The default localization branch is aurora. Next check what is still untranslated by going to Localization status page and click on the page for your language. In the section "Applications & Sign-offs", you will find different products and branches which are currently in translation. gaia-* denotes branches of Firefox OS, the operating system for mobile devices. ...
...ed programs to compile Mozilla applications like Firefox and Thunderbird from Build Instructions. This is only necessary once. MozillaBuild must be installed into an absolute file path without whitespaces, else it will break. File comparison program For the translation, it is recommend to use file comparison program to compare the English file (containing the new texts) with the file of your
locale (which is still missing the new strings). This example uses WinMerge: Download and install it. A comparison of alternatives (e.g. for Linux and Mac OS) is available on Wikipedia. File and text editor For editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to comp...
...on progress should be tracked. This can be done in a text editor or word processor or any other tool in which you can attach different kind of states to the individual texts to translate. The Firefox extension Scrapbook is used in this guide. Install it into your default Firefox profile (you will have more than one profile when following this guide). Getting the current Texts in English and your
Locale Obtaining the English texts with the source code Get the source code by downloading the following file: Firefox Desktop or Firefox for Android: Download the mozilla-<branch>.hg file (e.g. mozilla-aurora.hg) from https://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/ The file is not small, but after initially downloading it, you only need to download the latest changes in the future. Thund...
...And 7 more matches
Localizing with Mozilla Translator
regularly running QA checks and trying to minimize them. you will always do better if you can export a partial glossary and reimport it as needed. See the following example. Let's assume you have a Firefox product in MT with the directory layout present in language packs, as you probably would need for a initial localization. The directory structure will look like this: (ab-CD JAR root)
locale |-- branding | |-- brand.dtd | `-- brand.properties |-- browser | |-- aboutDialog.dtd . . |-- browser-region | `-- region.properties `-- ab-CD |-- alerts | `-- notificationNames.properties |-- autoconfig | `-- autoconfig.properties |-- cookie | |-- cookieAcceptDialog.dtd | `-- cookieAcceptDialog.properties |-- glo...
...egion | `-- region.properties `-- ab-CD |-- alerts | `-- notificationNames.properties |-- autoconfig | `-- autoconfig.properties |-- cookie | |-- cookieAcceptDialog.dtd | `-- cookieAcceptDialog.properties |-- global | |-- about.dtd | |-- appPicker.dtd . . ...
... |-- alerts | `-- notificationNames.properties |-- autoconfig | `-- autoconfig.properties |-- cookie | |-- cookieAcceptDialog.dtd | `-- cookieAcceptDialog.properties |-- global | |-- about.dtd | |-- appPicker.dtd . . ...
...And 7 more matches
Intl.DateTimeFormat() constructor - JavaScript
The Intl.DateTimeFormat() constructor for objects that enable language-sensitive date and time formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.DateTimeFormat([
locales[, options]]) Parameters
locales Optional A string with a BCP 47 language tag, or an array of such strings. To use the browser's default
locale, omit this argument or pass undefined. Unicode extension are supported (for example "en-US-u-ca-buddhist"). For the general form and interpretation of the
locales argument, see the Intl page. The following Unicode extension keys are allowed: nu Numbering system. Possible ...
..., " japanese", "persian", "roc". dayPeriod The way day periods should be expressed. Possible values include: "narrow", "short", " long". numberingSystem Numbering System. Possible values include: "arab", "arabext", " bali", "beng", "deva", "fullwide", " gujr", "guru", "hanidec", "khmr", " knda", "laoo", "latn", "limb", "mlym", " mong", "mymr", "orya", "tamldec", " telu", "thai", "tibt".
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. timeZone The time zone to use. The only value implementations must recognize is "UTC"; the default is the runtime's default time zone. Implementations may also recognize the time zone names of the IANA time zone database, ...
...one The time zone to use. The only value implementations must recognize is "UTC"; the default is the runtime's default time zone. Implementations may also recognize the time zone names of the IANA time zone database, such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York". hour12 Whether to use 12-hour time (as opposed to 24-hour time). Possible values are true and false; the default is
locale dependent. This option overrides the hc language tag and/or the hourCycle option in case both are present. hourCycle The hour cycle to use. Possible values are "h11", "h12", "h23", or "h24". This option overrides the hc language tag, if both are present, and the hour12 option takes precedence in case both options have been specified. formatMatcher The format matching algorithm to use. Pos...
...And 7 more matches
Install Manifests - Archive of obsolete content
0.*</em:maxVersion> </Description> </em:targetApplication> Gecko 1.9 based applications allow you to use the special targetApplication id toolkit@mozilla.org to say that the add-on is compatible with any toolkit app with a toolkit version matching the minVersion and maxVersion. type An integer value representing the type of add-on. 2 Extensions 4 Themes 8
Locale 32 Multiple Item Package 64 Spell check dictionary 128 Telemetry Experiment 256 WebExtension Experiment Examples <em:type>2</em:type> This property was added for Firefox 1.5, and is only required for add-on types other than Extensions and Themes. Firefox 2 and previous supported a value of 16 to represent plug-ins. In Firefox 3 this has be...
...2.0 (Firefox 4.0), you can also simply include your icon, named icon64.png, in the base directory of the add-on. This allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an icon64URL entry. localized Allows you to localize the add-on's name, description, contributors and other metadata. ...
...so simply include your icon, named icon64.png, in the base directory of the add-on. This allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an icon64URL entry. localized Allows you to localize the add-on's name, description, contributors and other metadata. The localized description must specify at least one em:
locale which indicates which
locales to use this information for. ...
...And 6 more matches
Install.js - Archive of obsolete content
rch engines and default preferences. Cons: Code is bloated since it has to cater for several different ways an extension author can package the .JAR file contained in the .XPI file. XPI file structure You can use the code below (taken from Pike's extensions ). It assumes the following structure of your XPI file: sampleext.xpi chrome\ sampleext.jar content\ sampleext\
locale\ (optional) en-US\ sampleext\ ... skin\ (optional) classic\ sampleext\ ... install.js install.rdf (optional -- see above) Code // install.js // XpiInstaller // By Pike (Heavily inspired by code from Henrik Gemal and Stephen Clavering) var XpiInstaller = { // --- Editable items begin --- extFullName: 'Sample Extension', // The n...
...['en-US', 'en-GB'] extSkinNames: null, // e.g. ['classic', 'modern'] extPostInstallMessage: null, // Set to null for no post-install message // --- Editable items end --- profileInstall: true, silentInstall: false, install: function() { var jarName = this.extShortName + '.jar'; var profileDir = Install.getFolder('Profile', 'chrome'); // Parse HTTP arguments...
... // Add JAR file Install.addFile(null, 'chrome/' + jarName, installPath, null); // Register chrome var jarPath = Install.getFolder(installPath, jarName); var installType = this.profileInstall ? ...
...And 6 more matches
Bootstrapped extensions - Archive of obsolete content
the extension is uninstalled, if it's currently enabled. When the extension becomes disabled. When the user quits the application, if the extension is enabled. Notes on modifying the application user interface chrome.manifest in bootstrapped add-ons You can use a chrome.manifest file in bootstrapped add-ons to: Make your add-on's content available via a chrome:// URL (using the content,
locale, and skin instructions in the manifest). Replace existing chrome:// URIs with your content (using the override instruction). Not all chrome.manifest instructions are supported in bootstrapped add-ons, for example you still cannot register XUL Overlays from a bootstrapped add-on. See the chrome.manifest documentation for details. In Firefox 10 and later the chrome.manifest file located in the ...
... to debug bootstrapped add-ons. Localization (L10n) Localizing bootstrapped add-ons is very much the same since Firefox 7, as that is when chrome.manifest compatibility landed. JS and JSM Files - Using Property Files To localize your .js and .jsm files you have to use property files. ...
...ons. Localization (L10n) Localizing bootstrapped add-ons is very much the same since Firefox 7, as that is when chrome.manifest compatibility landed. JS and JSM Files - Using Property Files To localize your .js and .jsm files you have to use property files. The absolute minimum needed here is: File: install.rdf File: chrome.manifest File: bootstrap.js Folder:
locale Folder: VALID_
LOCALE_HERE File: ANYTHING.properties In the
locale folder you must have folders for each of the languages you want to provide; each folder must be named a valid
locale (ex: en-US). Inside this folder must be a property file. Inside the chrome.manifest file these
locale must be defined. For example if you had a subfolder of en-US in
locale folder your chrome.manifest file will ...
...And 5 more matches
Creating a Firefox sidebar extension - Archive of obsolete content
eferable you have some basic knowledge of how XUL works and how Firefox handles extensions. See Building an Extension for more detailed information about structuring, packaging, and deploying extensions. Packages Extensions to Firefox are installed with packages ("Bundles"). An extension package usually contains a "content" provider, which contains the XUL code and application logic. Optionally
locales and skins can be included. Most additions are provided with a default tree structure, although not required it is recommended to use this structure. Here the package for the sidebar is created, the files included are listed below. Example 1. Package structure emptysidebar \- chrome |- content |-
locale | \- en-US \- skin Create all folders, except for skin. It is not used for t...
...included. Most additions are provided with a default tree structure, although not required it is recommended to use this structure. Here the package for the sidebar is created, the files included are listed below. Example 1. Package structure emptysidebar \- chrome |- content |-
locale | \- en-US \- skin Create all folders, except for skin. It is not used for this tutorial. The
locale holds the
locale, only the en-US
locale is created. It is listed in Example 2. ...
... it is recommended to use this structure. Here the package for the sidebar is created, the files included are listed below. Example 1. Package structure emptysidebar \- chrome |- content |-
locale | \- en-US \- skin Create all folders, except for skin. It is not used for this tutorial. The
locale holds the
locale, only the en-US
locale is created. It is listed in Example 2. The
locale includes the name and shortcut keys for the sidebar. Example 2. chrome/
locale/emptysidebar.dtd <!ENTITY emptysidebar.title "EmptySidebar"> <!ENTITY openEmptySidebar.commandkey "E"> <!ENTITY openEmptySidebar.modifierskey "shift accel"> The content folder includes our sidebar, the emptysidebar.xul is shown in Example 3. It creates a page holding one label. Other elements can be included, plea...
...And 5 more matches
Creating a Help Content Pack - Archive of obsolete content
c is loaded when the user hits the Home button in the viewer. We'll get to exactly how to fill in this attribute later. This attribute is optional, with fallback to the value welcome. nc:base contains the base URL relative to which the Help content referenced in the descriptor file is located. For example, if your glossary, index, and table of contents RDF files are all located at chrome://myapp/
locale/help/*, then you could put chrome://myapp/
locale/help/ here and use only the actual file names without path when needed later. You don't actually need this attribute if you don't want it, but it's a useful shorthand to save typing. Next, we need to describe where to find the glossary, index, and table of contents. (We're still not actually to the point where we're describing the actual data in ...
...evant information descriptions within the rdf:Seq element. ...
...In Firefox 1.0 each data source had a panel.
...And 5 more matches
Manifest Files - Archive of obsolete content
e URL of the form chrome://tests/content/<filename>. Of course, you will need to restart the browser for the changes to take effect. If the file doesn't load, make sure that the file path is correct. The basic syntax of the lines in the manifest file for content packages is: 'content <packagename> <filepath>' The first field 'content' indicates a content package. For themes, 'skin' is used while '
locale' is used for
locales. The packagename in the example above is 'tests', which means that the first field in the chrome URL is 'tests' as in chrome://tests/content/sample.xul. If the package name was 'browser', the chrome URL would be chrome://browser/content/. The final field is the path where the files are located. This can be either a local file path using a file URL or a JAR archive using a jar...
...ions instead. Otherwise, if an extension attempted to call the modified versions, it would likely not work properly, or worse, create a security hole. This flag was added to prevent this problem and should always be used for newer extensions, but is left out for older extensions that might not be compatible with the change. For more information about this feature, see XPCNativeWrapper. Themes and
Locales The themes and
locales, the syntax is similar as for content packages, but you also need to specify the content package you are providing a theme or
locale for. For example: skin browser classic/1.0 jar:classic.jar!/skin/classic/browser/
locale browser en-US jar:en-US.jar!/
locale/browser/ For these, the extra field has been added to indicate that the skin and
locale applies to the browser. The ...
...For more information about Themes, see Themes. For more information about
Locales, see Localization. ...
...And 5 more matches
Localizing extension descriptions
er metadata about your add-on. Because a new method for doing so was implemented in Gecko 1.9 (Firefox 3), there are two sets of instructions below. Localizing in Gecko 1.9 Gecko 1.9 includes a new, more robust method for localizing add-on descriptions and other metadata. All of the different descriptions now appear in the install.rdf file using em:localized properties. Each has at least one em:
locale property marking the
locale that the information should be used for and then all the various strings for the
locale. The following example demonstrates this (most normal manifest properties have been removed for brevity): <?xml version="1.0"?> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-m...
...
locale. ...
...owing example demonstrates this (most normal manifest properties have been removed for brevity): <?xml version="1.0"?> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <em:id>TabSidebar@blueprintit.co.uk</em:id> <em:localized> <Description> <em:
locale>de-DE</em:
locale> <em:name>Tab Sidebar</em:name> <em:description>Zeigt in einer Sidebar Vorschaubilder der Inhalte aller offenen Tabs an.</em:description> </Description> </em:localized> <em:localized> <Description> <em:
locale>es-ES</em:
locale> <em:name>Tab Sidebar</em:name> <em:description>Muestra una vista previa de sus pestanas en su panel lateral.</em...
...And 5 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
ew menu item that opens a "Hello, World!" dialog box would be already be a great exercise to get warmed up with. Assuming you know how to write XUL/JavaScript extensions, you're aware that the most important stuff goes in the chrome/ directory of your extension. Well, the fact that you're also using C++ components doesn't change that one whit. So now you need to create the normal content/,
locale/ and skin/ directories in which to place your chrome files. Personally I like placing these directly under the root directory of my module, but I don't suppose it makes any difference if you prefer putting them under a chrome/ subdirectory or whatever. Let freedom reign! Once you've written the necessary chrome files (for instance, an overlay that adds a menu item to instantiate and use on...
...tten the necessary chrome files (for instance, an overlay that adds a menu item to instantiate and use one of your components), you need to package them up as part of your extension. This is accomplished through the use of a JAR Manifest. ...
... an overlay that adds a menu item to instantiate and use one of your components), you need to package them up as part of your extension. This is accomplished through the use of a JAR Manifest. ...
...And 4 more matches
Index - Archive of obsolete content
nsions have many advantages for both users and developers compared to the old xpinstall/-style extensions. 241 Firefox addons developer guide The original document is in Japanese and distributed via the xuldev.org website. So there may be still some reference to the xuldev website (we want to host source code on MDC, not on xuldev), and to Japanese things (like some specific
locales, which have been translated to French since non-latin characters are not well supported). 242 Hiding browser chrome Add-ons, Extensions, XUL, XULBrowserWindow There are times in which an extension may find it useful to hide browser chrome (that is, toolbars, the location bar, and so forth), in order to reduce clutter when presenting a particular user interface. This is done,...
... XUL Properties, XUL Reference No summary! 1351 allowEvents XUL Properties, XUL Reference No summary! 1352 alwaysOpenPopup XUL Properties, XUL Reference No summary! 1353 amIndicator XUL Properties, XUL Reference No summary! 1354 anchorNode XUL, XUL Properties, XUL Reference No summary! 1355 app
Locale XUL Properties, XUL Reference No summary! 1356 autoCheck XUL Properties, XUL Reference No summary! 1357 autoFill XUL Properties, XUL Reference No summary! 1358 autoFillAfterMatch XUL Properties, XUL Reference No summary! 1359 boxObject XUL Properties, XUL Reference No summary! 1360 browser ...
...applications are written using the platform, it's a safe bet that it can be used to build a basic application. There is an article with a more complicated approach to building XULRunner applications at Creating XULRunner Apps with the Mozilla Build System. If you need to change XULRunner itself or integrate it with external binaries you may need to read that article. ...
...And 4 more matches
Localizing an extension - Archive of obsolete content
take a look at the previous articles in this series: Creating a status bar extension Creating a dynamic status bar extension Adding preferences to an extension Download the sample You can download this article's sample code so you can look at it side-by-side with the article, or to use it as a basis for your own extension. Download the sample Localizing strings in XUL files Create the needed
locale files Each XUL file that comprises the user interface for your extension should have a
locale file in its
locale directory. Each
locale file maps entity names referenced in the XUL files to the strings themselves. The preference dialog, whose XUL file is options.xul, has a corresponding options.dtd file that looks like this: <!ENTITY options_window_title "StockWatcher 2 Preferences"> <!ENTITY o...
...file contains the mappings for the stockwatcher2.xul file: <!ENTITY panel_loading "Loading..."> <!ENTITY menu_refresh_now.label "Refresh Now"> <!ENTITY menu_apple.label "Apple (AAPL)"> <!ENTITY menu_google.label "Google (GOOG)"> <!ENTITY menu_microsoft.label "Microsoft (MSFT)"> <!ENTITY menu_yahoo.label "Yahoo (YHOO)"> Update the XUL files Each XUL file needs to reference its corresponding
locale file. We also need to update the code to use the entities instead of the strings, so that the substitutions take place based on the currently active
locale. To add a reference to the correct
locale file for a given XUL file, we need to add one line to the XUL file. To options.xul, we add this line: <!DOCTYPE window SYSTEM "chrome://stockwatcher2/
locale/options.dtd"> We add a similar line to the...
...strings, so that the substitutions take place based on the currently active
locale. To add a reference to the correct
locale file for a given XUL file, we need to add one line to the XUL file. To options.xul, we add this line: <!DOCTYPE window SYSTEM "chrome://stockwatcher2/
locale/options.dtd"> We add a similar line to the stockwatcher.xul file: <!DOCTYPE overlay SYSTEM "chrome://stockwatcher2/
locale/stockwatcher2.dtd"> In larger applications you might need to use entities from several
locale files in a single XUL file. Using multiple DTDs describes how to do it. Note that the URLs of the DTD files don't actually include the name of the localization to use. The Chrome Registry resolves the URIs based on the user's current
locale setting and the data you provide in your Chrome manifest. Then ...
...And 4 more matches
XUL Structure - Archive of obsolete content
However, if you just want to get started building a simple application, you may skip ahead to Creating a Window and save this section for later. Package Organization Mozilla is organized such that you can have as many components as you want pre-installed. Each extension is something of a standalone component with a separate chrome URL. Mozilla also has one component for each installed theme and
locale. Each of these components, or packages, is made up of a set of files that describe the user interface for it. For example, the messenger component has descriptions of the mail messages list window, the composition window and the address book dialogs. The packages that are provided with Mozilla are located within the chrome directory, which is in the directory where you built Mozilla. The chrome ...
... typing "about:config" in the address field, and setting this value to true. Or, just manually edit your user.js preferences file and add the following line: pref("nglayout.debug.disable_xul_cache", true); There are usually three different parts to a chrome package, although they are all optional. Each part is stored in a different directory. These three sets are the content, the skin, and the
locale, which are all described below. A particular package might provide one or more skins and
locales, but a user can replace them with their own. In addition, the package might include several different applications, each accessible via different chrome URLs. The packaging system is flexible enough so that you can include whatever parts you need and allow other parts, such as the text for different l...
...example, the editor package will have a file within it called editor.xul. Scripts are placed in separate files alongside the XUL files. Skin - Style sheets, images and other theme specific files Style sheets describe details of the appearance of a window. They are stored separately from XUL files to facilitate modifying the skin (theme) of an application. Any images used are stored here also.
Locale -
Locale specific files All the text that is displayed within a window is stored separately. This way, a user can have a set for their own language. Content Packages The name of the JAR file might describe what it contains, but you can't be sure unless you view its contents. Let's use the browser package included with Firefox as an example. If you extract the files in browser.jar, you will f...
...And 4 more matches
Initial setup
As a pre-requisite to contributing to the L10n program, you need to have access to code, tools, and a properly configured local environment (i.e., your personal computer). You also need to determine if a localization effort already exists for your
locale. Here we'll go over the accounts you need as well as the tools and their configurations you need to set up before contributing. New or existing Before anything else, you need to know if you will be creating a new localization or joining an existing one. This will determine what information is most applicable to you throughout the rest of this guide. Here's what you do: Look through the existing localization community directory to see if one already exists for your
locale. If a community already exists, reach out to them and ask ho...
... Accounts There are a handful of accounts that you need to be aware of as you begin. ...
...applications. Hg commit access is not necessary to begin localizing. After you have some experience with hg, you may want to get commit access. At that point, you must visit the Mozilla Committer page and follow the process outlined there. Here is an example bug that illustrates the process well. Use this bug template when filing your hg account registration bug. ...
...And 4 more matches
nsIDBFolderInfo
Obsolete since Gecko 1.8 void getMailboxName(in nsString boxName); Native code only! Obsolete since Gecko 1.8 AString getProperty(in string propertyName); nsIDBFolderInfo GetTransferInfo(); unsigned long getUint32Property(in string propertyName, in unsigned long defaultValue); vo...
...Obsolete since Gecko 1.8 void setMailboxName(in nsString newBoxName); Native code only! Obsolete since Gecko 1.8 void setProperty(in string propertyName, in AString propertyStr); void setUint32Property(in string propertyName, in unsigned long propertyValue); Attributes Attribute Ty...
...Obsolete since Gecko 1.8 void setMailboxName(in nsString newBoxName); Native code only! Obsolete since Gecko 1.8 void setProperty(in string propertyName, in AString propertyStr); void setUint32Property(in string propertyName, in unsigned long propertyValue); Attributes Attribute Type Descriptio...
...And 4 more matches
Intl.PluralRules() constructor - JavaScript
Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. type The type to use. Possible values are: "cardinal" for cardinal numbers (refering to the quantity of things). ...
...Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. type The type to use. Possible values are: "cardinal" for cardinal numbers (refering to the quantity of things). ...
...Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. type The type to use. Possible values are: "cardinal" for cardinal numbers (refering to the quantity of things). ...
...And 4 more matches
Intl.RelativeTimeFormat() constructor - JavaScript
Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see Intl. numeric The format of output message. ...
...Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see Intl. numeric The format of output message. ...
...Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see Intl. numeric The format of output message. ...
...And 4 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
ivileged JavaScript code like this: Components.utils.import("resource://gre/modules/Services.jsm"); From here on out, it is assumed you've imported Services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples. The examples will also assume that you know how to properly add instructions to your add-on's chrome.manifest to add and remove resource, chrome,
locale, & etc. mappings, so that you can access your files with custom paths such as: resource://myAddon/filename.ext chrome://myAddon/content/filename.ext Step 2: No more resource:// URIs for files internal to your bundle Unfortunately, resource mappings in your chrome.manifest were not usable in restartless add-ons until Mozilla finally fixed this bug in Firefox 38, which looked bad, but only becau...
...tioning extractionless add-ons every once in a while thus far? Well, you should probably consider switching to be extractionless when you go restartless. An old-style add-on installer is packaged something like this: myAddon.xpi file (glorified ZIP) +- chrome.manifest +- install.rdf +- chrome folder +- myAddon folder +- content.jar file +- content folder (most files go here) +-
locale folder (your
locale files go here) In versions of Firefox prior to 4.0 (Gecko 2.0), the XPI would be extracted into a folder in your profile's extensions folder. In current versions it stays unextracted as an XPI. If you were using input streams you already had to deal with this because they weren't an option without extraction. Opting-out to extractionlessness is done via the "unpack" flag in i...
...ompression ratio of the XPI, resulting in smaller installers and updates. So, it's pretty much internal JARor extractionless XPI. Well, you can't use an internal JAR anymore. Firefox aggressively caches add-on data a bit too much. Your restartless add-on won't actually reload some types of files if they are in a JAR and the add-on is updated without a restart. The big culprits are JSM files and
locale files (namely property files), though in some situations this is true for dynamically loaded image files too. You're still going to have to manually clear the chrome cache on add-on shutdown to work around this, but that doesn't seem to be enough with an internal JAR. So, time to switch to extractionless, too. See here for the list of stuff you can't have in addition to no resource:// URIs or fil...
...And 3 more matches
Localization - Archive of obsolete content
s for each supported language. In English, the &findLabel; entity will probably be declared to have the text "Find". DTD Files Entities are declared in Document Type Definition (DTD) files. Files of this type are normally used to declare the syntax and semantics of a particular XML file, but they also let you declare entities. In the Mozilla chrome system, you will find DTD files located in the
locales subdirectory. You would normally have one DTD file (with an extension .dtd) per XUL file. If you look in the chrome directory, you should see an archive for your language. (en-US.jar is the default for English.) You might have
locale files in multiple languages, for example, US English (en-US) and French (fr). Inside these archives, you will find the files that hold the localized text for each ...
... BOM). For more information, see Mozilla Language Packs. Once you have created a DTD file for your XUL, you will need to add a line to the XUL file which indicates that you want to use the DTD file. Otherwise, errors will occur as it won't be able to find the entities. ...
... To do this, add a line of the following form somewhere near the top of the XUL file: <!DOCTYPE window SYSTEM "chrome://findfile/
locale/findfile.dtd"> This line specifies that the URL indicated is to be used as a DTD for the file. In this case, we have declared that we want to use the findfile.dtd DTD file. This line is typically placed just before the window element. You also need to add the
locale to the chrome.manifest file, for example:
locale findfile en-US
locale/ Declaring Entities The entities are declared using a simple syntax as shown below: <!ENTITY findLabel "Find"> This example creates an entity with the name findLabel and the value "Find". This means that wherever the text "&findLabel;" appears in the XUL file, it will be replaced with the text "Find". Note that entity d...
...And 3 more matches
Localization and Plurals
xtension will load each property and display the plural forms in a table. Selecting a table entry will populate the bottom box with sample uses of the word for some numbers. Install pluralForm Checker v0.3 extension Extension input It would be good to keep this list updated with all the words that need plural forms. People using the extension can then copy/paste this input. ...
... forms in a table. Selecting a table entry will populate the bottom box with sample uses of the word for some numbers. Install pluralForm Checker v0.3 extension Extension input It would be good to keep this list updated with all the words that need plural forms. People using the extension can then copy/paste this input. ...
...e the bottom box with sample uses of the word for some numbers. Install pluralForm Checker v0.3 extension Extension input It would be good to keep this list updated with all the words that need plural forms. People using the extension can then copy/paste this input. ...
...And 3 more matches
Setting up the infrastructure
ke your project's file type decision (see Localization Formats for details): HTML/PHP .lang gettext (.po) Assuming you chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application. Requirements: PHP with gettext support, Apache and some Unix experience. Create a new branch for l10n (optional if starting a new project). ...
...r details): HTML/PHP .lang gettext (.po) Assuming you chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application. Requirements: PHP with gettext support, Apache and some Unix experience. Create a new branch for l10n (optional if starting a new project). Create a
locale directory in your website (usually something like DOCROOT/
locale). ...
...chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application. Requirements: PHP with gettext support, Apache and some Unix experience. Create a new branch for l10n (optional if starting a new project). Create a
locale directory in your website (usually something like DOCROOT/
locale). Copy the shell scripts from /addons/trunk/site/app/
locale/ to your
locale directory: extract-po.sh will be used to extract all English strings from your application's directories specified in SOURCE_DIRS, merge the resulting template (*.pot) file with the existing (already containing translations) messages.po files for each
locale (if they exist) and merge the new messages.po files to messages.mo files. By default the script looks for gettext call...
...And 3 more matches
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
The Intl.DateTimeFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and date and time formatting options computed during initialization of this DateTimeFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateTimeFormat.resolvedOptions() Return value A new object with properties reflecting the
locale and date and time formatting options computed during the initialization of the given DateTimeFormat object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode ...
... calendar E.g. "gregory" numberingSystem The values requested using the Unicode extension keys "ca" and "nu" or filled in as default values. ...
... calendar E.g. "gregory" numberingSystem The values requested using the Unicode extension keys "ca" and "nu" or filled in as default values. ...
...And 3 more matches
Intl.DateTimeFormat - JavaScript
e language-sensitive date and time formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.DateTimeFormat() Creates a new DateTimeFormat object. Static methods Intl.DateTimeFormat.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.DateTimeFormat.prototype.format() Getter function that formats a date according to the
locale and formatting options of this DateTimeFormat object. Intl.DateTimeFormat.prototype.formatToParts() Returns an Array of objects rep...
...s that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.DateTimeFormat.prototype.format() Getter function that formats a date according to the
locale and formatting options of this DateTimeFormat object. Intl.DateTimeFormat.prototype.formatToParts() Returns an Array of objects representing the date string in parts that can be used for custom
locale-aware formatting. Intl.DateTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and formatting options computed during initialization of the object. ...
...ng the date string in parts that can be used for custom
locale-aware formatting. Intl.DateTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and formatting options computed during initialization of the object. Intl.DateTimeFormat.prototype.formatRange() This method receives two Dates and formats the date range in the most concise way based on the
locale and options provided when instantiating DateTimeFormat. Intl.DateTimeFormat.prototype.formatRangeToParts() This method receives two Dates and returns an Array of objects containing the
locale-specific tokens representing each part of the formatted date range. Examples Using DateTimeFormat In basic use without specifying a
locale, DateTimeFormat uses the default
locale and default options. ...
...And 3 more matches
XULRunner tips - Archive of obsolete content
ager-extensions"); pref("extensions.update.enabled", true); pref("extensions.update.interval", 86400); pref("extensions.dss.enabled", false); pref("extensions.dss.switchPending", false); pref("extensions.ignoreMTimeChanges", false); pref("extensions.logging.enabled", false); pref("general.skins.selectedSkin", "classic/1.0"); // NB these point at AMO pref("extensions.update.url", "chrome://mozapps/
locale/extensions/extensions.properties"); pref("extensions.getMoreExtensionsURL", "chrome://mozapps/
locale/extensions/extensions.properties"); pref("extensions.getMoreThemesURL", "chrome://mozapps/
locale/extensions/extensions.properties"); If your application is based on Gecko 2.0, you need to register a component through the new component registration because the extension manager uses FUEL, namely ...
...the package Copy the following files: chrome/inspector.jar to the chrome directory of your XULRunner application components/inspector-cmdline.js to your components directory defaults/preferences/inspector.js to your preferences directory Open your chrome.manifest file and add these lines: content inspector jar:inspector.jar!/content/inspector/ xpcnativewrappers=no
locale inspector en-US jar:inspector.jar!/
locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/skin/modern/inspector/ skin inspector classic/1.0 jar:inspector.jar!/skin/classic/inspector/ overlay chrome://inspector/content/popupOverlay.xul chrome://inspector/content/viewers/dom/popupOverlay.xul overlay chrome://inspector/content/commandOverla...
...ll probably also want to create menuitems that let you open the JS Shell and other tools provided by the extension. Branding Branding is a chrome package containing product-specific information (e.g. the product name, vendor, and logo). ...
...And 2 more matches
Creating a spell check dictionary add-on
Firefox add-on, or how to update your existing add-on, so that it can be installed, uninstalled and updated without a restart. Parts needed To create a dictionary add-on, you first need two things: A spell check dictionary in Hunspell or Myspell format, with a license which allows you to use it. Such a dictionary consists of two files, one with a .dic and one with an .aff file extension. A
locale code to describe the language of the dictionary. For example en-US, de-DE or da. It is important to choose the right
locale code, or the spell checker will not be able to match the language of your dictionary against the language of a web page in order to select the right dictionary to use. If you are creating a new dictionary, as opposed to updating an existing one, please make sure that there...
...If there already is one, try contacting the author to get it updated, or contact AMO editors if the author does not respond. Packaging A Firefox add-on is a ZIP file renamed to use an .xpi file extension instead of the normal .zip file extension. ...
... already is one, try contacting the author to get it updated, or contact AMO editors if the author does not respond. Packaging A Firefox add-on is a ZIP file renamed to use an .xpi file extension instead of the normal .zip file extension. To create a dictionary add-on, simply create a ZIP file which contains the following files and folders: my-dictionary.xpi install.rdf dictionaries/
locale-code.dic
locale-code.aff The .dic and .aff files must be placed in a subfolder named dictionaries within the ZIP file. Both files must have the
locale code as their file name. You also have to add a file named install.rdf to the root of the ZIP file. This file contains information about your add-on such as name and version number (see below). In addition to these required files, you may...
...And 2 more matches
Localization content best practices
s web page at <span id='malware_sitename'/> has been reported as an attack page and has been blocked based on your security preferences. U+2026 (\u2026) is the horizontal ellipsis character. This character should be used in place of three consecutive periods. Create localizable strings Don't assume grammar structures You need to consider the need for different grammar structures in different
locales, and add switching mechanisms to present them appropriately. You shouldn't make assumptions as to what those structures will be: instead, let
locales/localizers decide. When in doubt, ask the localizers. Date and time formats For example, you shouldn't hard code date formats into applications: %A, %b %e // resulting in Wednesday, May 20 This is fine in English, but in Italian results in "Mer...
...ard code date formats into applications: %A, %b %e // resulting in Wednesday, May 20 This is fine in English, but in Italian results in "Mercoledi, Mag 20", which sounds unnatural. Every time you use this kind of structure, you should have a localizable string behind it, and let localizers decide the best order for their language. Units Another example is localizing percentages or units. Some
locales use a space between the number and the % symbol, some don't, some use a non-breaking space. Splitting Splitting sentences into several keys often inadvertently presumes a grammar, a sentence structure, and such composite strings are often very difficult to translate. When a composite string is needed, try to give the translators "room to move". Word Order If a string will contain a placehold...
...o which placeholder, this may lead to bad translations. Don't reuse strings in different contexts This is particularly important for mobile, where different context often means different font and available space for the string. For example, if you're adding a new menu item in Settings on Android, don't use the same string for the menu item and the following screen header. Another example, some
locales use nouns for titles, and verbs for actions (for example button labels). Sometimes they coincide with English, but they rarely do in other languages. Take Bookmark: it can be both a noun and a verb in English. A developer could be tempted to reuse the same string "Bookmark" in the button to add a bookmark, and in the header for the next dialog. This won't work in some languages. Avoid unnecessa...
...And 2 more matches
Localizing with Mercurial
ile. Save the file as either .hgrc (UNIX systems) or Mercurial.ini (Windows) and save it in either $HOME/ or C:\mozilla-build\hg\ or C:\Program Files\Mercurial\. Now that you've installed and configured Mercurial, here are a few tasks you can do without Hg commit access priviledges. Cloning and updating repositories There are a couple of repostiories that contain en-US source files that most
locales will want to deal with. mozilla-central contains the files for Firefox Nightly. comm-central contains the files for SeaMonkey and Thunderbird which are not already part of Firefox. l10n-central contains all of the L10n repos for Firefox Nightly. When you get the comm-central repository, this will include the mozilla-central repository as well. You can therefore use the one set up for dev...
...tory. The second command will move you into that directory. The third command will do a clone of mozilla-central, and pull some other hg repositories. The other directories are required for SeaMonkey and Thunderbird. Cloning your localization repository for the first time is just as easy. For example, to clone your Firefox Nightly L10n repo, run the following command, replacing ab-CD with your
locale code: hg clone https://hg.mozilla.org/l10n-central/ab-CD/ Updating your local repos To update your working copy of mozilla-central, go to your local mozilla-central directory and run: hg pull -u This will both get new changesets from mozilla-central and apply those changes in your working copy. To update your working copy of comm-central, go to your comm-central directory and run: ...
... she or he is registered). Sending changes to Mozilla Now that you have Hg account privileges, you can send your work to Mozilla all by yourself. Here are the steps to send your L10n work using Mercurial: Since your L10n work takes place in your own local repository, you should ensure that there are no changes made to the remote repository before committing your work. To do this, update your
locale, as per the section above. After finishing a change or set of changes and checking you have updated to the latest, you should commit by entering this command: hg commit -m "your message identifying the change (bug 555)" Committing won't send your changes to Mozilla's repository, but prepares them for it. The next step will send your changes to your remote repo via push. To push to mozilla-...
...And 2 more matches
QA phase
them. If you haven't installed them yet, now is the time to do it. Preliminary instructions We will be using the following file directories for this example: your working directory (root)/ mozilla-aurora (en-US source, pulled from http://hg.mozilla.org/releases/mozilla-aurora )/ l10n-central (directory for L10n directories, one per L10n; often referred to as "l10n base")/ your-
locale-code (a directory with your L10n files, in this example we'll use x-testing) Example: root/mozilla-aurora & root/l10n-central/x-testing Additionally, you will need to copy and translate the toolkit/defines.inc file directly from en-US before you can build. This is due to a bug in the build logic. Please either follow the above structure closely or adjust the commands below according to your c...
...r follow the above structure closely or adjust the commands below according to your custom setup. To copy this file to the appropriate directory, do the following: Navigate to your working directory from your command-line terminal (i.e., where you created the folder structure described above). Enter the following commands: mkdir -p l10n-central/x-testing/toolkit/ cp mozilla-aurora/toolkit/
locales/defines.inc l10n-central/x-testing/toolkit/defines.inc Tah-dah! Copied! Finally, you will need a file called .mozconfig to proceed with manual builds. This file contains the necessary build instructions. To create and configure this file, follow these instructions: Until the fix for bug 1063880 lands on mozilla-aurora and mozilla-beta when building language packs against those two trees yo...
...plication=[browser or mail] You will need to specify which application you're localizing in the fourth line (e.g., for Firefox, that's browser, Thunderbird would be mail). Enter the following command to perform the configuration: $ ./mach configure Once your command-line finishes spitting out the config command's output, navigate to the newly created directory: $ cd ../firefox-build/browser/
locales Now you're ready to build! At this point you can choose between two build options. You can either: Create a langpack, which is installed on top of your Mozilla application, or Repack the application's binary (aka, a L10n repack), which allows you to install next to your existing Mozilla application installation and use separately. Visit the links above to learn how to make these testing ...
...And 2 more matches
Localization technical reviews
for migrating from one product release channel to the next (e.g., aurora to beta, or beta to release) is rapidly approaching. You need to make sure that your work can effectively be compiled into a build for the next release channel. Here is a detailed overview of what a technical review is and who it's meant for: A technical review: is performed as a QA measure on a revision pushed to a new
locale's L10n aurora repo in Mercurial. is very comprehensive and covers the entire product. focusses on technical accuracy and completion of L10n work, not translation quality. is only performed on the first revision a new
locale wants to have released to the public. must be approved prior to migrating your revision from Aurora to Beta. Technical review evaluation criteria In principal, a techni...
...r be considered once, as all reviews after this only evaluate the changes you're adding on top of this revision from release to release. Here is some of the criteria we use to perform technical reviews: Revision attachment contains only relevant files We run into exports that contain .xpi langpacks and other random files. Make sure the top-level directory doesn't contain garbage. compare-
locale We run the compare-
locales tool on the new
locale to get the statistics on translation of strings and report basic errors. defines.inc The file for each app (like browser/defines.inc) contains the names of all contributors that a localization team would like to credit the work to. Localizers can specify the team responsible for the work by listing the name just after the MOZ_LANGPACK_CREATO...
...tags just after the MOZ_LANGPACK_CONTRIBUTORS section. Make sure that the the text content is wrapped with emptyLines. Leading comments are OK, but watch out for #filter emptyLines #define ... # comment #define ... #unfilter emptyLines In toolkit/defines.inc, the native name of the language is specified, which is used as description for the built language packs. region.properties Though
locales might like to specify changes from the beginning, the region.properties files will be reverted to en-US. Changes will be discussed in productization bugs filed for each
locale. Search plugins Similar to the region.properties files, the list.txt file should be reverted to en-US and amended accordingly as the search plugin productization bugs are completed. For this initial review, all XML file...
...And 2 more matches
Intl.DisplayNames - JavaScript
on of language, region and script display names. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.DisplayNames() Creates a new Intl.DisplayNames object. Static methods Intl.DisplayNames.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.DisplayNames.prototype.of() This method receives a code and returns a string based on the
locale and options provided when instantiating Intl.DisplayNames. Intl.DisplayNames.prototype.resolvedOptions() Returns a new object wi...
...ining those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.DisplayNames.prototype.of() This method receives a code and returns a string based on the
locale and options provided when instantiating Intl.DisplayNames. Intl.DisplayNames.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and formatting options computed during initialization of the object. Examples Region Code Display Names To create an Intl.DisplayNames for a
locale and get the display name for a region code. // Get display names of region in English let regionNames = new Intl.DisplayNames(['en'], {type: 'region'}); regionNames.of('419'); // "Latin America" regionNames.of('BZ'); // "Belize" regionNames.of('...
... // Get display names of language in English let languageNames = new Intl.DisplayNames(['en'], {type: 'language'}); languageNames.of('fr'); // "French" languageNames.of('de'); // "German" languageNames.of('fr-CA'); // "Canadian French" languageNames.of('zh-Hant'); // "Traditional Chinese" languageNames.of('en-US'); // "...
...And 2 more matches
Intl.NumberFormat() constructor - JavaScript
The Intl.NumberFormat() constructor creates objects that enable language sensitive number formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.NumberFormat([
locales[, options]]) Parameters
locales Optional A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the
locales argument, see the Intl page. The following Unicode extension key is allowed: nu The numbering system to be used. Possible values include: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "g...
...ided. currencyDisplay How to display the currency in currency formatting. Possible values are: "symbol" to use a localized currency symbol such as EUR, this is the default value, "narrowSymbol" to use a narrow format symbol ("$100" rather than "US$100"), "code" to use the ISO currency code, "name" to use a localized currency name such as "dollar", currencySign In many
locales, accounting format means to wrap the number with parentheses instead of appending a minus sign. You can enable this formatting by setting the currencySign option to "accounting". The default value is "standard".
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. no...
...efault for percent formatting is the larger of minimumFractionDigits and 0. minimumSignificantDigits The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1. maximumSignificantDigits The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21. ...
...And 2 more matches
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
The Intl.NumberFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and number formatting options computed during initialization of this NumberFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numberFormat.resolvedOptions() Return value A new object with properties reflecting the
locale and number formatting options computed during the initialization of the given NumberFormat object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were ...
... numberingSystem The value provided for this properties in the options argument, if present, or the value requested using the Unicode extension key "nu" or filled in as a default. ...
... numberingSystem The value provided for this properties in the options argument, if present, or the value requested using the Unicode extension key "nu" or filled in as a default. ...
...And 2 more matches
Intl.NumberFormat - JavaScript
cts that enable language sensitive number formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.NumberFormat() Creates a new NumberFormat object. Static methods Intl.NumberFormat.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.NumberFormat.prototype.format() Getter function that formats a number according to the
locale and formatting options of this NumberFormat object. Intl.NumberFormat.prototype.formatToParts() Returns an Array of objects represe...
...les that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.NumberFormat.prototype.format() Getter function that formats a number according to the
locale and formatting options of this NumberFormat object. Intl.NumberFormat.prototype.formatToParts() Returns an Array of objects representing the number string in parts that can be used for custom
locale-aware formatting. Intl.NumberFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and collation options computed during initialization of the object. Examples Basic usage In basic use without specifying a
locale, a formatted string in the default
locale and with default options is returned. var number = 3500; console.log(new Intl.NumberFormat().for...
...pe.resolvedOptions() Returns a new object with properties reflecting the
locale and collation options computed during initialization of the object. Examples Basic usage In basic use without specifying a
locale, a formatted string in the default
locale and with default options is returned. var number = 3500; console.log(new Intl.NumberFormat().format(number)); // -> '3,500' if in US English
locale Using
locales This example shows some of the variations in localized number formats. ...
...And 2 more matches
preferences/service - Archive of obsolete content
defaultValue : string Preference value. Returns string : Localized preference value, returns a default value if no preference is set. Some preferences refer to a properties file. So that prefs.get returns the properties file URL whereas prefs.getLocalized returns the value defined in the properties file. ...
...g : Localized preference value, returns a default value if no preference is set. Some preferences refer to a properties file. So that prefs.get returns the properties file URL whereas prefs.getLocalized returns the value defined in the properties file. ...
...seragent.
locale"; prefs.get(name); // is equal to "chrome://global/
locale/intl.properties" prefs.getLocalized(name) // is equal to "en-US" setLocalized(name, value) Sets the localized application preference name to value. Parameters name : string Preference name. ...
...lobal/
locale/intl.properties" prefs.getLocalized(name) // is equal to "en-US" setLocalized(name, value) Sets the localized application preference name to value. Parameters name : string Preference name. ...
Preferences - Archive of obsolete content
ents.interfaces.nsISupportsString); str.data = "some non-ascii text"; prefs.setComplexValue("preference.with.non.ascii.value", Components.interfaces.nsISupportsString, str); nsIPrefLocalizedString Another complex type supported by Mozilla is nsIPrefLocalizedString. ...
...SupportsString, except that when there is no user value, getComplexValue() gets the default value from a
locale file (thus making the default value localizable). It's easier to explain this by example. Let's say you want to make the default value for the extensions.myext.welcomemessage preference localizable. You should do the following: Add this line to some .properties file (for all of your
locales), say to chrome://myext/
locale/defaults.properties: extensions.myext.welcomemessage=Localized default value Add the default value for extensions.myext.welcomemessage, pointing to that properties file, by adding the following line to your file with default preferences (see below). ...
...line to some .properties file (for all of your
locales), say to chrome://myext/
locale/defaults.properties: extensions.myext.welcomemessage=Localized default value Add the default value for extensions.myext.welcomemessage, pointing to that properties file, by adding the following line to your file with default preferences (see below). ...
... Setting nsIPrefLocalizedString preferences is similar to setting nsISupportsString: var pls = Components.classes["@mozilla.org/pref-localizedstring;1"] .createInstance(Components.interfaces.nsIPrefLocalizedString); pls.data = val; prefs.set...
Install Scripts - Archive of obsolete content
ll specify that the findfile directory from the installer archive should be installed. We can call these functions multiple times to install other files. Next, we'll want to register the find files in the chrome system so that it can be used with a chrome URL. This can be done with the registerChrome() function. It takes two arguments, the first is the type of chrome to register (content, skin or
locale). The second is the directory containing the contents.rdf file to register. Because the find files dialog contains content, a skin file and a
locale file, registerChrome() will need to be called three times. registerChrome(Install.CONTENT | Install.DELAYED_CHROME, getFolder(findDir, "content")); registerChrome(Install.SKIN | Install.DELAYED_CHROME, getFolder(findDir, "skin")); registerChrome(Inst...
...he second is the directory containing the contents.rdf file to register. Because the find files dialog contains content, a skin file and a
locale file, registerChrome() will need to be called three times. registerChrome(Install.CONTENT | Install.DELAYED_CHROME, getFolder(findDir, "content")); registerChrome(Install.SKIN | Install.DELAYED_CHROME, getFolder(findDir, "skin")); registerChrome(Install.
LOCALE | Install.DELAYED_CHROME, getFolder(findDir, "
locale")); The DELAYED_CHROME flag is used to indicate that the chrome should be installed the next time Mozilla is run. Installation Completion The addDirectory() and addFile() functions don't copy any files. They only state which files should be installed. Similarly, registerChrome() only states that chrome should be registered. To complete the pro...
... << PreviousNext >> ...
... << PreviousNext >> ...
The Chrome URL - Archive of obsolete content
ed into Mozilla's chrome system can be referenced with special chrome URLs. The packages included with Mozilla will already be installed but you can register your own. Installed packages have the advantage that they don't have security restrictions placed on them, which is necessary for many applications. Another advantage over other URL types is that they automatically handle multiple themes and
locales. For example, a chrome URL lets you refer to a file in the theme such as an image without needing to know which theme the user is using. As long as the filenames are the same in each theme, you can refer to the file using a chrome URL. Mozilla will take care of determining where the file is located and return the right data. This also means that it doesn't matter where the package is installed t...
...ier to write applications that have lots of files since you don't have to worry about the details of locating files. The basic syntax of a chrome URL is as follows: chrome://<package name>/<part>/<file.xul> The text <package name> is the package name, such as messenger or editor. All package names are case insensitive, but lowercase names are preferred. The <part> is either 'content', 'skin' or '
locale' depending on which part you want. <file.xul> is simply the filename. Example: chrome://messenger/content/messenger.xul The example here refers to the messenger window. You could point to a file that is part of a skin by replacing 'content' with 'skin' and changing the filename. Similarly, you can point to a file that is part of a
locale by using '
locale' instead of 'content'. When you open a chr...
...dingly, Thunderbird will still work since it doesn't rely on its specific installed location. By using chrome URLs we can leave details like this to Mozilla. Similarly, if the user changes their theme, the 'skin' part of the chrome URL translates to a different set of files, yet the XUL and scripts don't need to change. Here are some more examples. Note how none of the URLs specify which theme or
locale is used and none specify a specific directory. chrome://messenger/content/messenger.xul chrome://messenger/content/attach.js chrome://messenger/skin/icons/folder-inbox.gif chrome://messenger/
locale/messenger.dtd To refer to subdirectories, you can just add them to the end of the chrome URL. The following URL will refer to the bookmarks window, listed for Firefox: chrome://browser/content/bookmar...
... with the same name as the package, so it can be referred to using this shorter form. This is convenient since all a user needs to know is the package name to be able to open the application. Of course, for extensions that modify the browser interface, the user will not need to know the URL, as the extension will present itself in the UI. For a skin, the file <package name>.css is selected; for a
locale, the file <package name>.dtd is selected. Remember, the chrome URL is not related to where it is located on disk. The first two pieces of the chrome URL are the package name and the part (either content, skin, or
locale). While it is common to put the content files in a directory called 'content', this is purely out of convention, and these files may be placed in an entirely different structure. ...
stringbundle - Archive of obsolete content
rated with an equals sign. For example, the following defines two properties: message.displayError=An error occured trying to display this message message.nameAlreadyUsed=The name %S is already being used by another account. More information is available in the XUL tutorial. The "src" attribute accepts only absolute chrome:// URLs (see bugs 133698, 26291) Attributes src Properties app
Locale , src, stringBundle, strings Methods getFormattedString, getString Examples (example needed) Attributes src Type: URI The URI of the property file that contains the localized strings. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equal...
... src Type: URL Gets and sets the value of the src attribute. stringBundle Type: nsIStringBundle Returns the XPCOM string bundle object which implements nsIStringBundle. strings Type: nsISimpleEnumerator...
... src Type: URL Gets and sets the value of the src attribute. stringBundle Type: nsIStringBundle Returns the XPCOM string bundle object which implements nsIStringBundle. strings Type: nsISimpleEnumerator An enumeration of all of the strings in the stri...
...gh, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Properties app
Locale Obsolete since Gecko 1.9.1 Type: nsI
Locale Returns the XPCOM object which holds information about the user's
locale. This is an object which implements nsI
Locale. src Type: URL Gets and sets the value of the src attribute. stringBundle Type: nsIStringBundle Returns the XPCOM string bundle object which implements nsIStringBundle. strings Type: nsISimpleEnumerator An enumeration of all of the strings in the string bundle. The enumeration contains nsIPropertyElement objects. Methods get...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
be released under the same terms (free to use, share, study, and modify), the LGPL only requires the LGPL-licensed component of the derivative program to continue using the LGPL, not the whole program. LGPL is usually used to license shared components such as libraries (.dll, .so, .jar, etc.). 246 LTR (Left To Right) Composing, Glossary, Localization LTR (Left To Right) is a
locale property indicating that text is written from left to right. For example, the en-US
locale (for US English) specifies left-to-right. 247 Latency Audio, Glossary, Media, Networking, Reference, Video, Web Performance, latency Latency is the network time it takes for a requested resource to reach its destination. Low latency is good, meaning there is little or no delay. High lat...
...1 Local scope CodingScripting, Glossary, NeedsContent Local scope is a characteristic of variables that makes them local (i.e., the variable name is only bound to its value within a scope which is not the global scope). 252 Local variable CodingScripting, Glossary, NeedsContent A variable whose name is bound to its value only within a local scope. 253
Locale Composing, Glossary,
Locale Locale is a set of language- or country-based preferences for a user interface. 254 Localization Collaborating, Glossary, Intro, Localization, WebMechanics Localization (l10n) is the process of adapting a software user interface to a specific culture. 255 Long task Glossary, Long Tasks API, Reference, Web Performance ...
...P is used to provide control and statistical information about an RTP media streaming session. 358 RTF Composing, Format, Glossary, RTF, Rich Text Format RTF (Rich Text Format) is a plain-text-based file format with support for formatting instructions (like bold or italic). 359 RTL (Right to Left) Composing, Glossary, Localization RTL (Right To Left) is a
locale property indicating that text is written from right to left. 360 RTP (Real-time Transport Protocol) and SRTP (Secure RTP) Glossary, Network, Protocol, RTP The Real-time Transport Protocol (RTP) is a network protocol which described how to transmit various media (audio, video) from one endpoint to another in a real-time fashion. RTP is suitable for video-streaming application,...
...ode, which alters the semantics of JavaScript in several ways to improve its resiliency and which make it easier to understand what's going on when there are problems. 425 Slug Community, Glossary, Intermediate, MDN, URL, Web A Slug is the unique identifying part of a web address, typically at the end of the URL. In the context of MDN, it is the portion of the URL following "<
locale>/docs/". 426 Smoke Test Composing, Glossary, Intro, QA, Testing A smoke test consists of functional or unit tests of critical software functionality. Smoke testing comes before further, in-depth testing. 427 Snap positions Glossary, snap positions A scroll container may set snap positions -- points that the scrollport will stop moving at after a scrolling...
Index
e technical aspects involved in localization. 2 Application Translation with Mercurial Android, Draft, Editing, Firefox, Lightning, Localization, Mercurial, SeaMonkey, Translate, patch, thunderbird First, get the required programs to compile Mozilla applications like Firefox and Thunderbird from Build Instructions. This is only necessary once. 3 Bootstrapping a new
locale Localization, Mercurial, Translate, bit bucket (see also https://developer.mozilla.org/en/Create_a_new_localization) 4 Encodings for localization files Internationalization, Localization When creating a localization for Mozilla products, it's important to be aware of the encoding of the files that you generate. 5 Index Localization Found 42 page...
...ation files Internationalization, Localization When creating a localization for Mozilla products, it's important to be aware of the encoding of the files that you generate. 5 Index Localization Found 42 pages: 6 L10n Checks Internationalization, Localization, Localization:Tools, Tools L10n Checks is a Python script and library similar to compare-
locales. It allows Mozilla localizers to easily check their work. 7 L10n testing with xcode Firefox for iOS, Localization Once you have your l10n testing environment set up in Xcode, testing your Firefox on iOS localization is a breeze. 8 Localization and Plurals Internationalization, Localization You're likely here because you're localizing a .properties file a...
...d with all of the basic, technical information you need to get involved in the Mozilla l10n program. 13 Initial setup Localization As a pre-requisite to contributing to the L10n program, you need to have access to code, tools, and a properly configured local environment (i.e., your personal computer). You also need to determine if a localization effort already exists for your
locale. Here we'll go over the accounts you need as well as the tools and their configurations you need to set up before contributing. 14 QA phase Localization After all of your hard work localizing we're sure that you not only want to see your work but you want to make sure it's accurate! If you don't have a lot of experience with code, you might even be concerned that you've broke...
...The content here should be what you and your localization team have decided, together, to follow when localizing Mozilla products and web sites. You are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. All we ask is that you name this page according to this example, "Mozilla Content in Spanish (es-MX)" and add your
locale code tag at the bottom. Enjoy developing your style guide! 31 Patching a Localization Localization Say you have found a problem with an existing localization. More specifically, it's a problem with an already released localization. What do you do now? Well, you have come to the right place! This page will walk you through creating a patch for an existing localization. The ste...
Localizing with Pontoon
out some sweet features that will make you more efficient and make your l10n contributions easier. Are you a developer? Read about implementing Pontoon in your project or learn how to get involved on GitHub. First steps Pontoon's home page is very easy to use. To begin localizing the project, click on the Persona icon and sign in. Next, simply select the project you want to work on and your
locale from the dropdown menus. Pontoon will automatically open that
locale's project for you to get started. Note that for our purposes here, we'll be using Firefox Affiliates website to demo Pontoon's functionality and workflow. And there it is, opened inside Pontoon: Main toolbar As you can see, most of the interface is taken by the website being translated. Only the toolbar on top belongs to Pon...
...r on top belongs to Pontoon, containing the following items (from left to right): List of strings Opens a sidebar with a list of all strings to localize. Project selector (Affiliates) Switches between projects to localize. Resource selector (Homepage) Switches between project resources to localize, like subpages or localization files. Hidden if no resources available for project.
Locale selector (Slovenian) Switches between languages to localize. Go Opens project-resource-
locale selection. Progress indicator Displays your progress on the resource being localized. More details are available in the popup. User menu Allows for user-specific tasks, like commiting to repository, downloading files and signing out. Info menu Gives important information, like the anticipate...
...iginal string and its details (e.g. comments) opens. Translate the string in the translation area below. Click the save button to save your translation. As you translate strings out-of-context, translations will also appear in website, if they could also be translated in-context. Translation helpers As you can see, suggestions from history, translation memory, machine translation and other
locales are also available in the out-of-context translation panel. We call all of these translation helpers and here's how each of them will help you as you translate strings: History Displays previously suggested translations, including from other users. Machinery Displays matches from various services: internal translation memory, Mozilla Transvision, open source translation memory, Microsof...
...nslation panel. We call all of these translation helpers and here's how each of them will help you as you translate strings: History Displays previously suggested translations, including from other users. Machinery Displays matches from various services: internal translation memory, Mozilla Transvision, open source translation memory, Microsoft terminology and machine translation. Other
locales Displays matching translations from other
locales. Search Almost like machinery, but takes provided keyword as input parameter instead of the original string. By clicking a suggestion, it gets copied into translation area. Publishing your localization Suppose you now want to publish your l10n work by committing it to a repo. Pontoon lets you do that too! Actually, it does that for you b...
SVN for Localizers
ects/mozilla.com directory: Navigating from the command-line with your SVN client, you'll find three directories within projects/mozilla.com. The trunk directory is what you are most insterested in. Trunk refers to a set of files and directories that are in the testing stage (i.e., staging). All file modifications belong in trunk because they are seen most frequently. Inside mozilla.com/trunk/
locales, there are separate directories for each
locale that is localizing mozilla.com. In each of those
locale directories are other directories with files to be localized in .lang format. Note: We use the terms stage and prod (abbreviations of the terms staging and production) to refer to testing and publicly visible websites, respectively. Working with SVN Now that you understand the Mozilla SVN ...
...king with SVN Now that you understand the Mozilla SVN repository layout (in particular the layout for mozilla.com), let's get some files into your hands to start localizing! The first thing you need to do is copy the Mozilla repository you want to work on to your computer. Enter the following command in your command-line tool: svn checkout https://svn.mozilla.org/projects/mozilla.com/trunk/
locales/[your
locale code] mozilla-l10n-[your-
localeCode] This command creates the mozilla-l10n-[your-
localeCode] directory on your computer and copies into it all of the files from https://svn.mozilla.org/projects/moz...om/trunk/
locales/[your
locale code]. Note: The directory you create will be located inside the directory that you're currently in with your console (or Cygwin console). Also, we use ...
...ctory on your computer where you wish to store the diff file. You can also run svn status to check the list of modified files (they'll display a M before the name) you're about to commit. Once you're satisfied with changes, commit them to the appropriate Mozilla SVN repository by entering the following command: svn commit -m "Minor modifications for Firefox [version #] beta page for [your
locale]" The svn commit command will commit your changes directly to the Mozilla SVN repositories. Since you are writing to the repository here, you will be asked for your LDAP login credentials. The -m parameter followed by some text within double quotes (") will be pushed along with your changes. Within the double quotes you should briefly describe your changes so that everyone can see what you con...
... LDAP login credentials. The -m parameter followed by some text within double quotes (") will be pushed along with your changes. Within the double quotes you should briefly describe your changes so that everyone can see what you contributed. You can also double check your changes using the ViewVC interface. After you commit your changes, wait 15 minutes and check the staging website for your
locale. Your recent changes should now be visible online. You will have the chance to see how the localized website will look when it's pushed to prod (i.e., a website that regular visitors will see). When localizing websites, l10n-drivers will always add needed files to your repository or update your files with new strings in English. It's very important for you to update your working copy with the...
Research and prep
Productization is the process of determining a user's choice of default search engines, content and protocol handlers (RSS Readers, Web Mail and Web Calendar), bookmarks, and links to recommended sites on the in-product pages as it relates to their
locale. It is one of the most customizable and localizable parts of the product l10n process, as it goes beyond string translation. ...
...g translation. We believe that localization teams are in the best position to provide recommendations on what local providers we can use for web services because you're in the market, work in the language, and know your users. This is, therefore, meant to be a guideline for how you should be formulating your recommendations. Here's the basic process: File a bug under Mozilla Localizations>[your_
locale] to request updates to your
locale's productization preferences. If this is your first localization for a product, the l10n drivers will file this bug as part of the new product localization release process. It is your l10n team's responsibility to perform research and identify the most appropriate web services for your region and present them in your bug as your informed recommendations. If th...
...ve search plug-ins listed for Firefox desktop (only four for Firefox mobile): Generic search The default option should expose the quickest path to the best result on the world wide web for the user (indexing a large portion of the global www). Global search The second position can be used for the next best local language provider, meaning coverage within the local language and/or
locale (indexing a smaller portion of the www but producing better local language results). Local search A good test is if you were to run a set of comparative queries; the secondary engine should produce the best local language results and the primary/default position should produce the best global results. e-Commerce search These search engines should allow users to get connected to ne...
...uickly and painlessly as possible in a "trusted" site -- for example, choosing the most popular auction, general shopping, or classified type sites that have the desired user experience are good choices. There should be no more than two. Specific interest search Where users are using popular search engines to search more specific areas of interest that are very popular in your language or
locale. There should be no more than two. In all cases, user experience should be taken into account and given preference for what is desired in that language/
locale. If you have questions about what that means, please contact milos@mozilla.com or Milos on IRC. RSS Readers and Content handlers Productization for RSS readers and content handlers applies only to Firefox desktop. Your selections for defau...
L20n HTML Bindings
dings We maintain a repository with L20n optimized for production use: one file (~110KB) one file, minified (~35KB) It's recommended to include the l20n.js file as the last script in the head element. <head> ... <script src="l20n.js"></script> </head> Create Manifest Use a localization manifest to define available languages and their resource files. <link rel="localization" href="../
locales/manifest.json"> An example of the manifest file (all keys are required): { "
locales": [ "en-US", "pl"], "default_
locale": "en-US", "resources": [ "../
locales/{{
locale}}/strings.l20n", "/shared/{{
locale}}/date.l20n"? ] } Make HTML Elements Localizable Use the data-l10n-id attribute on an HTML element to mark it as localizable. <p data-l10n-id="about"></p> Notice that you ...
...r] { feminine: "{{ $user.name }} has invited you to her circles.", masculine: "{{ $user.name }} has invited you to his circles.", *unknown: "{{ $user.name }} has invited you to their circles." }> Based on the context data defined above, this will produce: Jane has invited you to her circles. Monolingual mode L20n can also operate in the so-called monolingual mode, when there is only one
locale available. It doesn't have any specific
locale code (internally, it's called i-default in compliance to RFC 2277). There is no language negotiation nor
locale fallback possible in the monolingual mode. L20n simply always uses this one default
locale. The monolingual mode may be useful when you first start a new project, when you want to test something quickly or when using server-side language n...
...You can then embed localization resources right in your HTML. <script type="application/l20n"> <brandName "Firefox"> <about "About {{ brandName }}"> </script> An alternative is to include localization resources in script elements. Note that this still only works for a single language. ...
...your HTML. <script type="application/l20n"> <brandName "Firefox"> <about "About {{ brandName }}"> </script> An alternative is to include localization resources in script elements. Note that this still only works for a single language. We plan to add support for a Language Pack Service in the future that can tap into this scenario on the client side. <script type="application/l20n" src="../
locales/strings.l20n"></script> Note that you currently cannot use the manifest file and manually add resources via script tags at the same time (bug 923670). ...
Using IndexedDB - Web APIs
ransactions will complete, even with normal browser shutdown. See bug 870645. As a workaround for this normal shutdown notification, you might track your transactions and add a beforeunload event to warn the user if any transactions have not yet completed at the time of unloading. At least with the addition of the abort notifications and IDBDatabase.onclose, you can know when this has happened.
Locale-aware sorting Mozilla has implemented the ability to perform
locale-aware sorting of IndexedDB data in Firefox 43+. By default, IndexedDB didn't handle internationalization of sorting strings at all, and everything was sorted as if it were English text. For example, b, a, z, a would be sorted as: a b z a which is obviously not how users want their data to be sorted -- Aaron and Aaron for...
... a b z a which is obviously not how users want their data to be sorted -- Aaron and Aaron for example should go next to one another in a contacts list. Achieving proper international sorting therefore required the entire dataset to be called into memory, and sorting to be performed by client-side JavaScript, which is not very efficient. ...
...ting therefore required the entire dataset to be called into memory, and sorting to be performed by client-side JavaScript, which is not very efficient. This new functionality enables developers to specify a
locale when creating an index using IDBObjectStore.createIndex() (check out its parameters.) In such cases, when a cursor is then used to iterate through the dataset, and you want to specify
locale-aware sorting, you can use a specialized IDB
LocaleAwareKeyRange. ...
...icient. This new functionality enables developers to specify a
locale when creating an index using IDBObjectStore.createIndex() (check out its parameters.) In such cases, when a cursor is then used to iterate through the dataset, and you want to specify
locale-aware sorting, you can use a specialized IDB
LocaleAwareKeyRange. IDBIndex has also had new properties added to it to specify if it has a
locale specified, and what it is:
locale (returns the
locale if any, or null if none is specified) and isAuto
Locale (returns true if the index was created with an auto
locale, meaning that the platform's default
locale is used, false otherwise.) Note: This feature is currently hidden behind a flag -- to enable it and experiment, go to about:config and enable dom.indexedDB.experimental. Full IndexedD...
<input type="datetime-local"> - HTML: Hypertext Markup Language
When the above value submitted to the server, for example, it will look like partydate=2017-06-01T08:30. Note: Also bear in mind that if such data is submitted via HTTP GET, the colon character will need to be escaped for inclusion in the URL parameters, e.g. partydate=2017-06-01T08%3A30. Se...
...,000 milliseconds). At this time, it's unclear what a value of any means for step when used with datetime-local inputs. This will be updated as soon as that information is determined. Using datetime-local inputs Date/time inputs sound convenient at first glance; they provide an easy UI for choosing dates and times, and they normalize the data format sent to the server, regardless of the user's
locale. However, there are issues with <input type="datetime-local"> because of the limited browser support. We'll look at basic and more complex uses of <input type="datetime-local">, then offer advice on mitigating the browser support issue later on (see Handling browser support). Basic uses of datetime-local The simplest use of <input type="datetime-local"> involves a basic <input> and <label> ele...
.... However, this does not seem to work effectively in any implementation at the time of writing. Controlling input size <input type="datetime-local"> doesn't support form control sizing attributes such as size. You'll have to resort to CSS for customizing the sizes of these elements. Setting timezones One thing the datetime-local input type doesn't provide is a way to set the time zone and/or
locale of the date/time control. This was available in the datetime input type, but this type is now obsolete, having been removed from the spec. The main reasons why this was removed are a lack of implementation in browsers, and concerns over the user interface/experience. It is easier to just have a control (or controls) for setting the date/time and then deal with the
locale in a separate control. F...
...e, having been removed from the spec. The main reasons why this was removed are a lack of implementation in browsers, and concerns over the user interface/experience. It is easier to just have a control (or controls) for setting the date/time and then deal with the
locale in a separate control. For example, if you are creating a system where the user is likely to already be logged in, with their
locale already set, you could provide the timezone in a hidden input type. For example: <input type="hidden" id="timezone" name="timezone" value="-08:00"> On the other hand, if you were required to allow the user to enter a timezone along with a date/time input, you could provide a means of inputting a timezone, such as a <select> element: <select name="timezone_offset" id="timezone-offset" class="sp...
Inheritance and the prototype chain - JavaScript
s a default prototype property, as demonstrated by the console. After running this code, the console should have displayed an object that looks similar to this. { constructor: f doSomething(), __proto__: { constructor: f Object(), hasOwnProperty: f hasOwnProperty(), isPrototypeOf: f isPrototypeOf(), propertyIsEnumerable: f propertyIsEnumerable(), to
LocaleString: f to
LocaleString(), toString: f toString(), valueOf: f valueOf() } } We can add properties to the prototype of doSomething(), as shown below. function doSomething(){} doSomething.prototype.foo = "bar"; console.log( doSomething.prototype ); This results in: { foo: "bar", constructor: f doSomething(), __proto__: { constructor: f Object(), h...
...omething(), as shown below. function doSomething(){} doSomething.prototype.foo = "bar"; console.log( doSomething.prototype ); This results in: { foo: "bar", constructor: f doSomething(), __proto__: { constructor: f Object(), hasOwnProperty: f hasOwnProperty(), isPrototypeOf: f isPrototypeOf(), propertyIsEnumerable: f propertyIsEnumerable(), to
LocaleString: f to
LocaleString(), toString: f toString(), valueOf: f valueOf() } } We can now use the new operator to create an instance of doSomething() based on this prototype. To use the new operator, simply call the function normally except prefix it with new. Calling a function with the new operator returns an object that is an instance of the function. Properties can then be ...
...But, what does this do? When you access a property of doSomeInstancing, the browser first looks to see if doSomeInstancing has that property. If doSomeInstancing does not have the property, then the browser l...
...But, what does this do? When you access a property of doSomeInstancing, the browser first looks to see if doSomeInstancing has that property. If doSomeInstancing does not have the property, then the browser looks for the prope...
Date - JavaScript
local time. Date.prototype.getSeconds() Returns the seconds (0-59) in the specified date according to local time. Date.prototype.getTime() Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC. (Negative values are returned for prior times.) Date.prototype.getTimezoneOffset() Returns the time-zone offset in minutes for the current
locale. Date.prototype.getUTCDate() Returns the day (date) of the month (1-31) in the specified date according to universal time. Date.prototype.getUTCDay() Returns the day of the week (0-6) in the specified date according to universal time. Date.prototype.getUTCFullYear() Returns the year (4 digits for 4-digit years) in the specified date according to universal time. Date.prototype.getUTCHours()...
...ing like 'Thu Apr 12 2018'. Date.prototype.toISOString() Converts a date to a string following the ISO 8601 Extended Format. Date.prototype.toJSON() Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify(). Date.prototype.toGMTString() Returns a string representing the Date based on the GMT (UTC) time zone. Use toUTCString() instead. Date.prototype.to
LocaleDateString() Returns a string with a locality sensitive representation of the date portion of this date based on system settings. Date.prototype.to
LocaleFormat() Converts a date to a string, using a format string. Date.prototype.to
LocaleString() Returns a string with a locality-sensitive representation of this date. Overrides the Object.prototype.to
LocaleString() method. Date.prototype.toLoc...
... let date = new Date(98, 1) // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT) // Deprecated method; 98 map...
... let date = new Date(98, 1) // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT) // Deprecated method; 98 maps to 1998 here as well date.setYear(98) // Sun Feb 01 1998 00:00:...
Intl.Collator() constructor - JavaScript
The Intl.Collator object is a constructor for collators, objects that enable language sensitive string comparison. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.Collator([
locales[, options]]) Parameters
locales Optional. A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the
locales argument, see the Intl page. The following Unicode extension keys are allowed: co Variant collations for certain
locales. Possible values include: "big5han", "dict", "direct", "ducet", "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl"...
...sage (see below). kn Whether numeric collation should be used, such that "1" < "2" < "10". Possible values are "true" and "false". This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. kf Whether upper case or lower case should sort first. Possible values are "upper", "lower", or "false" (use the
locale's default). This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. options Optional. An object with some or all of the following properties:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this...
...ples: a != b, a != a, a = A. "case": Only strings that differ in base letters or case compare as unequal. Examples: a != b, a = a, a != A. "variant": Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal. Other differences may also be taken into consideration. Examples: a != b, a != a, a != A. The default is "variant" for usage "sort"; it's
locale dependent for usage "search". ignorePunctuation Whether punctuation should be ignored. Possible values are true and false; the default is false. numeric Whether numeric collation should be used, such that "1" < "2" < "10". Possible values are true and false; the default is false. This option can be set through an options property or through a Unicode extension key; if both are provided...
...2" < "10". Possible values are true and false; the default is false. This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. Implementations are not required to support this property. caseFirst Whether upper case or lower case should sort first. Possible values are "upper", "lower", or "false" (use the
locale's default); the default is "false". This option can be set through an options property or through a Unicode extension key; if both are provided, the options property takes precedence. Implementations are not required to support this property. Examples Using Collator The following example demonstrates the different potential results for a string occurring before, after, or at the same leve...
Intl.RelativeTimeFormat.prototype.format() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax relativeTimeFormat.format(value, unit) Parameters value Numeric value to use in the internationalized relative time message. unit Unit to use in the relative time internationalized message. Possible values are: "year", "quarter", "month", "week", "day", "hour", "minute", "second". ...
...arameters value Numeric value to use in the internationalized relative time message. unit Unit to use in the relative time internationalized message. Possible values are: "year", "quarter", "month", "week", "day", "hour", "minute", "second". Plural forms are also permitted. ...
...second". Plural forms are also permitted. Description The function returned by the format getter formats a value and a unit into a string according to the
locale and formatting options of this Intl.RelativeTimeFormat object. Examples Basic format usage The following example shows how to create a relative time formatter using the English language. // Create a relative time formatter in your
locale // with default values explicitly passed in. const rtf = new Intl.RelativeTimeFormat("en", {
localeMatcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // Format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // Format relative time using positive value (1)...
...ive value (-1). rtf.format(-1, "day"); // > "1 day ago" // Format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" Using the auto option If numeric:auto option is passed, it will produce the string yesterday or tomorrow instead of 1 day ago or in 1 day. This allows to not always have to use numeric values in the output. // Create a relative time formatter in your
locale // with numeric: "auto" option value passed in. const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); // Format relative time using negative value (-1). rtf.format(-1, "day"); // > "yesterday" // Format relative time using positive day unit (1). rtf.format(1, "day"); // > "tomorrow" Specifications Specification Status Comment ECMAScript Internationalizat...
l10n - Archive of obsolete content
ation tutorial. Note that you can't currently use localize strings appearing in content scripts or HTML files, but you can share the localized strings you want by assigning it's values to a JSON serializable object. Globals Functions get(identifier, count, placeholder1...n) This function takes a string parameter which it uses as an identifier to look up and return a localized string in the
locale currently set for Firefox. Localized strings are supplied by the add-on developer in .properties files stored in the add-ons "
locale" directory. The gettext tools uses "_" for the name of the function that retrieves localized strings. For compatibility with tools that expect this syntax, you can assign this function to "_": var _ = require("sdk/l10n").get; Given a .properties file for the curr...
...rently set for Firefox. Localized strings are supplied by the add-on developer in .properties files stored in the add-ons "
locale" directory. The gettext tools uses "_" for the name of the function that retrieves localized strings. For compatibility with tools that expect this syntax, you can assign this function to "_": var _ = require("sdk/l10n").get; Given a .properties file for the current
locale containing an entry like: hello_string= Hello! and the following code: var _ = require("sdk/l10n").get; console.log(_("hello_string")); the following output will be logged: info: Hello! If this function can't find the string referenced by the identifier parameter, it returns the identifier itself. This enables you to write functional, localizable code without localizing any strings - just ...
...n supply one or more placeholders to get(), which are strings, such as proper names, that should not be translated themselves but instead should be inserted into the translated string. You can't use plurals and placeholders in the same expression: if you do, the placeholders will be ignored. Parameters identifier : string A identifier for the localization of a particular string in the current
locale. count : integer Optional parameter. If you're supplying different localizations for a string for singular or plural forms, this parameter is the number of items there are in this case. var _ = require("sdk/l10n").get; console.log(_("child_id", 1)); console.log(_("child_id", 2)); See the tutorial on plural support for more information. Note that if you use this parameter, you can't supply an...
Source code directories overview - Archive of obsolete content
endent drawing and imaging. It can be used to draw rectangles, lines, images, etc. Essentially, it is a a set of interfaces for a platform-independent device (drawing) context. It does not handle widgets or specific drawing routines; it just provides the primitive operations for drawing. intl contains C interfaces and code for supporting localization. It contains code for various character sets,
locale formats (e.g. the format of the date and time for different cultures) and other localization facilities. ipc contains jpeg contains C code for reading/writing JPEG images. This code originated as the reference implementation for the JPEG specification from the Independent JPEG Group. js contains C code for tokenizing, parsing, interpretting and executing Javascript scripts. This code originate...
...ntained in the browser directory app contains contains code to build the firefox executable. base contains the XUL and branding code. components contains Firefox specific components like history, bookmarks, preferences, migration, sidebar.. configcontains build scripts for Firefox. extensions contains code for making certain extensions work. installer contains the Firefox installer code.
locales contains the files that are translated for Firefox. themes contains Firefox themes. Toolkit Toolkit is used by the standalone products. components contains the alerts, autocomplete, command line interface, console, cookies, download manager, filepicker, history, password manager, typeaheadfind, view source, etc. content contains XUL specific to the toolkit. library contains libXUL work.
...contains the files that are translated for Firefox. themes contains Firefox themes. Toolkit Toolkit is used by the standalone products. components contains the alerts, autocomplete, command line interface, console, cookies, download manager, filepicker, history, password manager, typeaheadfind, view source, etc. content contains XUL specific to the toolkit. library contains libXUL work.
localescontains files that are translated. mozappscontains shared application stuff. obsoletecontains obsolete stuff. profilecontains the profile manager themescontains themes as they relate to toolkit things. xreis the XUL runtime engine. This directory contains the code for initializing the toolkit. Original Document Information Author(s): Daniel Howard Other Contributors: Heikki Toivon...
Makefile.mozextension.2 - Archive of obsolete content
files $(NOECHO) $(NOOP) package:: make_xpi $(NOECHO) $(NOOP) #install :: make_xpi make_install # $(NOECHO) $(NOOP) clean :: make_clean $(NOECHO) $(NOOP) make_structure: @$(MKDIR) $(PROJECT) || { echo "creating directory failed; it probably exists. Either remove (clean it), or choose individual targets to build."; exit 1; } @echo $(MKDIR) $(PROJECT) $(MKDIR) $(PROJECT)/content $(PROJECT)/
locale $(PROJECT)/
locale/en-us $(PROJECT)/components/ $(PROJECT)/defaults/ $(PROJECT)/defaults/preferences/ $(PROJECT)/
locale/de-de $(PROJECT)/skin make_xpi: $(MKDIR) $(PROJECT)/chrome && \ cd $(PROJECT) && \ $(ZIPPROG) -r chrome/$(PROJECT).jar content
locale skin && \ $(ZIPPROG) -r $(PROJECT).xpi chrome.manifest install.rdf components defaults chrome && cd .. make_files: chrome.manifest inst...
....xul overlay.js overlay.dtd $(NOECHO) $(NOOP) make_clean: rm -rf $(PROJECT) # this may be a bit too old ?! Keeping it anyway.. ...
...dtd $(NOECHO) $(NOOP) make_clean: rm -rf $(PROJECT) # this may be a bit too old ?! Keeping it anyway.. ...
timepicker - Archive of obsolete content
he user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. value Type: string The initial value of the timepicker in either the form HH:MM:SS or HH:MM. Properties amIndicator Type: string The string value displayed for hours between midnight and noon, defaulting to AM. This value is determined from the user's
locale. dateValue Type: Date The date that is currently entered or selected in the datepicker as a Date object. disabled Type: boolean Gets and sets the value of the disabled attribute. hideSeconds Type: boolean Indicates whether the seconds field is visible or not. hour Type: integer The currently selected ...
...re the hour when it is less than 10. increment Type: integer Gets and sets the value of the increment attribute. is24HourClock Type: boolean A read only value indicating whether a 12-hour or 24-hour clock is used to display times. With a 12-hour clock, an extra field allows the user to pick between AM and PM. This value is determined from the user's
locale. isPM Type: boolean If false, the hour is between 0 and 11, and if true, the hour is 12 or greater. minute Type: integer The currently selected minute from 0 to 59. Set this property to change the selected minute. minuteLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before th...
... to 59. Set this property to change the selected minute. minuteLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before the minute when it is less than 10. pmIndicator Type: string The string value displayed for hours between noon and midnight, defaulting to PM. This value is determined from the user's
locale. readOnly Type: boolean If set to true, then the user cannot modify the value of the element. second Type: integer The currently selected second from 0 to 59. Set this property to change the selected second. secondLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before the seco...
Archived JavaScript Reference - Archive of obsolete content
ou can use the more general Proxy object instead.ArrayBuffer.transfer()The static ArrayBuffer.transfer() method returns a new ArrayBuffer whose contents have been taken from the oldBuffer's data and then is either truncated or zero-extended by newByteLength. If newByteLength is undefined, the byteLength of the oldBuffer is used. ...
... object instead.ArrayBuffer.transfer()The static ArrayBuffer.transfer() method returns a new ArrayBuffer whose contents have been taken from the oldBuffer's data and then is either truncated or zero-extended by newByteLength. If newByteLength is undefined, the byteLength of the oldBuffer is used. ...
...wByteLength. If newByteLength is undefined, the byteLength of the oldBuffer is used. This operation leaves oldBuffer in a detached state.Date.prototype.to
LocaleFormat()The non-standard to
LocaleFormat() method converts a date to a string using the specified formatting. Intl.DateTimeFormat is an alternative to format dates in a standards-compliant way. See also the newer version of Date.prototype.to
LocaleDateString().ECMAScript 2016 to ES.Next support in MozillaExpression closuresExpression closures are a shorthand function syntax for writing simple functions.for each...inThe for each...in statement iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed.Function.arityNot part of any standard.Function.prototype.isGenerator...
Localizing XLIFF files for iOS
XML. This tutorial will walk you through the steps you need to take to translation strings within an XLIFF file. String repository for Firefox on iOS The firefox-ios.xliff file is located in SVN. Decide where on your local computer you will store your copy of the github repo and navigate there in your terminal. Enter the command git clone https://github.com/mozilla-l10n/firefoxios-l10n/your-
locale-code/ You should now see the firefox-ios project in your selected directoy with the firefox-ios.xliff file in it. Translating the XLIFF file Open the firefox-ios.xliff file in your favorite text editor. In the <file> tag, add the target-language attribute with your
locale code as the value (e.g., target-language="xx-XX"). Be aware that there may be many <file> tags within one XLIFF documen...
... Strings are located within <trans-unit> tags. Source English strings are contained in <source> child tags. ...
...by engineer.</note> </trans-unit> Save your translations along the way. Once you've completed translation, it's important to make sure the XML in your XLIFF file is valid (e.g., no broken tag sets). Open the file in Firefox to have it run a validity check and correct any errors it might yell about. Commiting your XLIFF file Using this command, commit your translated XLIFF file into your
locale's directory: git commit -m "Commit message here" . Push your commit into the github repo: git push Kick up your feet, pop open a cold beer (or soda), and pat yourself on the back for doing something new, different, and exciting! ...
Localization formats
HTML/PHP Maybe you are designing a project that has relatively small translation needs like three to four lines (or more) of content asking users to update to the next version of software available. You may ...
...ges to SVN or sending us a patch that Pascal checks in. Advantages to HTML Good for small projects Very simple for web developers Gives localizers the exact context of translations A localizer who knows basic HTML can style translations to make sure translations display correctly...we can allow slight modifications (e.g. RTL or wider display) Gives the possibility to customize content per
locale Simple workflow, just put the file on svn and it can appear on the staging server Disadvantages to HTML Very hard for QA If localizer changes something incorrectly (i.e. accidentally removes some HTML like </h1>, that localizer can break everything.) Very hard to update automatically, if not impossible. Can be hard to tell what has changed .lang files Historically, Mozilla ...
...anslations to all the entity-like values of msgid. This is very non-standard because it avoids one of the obvious powers of Gettext. When English content is used as the value of the msgid, there is no need to place that content in a special repository. But, in the Download Day example, when changes were made to en-US, the web-developer had to push those changes to all the repositories of all the
locales. Localizers had to revisit an en-US repository to find the exact msgid, review the change, and return to their repository to make changes. Without having the exact content as the msgid, this process may cause several errors since the localizers cannot has to continually switch back-and-forth. In this case, the choice to use customized values for msgid was error-prone, onerous, and unfamiliar to...
What every Mozilla translator should know
d mozilla-central (or trunk) where the day to day developing work is done. When a development is started for an specific version, a new repository is created under hg.mozilla.org/releases/. All the content of the trunk is copied to this new branch so that the developing work is done in two (or more) parallel places: the generic trunk and the version oriented branch(es). ...
... content of the trunk is copied to this new branch so that the developing work is done in two (or more) parallel places: the generic trunk and the version oriented branch(es). For every branch and every
locale, there is a separate repository for localization files committed by the localizers. ...
...ing the content of the Hg server. Here we can easily have a look into other languages translations. Bugzilla, the bug-tracking system You do need an account in Bugzilla You should configure the account to Watch the following addresses: firefoxl10n@hotmail.com calendar-l10n@mozilla.bugs (specific for calendar related bugs) This way you will receive mail for bugs affecting many or even all
locales. When you create a bug, if you want the person in charge of the l10n to follow up your bug you should CC: l10n@mozilla.com If you choose to make changes to your localization, you should make the changes local to your disk, push them to your Hg repository on Merucial, test the changes on a nightly/tinderbox build, fix any errors if some are found and test again, and send the new changeset ID as...
Localization Use Cases
This article documents a few opportunities to improve the localization of Gaia (the UI layer of Firefox OS) by using L20n. In all presented examples, we try to show the existing code, explain the problem from the localizers' or developers' perspective, and suggest a solution. Declensions In Gaia's Browser app, there's an about-browser string defined as follows in apps/browser/
locales/browser: about-browser=About {{browserBrandShortName}} Problem definition In many inflected languages (e.g. German, Finnish, Hungarian, all Slavic languages), the about preposition governs the grammatical case of the complement. It might be the accusative (German), ablative (Latin) or locative (Slavic languages). Let's take Slovenian as an example. In Slovenian, the ideal string would inflect the noun,...
... crash-...
... crash-banner-os2={{brandShortName}} just crashed. Problem definition In some languages, past participles (crashed) must be accorded with the gender of the subject (in case of reflexive verbs) or the gender of the object. ...
nsIAccessibleText
Specifies if the coordinates are relative to the screen or to the parent window (see constants declared in nsIAccessibleCoordinateType.Constants. getSelectionBounds() void getSelectionBounds( in long selectionNum, out long startOffset, out long endOffset ); Parameters selectionNum startOffset endOffset getText() String methods may need to return multibyte-encoded strings, since some
locales can not be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8. AString getText( in long startOffset, in long endOffset ); Parameters startOffset endOffset Return value getTextAfterOffset() String methods may need to return multibyte-encoded strings, since some
locales can't be encoded using 16-bit chars. So this me...
.... So this method might return UTF-16 strings, or it could return "string" values which are UTF-8. AString getTextAfterOffset( in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset ); Parameters offset boundaryType startOffset endOffset Return value getTextAtOffset() String methods may need to return multibyte-encoded strings, since some
locales can't be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8. AString getTextAtOffset( in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset ); Parameters offset boundaryType startOffset endOffset Return value getTextAttributes() Get the accessible start/end offsets...
...ndOffset ); Parameters includeDefAttrs Points whether text attributes applied to the entire accessible should be included or not. offset Text offset. rangeStartOffset Start offset of the range of text. rangeEndOffset End offset of the range of text. Return value Exceptions thrown Missing Exception getTextBeforeOffset() String methods may need to return multibyte-encoded strings, since some
locales can't be encoded using 16-bit chars. So this method might return UTF-16 strings, or it could return "string" values which are UTF-8. AString getTextBeforeOffset( in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset ); Parameters offset boundaryType startOffset endOffset Return value removeSelection() void removeSelection( in long se...
nsIDOMWindowUtils
RenderDocument(in nsConstRect aRect, in PRUint32 aFlags, in nscolor aBackgroundColor, in gfxContext aThebesContext); Native code only! ...
...accessible) Will throw a DOM security error if called without UniversalXPConnect privileges. This is obsoleted since Gecko 38. Use nsITextInputProcessor, instead. void sendCompositionEvent( in AString aType, ); Obsolete since Gecko 9 Parameters aType The event type: "compositionstart" or "compositionend". void sendCompositionEvent( in AString aType, in AString aData, in AString a
Locale ); Obsolete since Gecko 38 Parameters aType The event type: "compositionstart" or "compositionend" Obsolete since Gecko 36. Since Gecko 36, specifying "compositionend" isn't fired anything. Instead, use "compositioncommitasis" or "compositioncommit". Or "compositionupdate". Obsolete since Gecko 35 Note that, since Gecko 35, specifying "compositionupdate" isn't fired anything. Instead, c...
... "compositioncommitasis" will cause commiting the composition with the last composing string. "compositioncommit" will cause commiting the composition with aData. Both compositionupdate event and compositionend event are fired automatically if they are necessary. aData The data value of dispatching composition event. If aType is "compositionstart" or "compositioncommitasis", this is ignored. a
Locale The
locale value of dispatching composition event. getClassName() Returns the real classname (possibly of the mostly-transparent security wrapper) of aObj. sendContentCommandEvent() Generate a content command event. Cannot be accessed from unprivileged context (not content-accessible) Will throw a DOM security error if called without UniversalXPConnect privileges. void sendContentCommandE...
IDBIndex - Web APIs
Each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. When the object store changes, all indexes that refers to the object store are automatically updated. You can grab a set of keys within a range. To learn more, see IDBKeyRange. Note: This feature is available in Web Workers. Properties IDBIndex.isAuto
Locale Read only Returns a Boolean indicating whether the index had a
locale value of auto specified upon its creation (see createIndex()'s optionalParameters.) IDBIndex.
locale Read only Returns the
locale of the index (for example en-US, or pl) if it had a
locale value specified upon its creation (see createIndex()'s optionalParameters.) IDBIndex.name The name of this index. IDBIndex.object...
...refix: webkitChrome Android Full support 25Firefox Android Full support 22Opera Android Full support 14Safari iOS Full support 8Samsung Internet Android Full support 1.5isAuto
Locale ExperimentalNon-standardChrome No support NoEdge No support NoFirefox Full support 43IE No support NoOpera No support NoSafari No support ...
...ndor prefix: webkitChrome Android Full support 25Firefox Android Full support 22Opera Android Full support 14Safari iOS Full support 8Samsung Internet Android Full support 1.5
locale ExperimentalNon-standardChrome No support NoEdge No support NoFirefox Full support 43IE No support NoOpera No support NoSafari No support ...
IDBObjectStore.createIndex() - Web APIs
ject, which can include the following properties: Attribute Description unique If true, the index will not allow duplicate values for a single key. multiEntry If true, the index will add an entry in the index for each array element when the keyPath resolves to an Array. If false, it will add one single entry containing the Array. ...
... Description unique If true, the index will not allow duplicate values for a single key. multiEntry If true, the index will add an entry in the index for each array element when the keyPath resolves to an Array. If false, it will add one single entry containing the Array.
locale Currently Firefox-only (43+), this allows you to specify a
locale for the index. ...
... multiEntry If true, the index will add an entry in the index for each array element when the keyPath resolves to an Array. If false, it will add one single entry containing the Array.
locale Currently Firefox-only (43+), this allows you to specify a
locale for the index. Any sorting operations performed on the data via key ranges will then obey sorting rules of that
locale (see
locale-aware sorting.) You can specify its value in one of three ways: string: A string containing a specific
locale code, e.g. en-US, or pl. auto: The platform default
locale will be used (may be changed by user agent settings.) null or undefined: If no
locale is specified, normal JavaScript sorting will be used -- not
locale-aware. Return va...
<input type="time"> - HTML: Hypertext Markup Language
xt">. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Appearance Chrome and Opera In Chrome/Opera the time control is simple, with slots to enter hours and minutes in 12 or 24-hour format depending on operating system
locale, and up and down arrows to increment and decrement the currently selected component. In some versions, an "X" button is provided to clear the control's value. 12-hour 24-hour Chrome 83 In Chrome 83, the UI controls have been updated with a new look and feel. The new element is functionally identical to the old one, but has a similar UI to Edge. 24-hour Firefox Firefox's time control is...
...value. 12-hour 24-hour Chrome 83 In Chrome 83, the UI controls have been updated with a new look and feel. The new element is functionally identical to the old one, but has a similar UI to Edge. 24-hour Firefox Firefox's time control is very similar to Chrome's, except that it doesn't have the up and down arrows. It also uses a 12- or 24-hour format for inputting times, based on system
locale. An "X" button is provided to clear the control's value. 12-hour 24-hour Edge The Edge time control is somewhat more elaborate, opening up an hour and minute picker with sliding reels. It, like Chrome, uses a 12- or 24-hour format for inputting times, based on system
locale: 12-hour 24-hour Value A DOMString representing a time, or empty. Events change and input...
...If the time includes seconds (see Using the step attribute), the format is always hh:mm:ss. You can learn more about the format of the time value used by this input type in Time strings in Date and time formats used in HTML. In this example, you can see the time input's value by entering a time and seeing how it changes afterward. First, a look at the HTML. This is simpl...
Accept-Language - HTTP
(By languages, we mean natural languages, such as English, and not programming languages.) Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Language response header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, this happens rarely (and is frowned upon as it leads to fingerprinting). ...
...determining the language via another way, like a specific URL, that is controlled by an explicit user decision. It is recommended that the server never overrides an explicit decision. The content of the Accept-Language is often out of the control of the user (like when traveling and using an Internet Cafe in a different country); the user may also want to visit a page in another language than the
locale of their user interface. If the server cannot serve any matching language, it can theoretically send back a 406 (Not Acceptable) error code. But, for a better user experience, this is rarely done and more common way is to ignore the Accept-Language header in this case. Header type Request header Forbidden header name no CORS-safelisted request header yes, wit...
... CORS-safelisted request header yes, with the additional restriction that values can only be 0-9, A-Z, a-z, space or *,-.;=. Syntax Accept-Language: <language> Accept-Language: * // Multiple types, weighted with the quality value syntax: Accept-Language: fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 Directives <language> A language tag (which is sometimes referred to as a "
locale identifier"). This consists of a 2-3 letter base language tag representing the language, optionally followed by additional subtags separated by '-'. The most common extra information is the country or region variant (like 'en-US' or 'fr-CA') or the type of alphabet to use (like 'sr-Latn'). Other variants like the type of orthography ('de-DE-1996') are usually not used in the context of this heade...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
Warning: String.endsWith is deprecated; use String.prototype.endsWith instead Warning: String.includes is deprecated; use String.prototype.includes instead Warning: String.indexOf is deprecated; use String.prototype.indexOf instead Warning: String.lastIndexOf is deprecated; use String.prototype.lastIndexOf instead Warning: String.
localeCompare is deprecated; use String.prototype.
localeCompare instead Warning: String.match is deprecated; use String.prototype.match instead Warning: String.normalize is deprecated; use String.prototype.normalize instead Warning: String.replace is deprecated; use String.prototype.replace instead Warning: String.search is d...
...rning: String.split is deprecated; use String.prototype.split instead Warning: String.startsWith is deprecated; use String.prototype.startsWith instead Warning: String.substr is deprecated; use String.prototype.substr instead Warning: String.substring is deprecated; use String.prototype.substring instead Warning: String.to
LocaleLowerCase is deprecated; use String.prototype.to
LocaleLowerCase instead Warning: String.to
LocaleUpperCase is deprecated; use String.prototype.to
LocaleUpperCase instead Warning: String.toLowerCase is deprecated; use String.prototype.toLowerCase instead Warning: String.toUpperCase is deprecated; use String.prototype.toUpperCase instead Warning: String.trim is dep...
...he // getOwnPropertyNames() method is non-shimable: // Object.getOwnPropertyNames(String).filter(function(methodName) { // return typeof String[methodName] === 'function'; // }); methods = [ 'contains', 'substring', 'toLowerCase', 'toUpperCase', 'charAt', 'charCodeAt', 'indexOf', 'lastIndexOf', 'startsWith', 'endsWith', 'trim', 'trimLeft', 'trimRight', 'to
LocaleLowerCase', 'normalize', 'to
LocaleUpperCase', '
localeCompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', '
localeCompare' ], methodCount = methods.length, assignStringGeneric = function(methodName) { var method = String.prototype[methodName]; String[methodName] = function(arg1) { return method.apply(arg1, Array.prototype.slice.ca...
Intl.Collator.prototype.resolvedOptions() - JavaScript
The Intl.Collator.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and collation options computed during initialization of this Collator object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax collator.resolvedOptions() Return value A new object with properties reflecting the
locale and collation options computed during the initialization of the given Collator object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 la...
...r.resolvedOptions() Return value A new object with properties reflecting the
locale and collation options computed during the initialization of the given Collator object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this
locale, the key-value pairs that were requested and are supported for this
locale are included in
locale. usage sensitivity ignorePunctuation The values provided for these properties in the options argument or filled in as defaults. collation The value requested using the Unicode extension key "co", if it is supported for
locale, or "default". numeric caseFirst The values requested for these pr...
...lt". numeric caseFirst The values requested for these properties in the options argument or using the Unicode extension keys "kn" and "kf" or filled in as defaults. If the implementation does not support these properties, they are omitted. ...
Intl.Collator - JavaScript
ntl.Collator objects enable language sensitive string comparison. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.Collator() Creates a new Collator object. Static methods Intl.Collator.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.Collator.prototype.compare Getter function that compares two strings according to the sort order of this Intl.Collator object. Intl.Collator.prototype.resolvedOptions() Returns a new object with properties reflecting the loca...
...alue console.log(new Intl.Collator().compare('c', 'a')); // -> a positive value console.log(new Intl.Collator().compare('a', 'a')); // -> 0 Note that the results shown in the code above can vary between browsers and browser versions. This is because the values are implementation-specific. That is, the specification requires only that the before and after values are negative and positive. ...
...e implementation-specific. That is, the specification requires only that the before and after values are negative and positive. Using
locales The results provided by Collator.prototype.compare() vary between languages. ...
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
The Intl.DateTimeFormat.prototype.formatToParts() method allows
locale-aware formatting of strings produced by DateTimeFormat formatters. Syntax dateTimeFormat.formatToParts(date) Parameters date Optional The date to format. Return value An Array of objects containing the formatted date in parts. Description The formatToParts() method is useful for custom formatting of date strings. It returns an Array of objects containing the
locale-specific tokens from which it possible to build custom strings while preserving the
locale-specific parts. The structure the formatToParts() method returns, looks like this: [ { type: 'day', value: '17' }, { type: 'weekday', value: 'Monday' } ] Possible types are the following: day The string used for the day, for example "17". dayPeriod Th...
... weekday: 'long', year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3, hour12: true, timeZone: 'UTC' }); formatter.format(date); // "Monday, 12/17/2012, 3:00:42.000 AM" However, in many User Interfaces there is a desire to customize the formatting of this string. ...
..., value: '2012' }, { type: 'literal', value: '?' }, { type: 'month', value: '???' }, { type: 'day', value: '4' } ] In cases where the year would be output, .format() may commonly present these side-by-side: let df = new Intl.DateTimeFormat("zh-u-ca-chinese", {year: "numeric"}); df.format(Date.UTC(2012, 11, 17, 3, 0, 42)); // return value 2012??? ...
Intl.DisplayNames() constructor - JavaScript
The Intl.DisplayNames() constructor creates objects that enables the consistent translation of language, region and script display names. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.DisplayNames([
locales[, options]]) Parameters
locales Optional A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the
locales argument, see the Intl page. The following Unicode extension key is allowed: nu The numbering system to be used. Possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "kh...
...tl page. The following Unicode extension key is allowed: nu The numbering system to be used. Possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". options Optional An object with some or all of the following properties:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page. style The formatting style to use, the default is "long". "narrow" "short" "long" type The type to use, the default is "language". "language" "region" "script" "currency" fallba...
... this option, see the Intl page. style The formatting style to use, the default is "long". "narrow" "short" "long" type The type to use, the default is "language". "language" "region" "script" "currency" fallback The fallback to use, the default is "code". "code" "none" Examples Basic usage In basic use without specifying a
locale, a formatted string in the default
locale and with default options is returned. console.log((new Intl.DisplayNames()).of('US')); // Expected output: 'us' Specifications Specification Intl.DisplayNamesThe definition of 'the Intl.DisplayNames constructor' in that specification. ...
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
The Intl.PluralRules.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and plural formatting options computed during initialization of this PluralRules object. Syntax pluralRule.resolvedOptions() Return value A new object with properties reflecting the
locale and plural formatting options computed during the initialization of the given PluralRules object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this
locale, the key-value pairs that were requested and are supported for this
locale are included in
locale. pluralCategories An Array of plural categories used by the given...
... type The type used (cardinal or ordinal). ...
...he options argument. minimumSignificantDigits maximumSignificantDigits The values provided for these properties in the options argument or filled in as defaults. These properties are present only if at least one of them was provided in the options argument. ...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
The Intl.RelativeTimeFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and relative time formatting options computed during initialization of this RelativeTimeFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax relativeTimeFormat.resolvedOptions() Return value A new object with properties reflecting the
locale and number formatting options computed during the initialization of the given RelativeTimeFormat object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any...
...) Return value A new object with properties reflecting the
locale and number formatting options computed during the initialization of the given RelativeTimeFormat object. Description The resulting object has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this
locale, the key-value pairs that were requested and are supported for this
locale are included in
locale. style The length of the internationalized message. Possible values are: "long" (default, e.g., in 1 month) "short" (e.g., in 1 mo.), or "narrow" (e.g., in 1 mo.). The narrow style could be similar to the short style for some
locales. numeric The format of output message. Possible val...
..."always" (default, e.g., 1 day ago), or "auto" (e.g., yesterday). The "auto" value allows to not always have to use numeric values in the output. numberingSystem The value requested using the Unicode extension key "nu" or filled in as a default. Examples Using the resolvedOptions method var de = new Intl.RelativeTimeFormat('de-DE'); var usedOptions = de.resolvedOptions(); usedOptions.
locale; // "de-DE" usedOptions.style; // "long" usedOptions.numeric; // "always" usedOptions.numberingSystem; // "latn" Specifications Specification Status Comment ECMAScript Internationalization API (ECMA-402)The definition of 'RelativeTimeFormat.resolvedOptions()' in that specification. Stage 4 ...
Intl.RelativeTimeFormat - JavaScript
formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.RelativeTimeFormat.RelativeTimeFormat() Creates a new Intl.RelativeTimeFormat object. Static methods Intl.RelativeTimeFormat.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.RelativeTimeFormat.prototype.format() Formats a value and a unit according to the
locale and formatting options of the given Intl.RelativeTimeFormat object. Intl.RelativeTimeFormat.prototype.formatToParts() Returns an Array o...
...ithout having to fall back to the runtime's default
locale. Instance methods Intl.RelativeTimeFormat.prototype.format() Formats a value and a unit according to the
locale and formatting options of the given Intl.RelativeTimeFormat object. Intl.RelativeTimeFormat.prototype.formatToParts() Returns an Array of objects representing the relative time format in parts that can be used for custom
locale-aware formatting. Intl.RelativeTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and formatting options computed during initialization of the object. Examples Basic format usage The following example shows how to use a relative time formatter for the English language. ...
...t can be used for custom
locale-aware formatting. Intl.RelativeTimeFormat.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and formatting options computed during initialization of the object. Examples Basic format usage The following example shows how to use a relative time formatter for the English language. // Create a relative time formatter in your
locale // with default values explicitly passed in. const rtf = new Intl.RelativeTimeFormat("en", {
localeMatcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // Format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // Format relative time using positive value (1)...
String - JavaScript
Comparing strings In C, the strcmp() function is used for comparing strings. In JavaScript, you just use the less-than and greater-than operators: let a = 'a' let b = 'b' if (a < b) { // true console.log(a + ' is less than ' + b) } else if (a > b) { console.log(a + ' is greater than ' + b) } else { console.log(a + ' and ' + b + ' are equal.') } A similar result can be achieved using the
localeCompare() method inherited by String instances. Note that a == b compares the strings in a and b for being equal in the usual case-sensitive way. If you wish to compare without regard to upper or lower case characters, use a function similar to this: function isEqual(str1, str2) { return str1.toUpperCase() === str2.toUpperCase() } // isEqual Upper case is used instead of lower case in this...
... with the characters of the string searchString. String.prototype.indexOf(searchValue [, fromIndex]) Returns the index within the calling String object of the first occurrence of searchValue, or -1 if not found. String.prototype.lastIndexOf(searchValue [, fromIndex]) Returns the index within the calling String object of the last occurrence of searchValue, or -1 if not found. String.prototype.
localeCompare(compareString [,
locales [, options]]) Returns a number indicating whether the reference string compareString comes before, after, or is equivalent to the given string in sort order. String.prototype.match(regexp) Used to match regular expression regexp against a string. String.prototype.matchAll(regexp) Returns an iterator of all regexp's matches. String.prototype.normalize([form]) ...
...calling string begins with the characters of string searchString. String.prototype.substr() Returns the characters in a string beginning at the specified location through the specified number of characters. String.prototype.substring(indexStart [, indexEnd]) Returns a new string containing characters of the calling string from (or between) the specified index (or indeces). String.prototype.to
LocaleLowerCase( [
locale, ...
locales]) The characters within a string are converted to lowercase while respecting the current
locale. For most languages, this will return the same as toLowerCase(). String.prototype.to
LocaleUpperCase( [
locale, ...
locales]) The characters within a string are converted to uppercase while respecting the current
locale. For most languages, this will return the s...
Destructuring assignment - JavaScript
whereas in its current form, you can simply call drawChart() without supplying any parameters. The current design is useful if you want to be able to call the function without supplying any parameters, the other can be useful when you want to ensure an object is passed to the function. ...
...ion. ...
... {
locale: 'de', localization_tags: [], last_edit: '2014-04-14T08:43:37', url: '/de/docs/Tools/Scratchpad', title: 'JavaScript-Umgebung' } ], url: '/docs/Tools/Scratchpad' }; let { title: englishTitle, // rename translations: [ { title:
localeTitle, // rename }, ], } = metadata; console.log(englishTitle); // "Scratchpad" console.log(
localeTitle); // "JavaScript-Umgebung" For of iteration and destructuring const people = [ { name: 'Mike Smith', family: { mother: 'Jane Smith', father: 'Harry Smith', sister: 'Samantha Smith' }, age: 35 }, { name: 'Tom Jones', family: { mother: 'Norah Jones', father: 'Richard Jones', brother: 'Howard Jones' }, age: 25 } ]; ...
XUL Migration Guide - Archive of obsolete content
ectly modify the browser chrome. XUL Windows XUL windows are used to define completely new windows to host user interface elements specific to the add-on. The SDK generally expects you to specify your user interface using HTML, not XUL. However, you can include a chrome.manifest file in your add-on and it will be included in the generated XPI. my-addon/ chrome/ content/
locale/ skin/ chrome.manifest data/ lib/ package.json There are limitations on what you can do in this manifest file: for example, you can't register overlays, resource: URIs, or components. However, you can register a chrome: URI, with a skin and
locale, and this means you can include XUL windows in an SDK-based add-on. You can keep the "chrome.manifest" file in your add-on's...
...n do in this manifest file: for example, you can't register overlays, resource: URIs, or components. However, you can register a chrome: URI, with a skin and
locale, and this means you can include XUL windows in an SDK-based add-on. You can keep the "chrome.manifest" file in your add-on's root directory and create a directory there called "chrome". In that directory you can keep your "content", "
locale", and "skin" subdirectories: This allows you to refer to objects in these directories from "chrome.manifest" using a relative path, like "chrome/content". This is provided only as a migration aid, and it's still a good idea to port XUL windows to HTML. Content Scripts In a XUL-based add-on, code that uses XPCOM objects, code that manipulates the browser chrome, and code that interacts with...
jpmignore - Archive of obsolete content
ple directory from the xpi generated by jpm xpi. Using .jpmignore to allow files Everything in your add-on directory will be included in the xpi file you make with jpm xpi. If your project folder contains a lot of files that aren't necessary for the xpi to run, like documentation, jshint, etc., you can use .jpmignore as a whitelist instead of a blacklist. ...
...a whitelist instead of a blacklist. For example: .* * !/data/** !/lib/** !/
locale/** !/node_modules/** !/package.json !/icon.png !/icon64.png !/COPYING !/bootstrap.js !/install.rdf This would include all editor backup files and similar in the whitelisted subdirectories, to avoid that you can append another blacklist after the whitelist. ...
Miscellaneous - Archive of obsolete content
has myext.properties with name/value pairs such as: invalid.url=The speficied URL, %S, is invalid. That was attempt number %S. ...
... return this._bundle.GetStringFromName(msg); } }; alert(common.getLocalizedMessage("invalid.url")) Another similar alternative (using both GetStringFromName and formatStringFromName), is: var fcBundle = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService) .createBundle("chrome://myext/
locale/myext.properties"); function getStr(msg, args){ //get localised message if (args){ args = Array.prototype.slice.call(arguments, 1); return fcBundle.formatStringFromName(msg,args,args.length); } else { return fcBundle.GetStringFromName(msg); } } /* Usage */ alert(getStr("invalid.url", "http://bad/url/", "3")); //for message with parameters alert(getStr("invalid.url")); //for me...
The Box Model - Archive of obsolete content
g the value attribute: <description>&xulschoolhello.description.label;</description> Even then, the text will extend as much as it can in a single line, so you need to add some CSS limits in order to make it wrap inside a XUL dialog or window. You can use the CSS property width to restrict the width of the description so that it wraps as you need it to. Never cut text lines into separate
locale strings in order to bypass wrapping difficulties. This makes localization much harder, or even impossible in some cases. There are other more complicated text wrapping cases where a description won't be good enough. For instance, templates don't allow you to set the internal text in a description element in a way that it wraps properly. One way to work around this is using a textbox element in...
... to the label, and add an onclick handler (oncommand won't work for this). The label is displayed with the expected link style so that users can easily recognize it as a link. A trickier case is when you need only part of a label to be clickable, just like in HTML. Since labels can't handle rich text, workarounds have to implemented using Javascript. One possibility is to use special markup in a
locale property so that the link can be easily recognized: xulschoolhello.linkedText.label = Go to <a>our site</a> for more information The syntax is similar to HTML because it's easier to read this way, but string bundles won't do anything special with it. You'll have to break the string using regular expressions and generate 3 different labels, one with the text-link class. You'll also need to d...
Index of archived content - Archive of obsolete content
andLine Components Creating XULRunner Apps with the Mozilla Build System Creating a Windows Inno Setup installer for XULRunner applications Custom app bundles for Mac OS X Debugging a XULRunner Application Deploying XULRunner Dialogs in XULRunner Getting started with XULRunner How to enable
locale switching in a XULRunner application MacFAQ Make your xulrunner app match the system
locale Opening a Link in the Default Browser Specifying Startup Chrome Window Using Crash Reporting in a XULRunner Application Using LDAP XPCOM with XULRunner Using SOAP in XULRunner 1.9 What XULRunner Provides ...
...ternals Tamarin Tracing Build Documentation The Basics of Web Services Themes Building a Theme Common Firefox theme issues and solutions Creating a Skin for Firefox UUID contents.rdf install.rdf Making sure your theme works with RTL
locales Theme changes in Firefox 2 Theme changes in Firefox 3 Theme changes in Firefox 3.5 Theme changes in Firefox 4 Updating an extension to support multiple Mozilla applications Using Firebug and jQuery (Screencast) Using IO Timeout And Interrupt On NT Using SSH to connect to CVS Using Web Sta...
registerChrome - Archive of obsolete content
registerChrome Registers chrome with the chrome registry. Method of Install object Syntax int registerChrome( SWITCH, srcDir, xpiPath); Parameters The registerChrome method has the following parameters: SWITCH SWITCH is the chrome switch indicating what type of file is being registered. SKIN is used to register skins,
LOCALE is used to register language packs. PACKAGE, a third possibility is the equivalent of SKIN AND/OR
LOCALE, and ensures that everything in the XPI is registered. One final option for the switch parameter is DELAYED_CHROME, which registers the switch only after a relaunch of the browser. Note that you can combine switches as in the example below. srcDir srcDir is a FileSpecObject representing the source destination of the installa...
...can combine switches as in the example below. srcDir srcDir is a FileSpecObject representing the source destination of the installation. FileSpecObjects like that required by this function are created using the getFolder method on the Install object. xpiPath xpiPath is the path within the XPI in where the contents.rdf file defining the chrome is located. For example, "
locale/my
Locale/aim," points to the
locale/my
Locale/aim subdirectory of the same XPI file in which the installation script is located. Returns An integer error code. For a list of possible values, see Return Codes. In some situations the method may return other errors. In a few cases you may get a registry error. Description When the third parameter is omitted (pointing to a specific location within t...
A XUL Bestiary - Archive of obsolete content
's package hierarchy. Like a chrome, that chunk usually contains XUL content, CSS and graphic skin information, localization strings, and maybe some platform-specific code. The navigator is a package defined in mozilla/bin/chrome/navigator, the mail/news component is a package in mozilla/bin/chrome/mailnews/, and so on. Each package directory typically has three subdirectories, content, skin, and
locale, in which the XUL, CSS, and localization information are defined, respectively: navigator/ content/ default/ navigator.xul ... skin/ default/ navigator.css nav-icon.gif ...
locale/ US-en/ navigator.dtd The default directory underneath each of these main package subdirectories is assumed in the chrome URL (i.e. chrome://help/content/help.xul...
...ate a different skin for the navigator package, you can create a subdirectory underneath navigator/skin/ whose contents will be loaded instead of default's. So the following structure obtains: navigator/ content/ default/ navigator.xul ... skin/ default/ navigator.css nav-icon.gif ... myNewSkin/ newskin.css newgifs.gif ...
locale/ US-en/ navigator.dtd To load chrome information stored in a new package directory like this, you can use the following chrome URL, chrome://navigator/skin/myNewSkin/newskin.css Which in turn loads the graphics in that subdirectory as needed. Skin The skin is the CSS and graphics that makes up the look or presentation of XUL. XUL itself contains very little provision for how widg...
Introduction to XUL - Archive of obsolete content
ument to be a window. So currently, a single XUL file must contain a single window. <?xml version="1.0"?> <?xml-stylesheet href="xul.css" type="text/css"?> <!DOCTYPE window> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> ... </window> We would like to head more toward the "package" implementation in the future. Internationalization For practical reasons, the
locale-specific attributes of a UI description would be most happily developed (and possibly distributed) in separate files, where localization can be performed by altering only a subset of the UI description devoted expressly to localization issues. That is, a separate file of localized strings. Internationalization is discussed more completely in the XUL Coding Style Guidelines document. In brief, Mo...
...s, a separate file of localized strings. Internationalization is discussed more completely in the XUL Coding Style Guidelines document. In brief, Mozilla has settled on XML entities as the mechanism. Entities are a feature of the language and therefore outside the scope of this paper. A XUL file can be made localizeable very easily by substituting entities for any content which may change as the
locale changes. The localized text must be defined in a separate DTD or DTD fragment. The whole system is then configured with different
locale-specific DTDs, and the correct DTD will be chosen for a given XML file at runtime, depending on the current
locale settings. Mozilla will make that decision automatically if the localized XML file specifies its DTD using a chrome URL, as outlined in XUL Localiza...
Positioning - Archive of obsolete content
the lower edge of the menu or button it is associated with. Horizontally, the left edge of the menu popup is aligned with the left edge of the menu or button. A submenu, however, is placed by default to the right of the parent menu item, such that the top edge of the menu is aligned with the top edge of the parent menu item. However, the submenu will appear to the left instead for right to left
locales. For both top level menus and submenus, they may appear above or to the left instead of their usual placement if there is not enough room to display the menu at full size below or to the right. If there is not enough room on either side, the menu will be shrunk down to fit. For popups attached using the popup or context attributes, the default position to appear is with the upper left corner (...
...us, they may appear above or to the left instead of their usual placement if there is not enough room to display the menu at full size below or to the right. If there is not enough room on either side, the menu will be shrunk down to fit. For popups attached using the popup or context attributes, the default position to appear is with the upper left corner (or upper right corner in right to left
locales) at the position where the mouse was clicked. Context menus will appear offset down and to the right a couple of pixels so that the menu can be dismissed again just by clicking in the same place. If a context menu was opened via the keyboard only, the menu will appear at the top left corner of the document, or underneath the currently selected item if a list is focused. Context menus will alway...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
s:chrome="http://www.mozilla.org/rdf/chrome#"> <RDF:Seq RDF:about="urn:mozilla:package:root"> <RDF:li RDF:resource="urn:mozilla:package:custombutton"/> </RDF:Seq> <RDF:Description RDF:about="urn:mozilla:package:custombutton" chrome:displayName="Custom Button" chrome:description="My custom toolbar button" chrome:author="My name" chrome:name="custombutton" chrome:
localeVersion="1.8" chrome:skinVersion="1.5" chrome:extension="true"/> <RDF:Seq about="urn:mozilla:overlays"> <!-- browser --> <RDF:li> <RDF:Seq about="chrome://navigator/content/navigator.xul"> <RDF:li>chrome://custombutton/content/button.xul</RDF:li> </RDF:Seq> </RDF:li> <!-- address book --> <RDF:li> <RDF:Seq about="chrome://messenger/content...
...Save the file as contents.rdf and navigate to SeaMonkey\chrome again, following steps 2 and 3 as listed above. Restart SeaMonkey and type the chrome url: chrome://myapp/content/myapp...
Property Files - Archive of obsolete content
th a hash sign ('#') is treated as a comment: # This is a comment welcomeMessage=Hello, world! # This is another comment goodbyeMessage=Come back soon! Stringbundles You could write the code to read properties yourself, however XUL provides the stringbundle element which does this for you. The element has a number of functions which can be used to get strings from the property file and get other
locale information. This element reads in the contents of a property file and builds a list of properties for you. You can then look up a particular property by name. <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="strings.properties"/> </stringbundleset> Including this element will read the properties from the file 'strings.properties' in the same directory as the XUL file. Use ...
...he contents of a property file and builds a list of properties for you. You can then look up a particular property by name. <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="strings.properties"/> </stringbundleset> Including this element will read the properties from the file 'strings.properties' in the same directory as the XUL file. Use a chrome URL to read a file from the
locale: <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="chrome://myplugin/
locale/strings.properties"/> </stringbundleset> Like other non-displayed elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. Getting a String from the Bundle This stringbundle element has a number of properties. The first is getString whic...
Using multiple DTDs - Archive of obsolete content
finition) to localize a specific XUL file. But there are situations where you want to use multiple DTDs, for example to localize common widgets used in all your XUL files, additionally to the ones specific to the file. Single DTD To make strings in your XUL file localizable, you normally add a DTD declaration at the beginning of the file like this: <!DOCTYPE window SYSTEM "chrome://myextension/
locale/mainwindow.dtd"> where "window" is the local name of the document (root) element. Assuming you have an entity called someButton.label defined in mainwindow.dtd, you can access the entity like this: <button id="somebutton" label="&someButton.label"> Multiple DTDs If you want to use multiple DTDs with your XUL file, you can simply list all of the DTDs inside your DTD declaration: <!DOCTYPE ...
...cument (root) element. Assuming you have an entity called someButton.label defined in mainwindow.dtd, you can access the entity like this: <button id="somebutton" label="&someButton.label"> Multiple DTDs If you want to use multiple DTDs with your XUL file, you can simply list all of the DTDs inside your DTD declaration: <!DOCTYPE window [ <!ENTITY % commonDTD SYSTEM "chrome://myextensions/
locale/common.dtd"> %commonDTD; <!ENTITY % mainwindowDTD SYSTEM "chrome://myextension/
locale/mainwindow.dtd"> %mainwindowDTD; ]> You can now access the entities declared in the DTDs as shown above. Assume you have an entity okButton.label defined in file common.dtd. Then accessing entities from both DTDs would look like this: <button id="somebutton" label="&someButton.label"> ... <button id="ok...
Application Update - Archive of obsolete content
re details // pref("app.update.mode", 1); // If set to true, the Update Service will present no UI for any event. pref("app.update.silent", false); // Update service URL: // You do not need to use all the %VAR% parameters. Use what you need, %PRODUCT%,%VERSION%,%BUILD_ID%,%CHANNEL% for example pref("app.update.url", "https://yourserver.net/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%
LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); // URL user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://yourserver.net/yourpage"); // A default value for the "More information about this update" link // supplied in the "An update is available" page of the update wizard. pref("app.update.url...
...mpler approach of not using the update php script. HTTPS is recommended but not required (yet). update.xml The format is outlined here Process As best I can tell here's how the update process works. At the scheduled interval the application checks the update server for update.xml, search for the correct one using the Software name, versions, build id's, channels, and other information like
locales. If the update.xml file doesn't exist there is no update. Update.xml contains only information about the update. It points to the update mar file (a Mozilla Archive) which contains all files which are going to be updates It also contains a SHA1 hash and file size used for verification of the update. If an update file is found that correctly describes an update your application, ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
to be used by your app on OS X. The chrome/ subdirectory Chrome for your application should be placed in the chrome/ subdirectory as described in XUL Tutorial:XUL Structure. Chrome will be packaged automatically by the build system, so you also need to specify which files get put into which packages by using JAR Manifests. In the case of McCoy, a separate manifest is used for content/, skin/ and
locale/. This also means that you will need to put a makefile in each directory. If you're lazy like me, you can also use one big JAR manifest in the chrome/ directory, which means you don't need to put makefiles in the chrome subdirectories either. You can make this jar.mn to rule them all just by concatenating the three files in the McCoy example and updating the path to each file (since you will need...
...em all just by concatenating the three files in the McCoy example and updating the path to each file (since you will need to point to the correct subdirectory): mccoy.jar: % content mccoy %content/ * content/mccoy.xul (content/mccoy.xul) content/mccoy.js (content/mccoy.js) * content/mccoy.xml (content/mccoy.xml) ...etc... Note that the
locale manifest uses a variable to specify the name of the
locale which has to be defined in the makefile (and you need to say #filter substitution in the manifest for the variable to be expanded). You will also need to include a branding/ subdirectory. Follow the example in McCoy carefully since XULRunner is sensitive about having exactly the right files in exactly the right packages. The components/ s...
Windows and menus in XULRunner - Archive of obsolete content
the basic windowing element in XUL. It has attributes to set the title/caption as well as to control its width and height. Although I have not seen it mentioned yet, I am assuming that you can only have one <window> element per XUL file. Here is an example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://basicapp/skin/main.css" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://basicapp/
locale/main.dtd"> <window id="main" title="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="main.js"/> ... </window> Notice the references to CSS and DTD files. The CSS is used to apply formatting to elements, just as it would in HTML. The DTD is used to create entity references so strings for titles and labels are not stored directly in the XUL f...
...ns are complex enough to require some sort of menu and/or toolbar to structure the application's available commands. XUL provides elements to support both menus and toolbars. ...
Choosing the right approach - Learn web development
ent as requestAnimationFrame(), but allows you to choose a running rate/frame rate. Useful for... ...
... Code example The following function creates a new Date() object, extracts a time string out of it using to
LocaleTimeString(), and then displays it in the UI. We then run it once per second using setInterval(), creating the effect of a digital clock that updates once per second (see this live, and also see the source): function displayTime() { let date = new Date(); let time = date.to
LocaleTimeString(); document.getElementById('demo').textContent = time; } const createClock = setInterval(displayTime, 1000); Pitfalls The frame rate isn't optimized for the system the animation is running on, and can be somewhat inefficient. Unless you need to choose a specific (slower) framerate, it is generally better to use requestAnimationFrame(). Browser compatibility DesktopMobileChrom...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
n you pass as the first parameter is executed repeatedly at no less than the number of milliseconds given by the second parameter apart, rather than once. You can also pass any parameters required by the function being executed as subsequent parameters of the setInterval() call. Let's look at an example. ...
...example. The following function creates a new Date() object, extracts a time string out of it using to
LocaleTimeString(), and then displays it in the UI. It then runs the function once per second using setInterval(), creating the effect of a digital clock that updates once per second (see this live, and also see the source): function displayTime() { let date = new Date(); let time = date.to
LocaleTimeString(); document.getElementById('demo').textContent = time; } const createClock = setInterval(displayTime, 1000); Just like setTimeout(), setInterval() returns an identifying value you can use later when you need to clear the interval. Clearing intervals setInterval() keeps running a task forever, unless you do something about it. You'll probably want a way to stop such tasks, otherwi...
Mozilla Content Localized in Your Language
The content here should be what you and your localization team have decided, together, to follow when localizing Mozilla products and web sites. You are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. All we ask is that you name this page according to this example, "Mozilla Content in Spanish (es-MX)" and add your
locale code tag at the bottom. Enjoy developing your style guide! Your language's style guide Abbreviations How are abbreviations expressed in your language? Numerals and metrics How are numerals and metrics expressed in your language? Formal and informal forms, and separators (, or .) Date Format What are the date formats for weeks and months are expressed in the following forms: 1)fully spell...
...ng, Punctuation, Capitalization, Diacritics, Typography, Unpaired brackets or quote marks, whitespace. Include a note to look for, reference, and adhere to a national standard for the language, where possible. Add Style :: Register, Variants/slang, Awkward, Company style (branding guidelines), Inconsistent style, Third-party style, Unidiomatic (steps to define your approach to culture-specific &
locale-specific references) ...
Patching a Localization
face it, you deserve it for all of your work), and visit the L10n Prerequisites page. There you'll learn what tools you need, where to find them, and how to install them. Get the source First, you need to get the source for the localization in question using its two or three character ISO language code. For our example, I'll use gl (Galician). Whenever you see gl in blue text, replace it with the
locale code for your language. Next thing you need to know is which localization version you want to patch. All of our localizations work on the Aurora branch. The repository for this version is releases/l10n/mozilla-aurora. For more information about branches see L10n:Branches. Now let's get a little more detailed. Start bash and do the following: Create a clean directory for your work. For exa...
...0n:Branches. Now let's get a little more detailed. Start bash and do the following: Create a clean directory for your work. For example, create a directory like localization-workdir (in this example it is located in your home directory): mkdir ~/localization-workdir Navigate to the directory you just created. cd ~/localization-workdir Clone the localization repository for your
locale and for the version you want to patch: hg clone http://hg.mozilla.org/releases/l10n/mozilla-aurora/gl Now that you have the code and your working directory, edit the DTD and properties files to make your necessary changes. Creating a l10n patch You've made your changes, now create your patch. Navigate to your working localization directory. cd ~/localization-workdir/gl Create a patc...
Release phase
o the original intent of this guide and only present you with the technical information you need to become an official release. We'll primarily focus on getting your release repository setup and the Mercurial commands you'll need to know to use that repository. For more information on the release part of the L10n process, visit the Mozilla wiki here. Your official release repository Now that your
locale has been registered, the localization files will live on Mozilla Mercurial server at hg.mozilla.org. Depending on which branch you work on, the URL of your repository might look like this: http://hg.mozilla.org/releases/l10n-central/x-testing If you followed the Koala or plain text approach, you probably already have a local clone of the repository. Otherwise, in order to be able to make any cha...
... ask for technical review of your work or a sign-off review? Do you know what what exactly is reviewed in each process? Technical and sign-off reviews apply to different localizations in different ways. Here's the basic difference between the two. Technical review Sign-off review Performed as a QA measure on a revision pushed to a new
locale's L10n aurora repo in Mercurial. Very comprehensive. Covers the entire product. Focus is on technical accuracy and completion of L10n work; not translation quality. Only performed on the first revision a new
locale wants to have released to the public. Must be approved prior to migrating your revision from one release channel to the next (e.g., Aurora to Be...
Translation phase
e "Mozilla Application Suite", containing a web browser, a mail and newsgroups client, an HTML editor, web development tools, and an IRC chat client. Firefox Mobile By adding Firefox(R) to your mobile phone, you can access rich Web content and enjoy your favorite Firefox features wherever you go. Lightning Lightning is a popular calendaring, scheduling and task management extension. If your
locale has an hg repository hosted on the Mozilla servers, you can track your localization's current progress by visiting the l10n dashboards. Note: If you are starting a new localization and decide to use an offline tool for localizing Mozilla applications, you will need to become familiar with using Mercurial (hg). Visit the tutorial on using hg in your localization efforts here. Mozilla websites...
... essentially the same. This tutorial should provide you with all of the technical information you need to secure and maintain your tool independence. Productization Productization is an essential part of localizing Mozilla products. This is where you research and select the search plugins, content and protocol handlers, bookmarks, and links to recommended sites on the in-product pages that your
locale's users will find in their Mozilla products. This tutorial will walk you through performing these productization tasks, creating productization patches, and submitting them for review. << PreviousNext >> ...
Creating localizable web content
tring for localizers Check that we don't link in new pages to sub-pages with anchors. E.g.: a new page is announced with only 100 words but it is actually content added to an existing page in English. Happens for things like Faq, or video pages for example. For video, use the code to display the video in an overlayed video player on the page instead of linking to a video section in English. Per-
locale customizations Check if there are alternative links for localized pages (e.g., links to MDN, Addons.mozilla.org, or other external resources, are there translated equivalents we can use). If there are alternatives, use them by adding the $lang; parameter in the urls Evaluate the impact of new pages on all our web properties, especially links to community sites and redirects. Sometimes you can...
...ly links to community sites and redirects. Sometimes you can leave some freedom of modification for a block of text so that the localizers link to relevant local resources. Images Check that images are not going to be a problem for the audience (cultural references, positionning, mirroring for rtl, text in images...) and spot what sizes/margins can be tweaked by CSS or have to be fixed for all
locales but English Don't use text in icons Images 1&2. Bad: Image 3. Good: Image 4. Good: This icon is recognized as the international symbol for information. It can stay this way. Use localized screenshots if possible Screenshots are important informative graphics, often times explaining how to achieve something in a desktop or web application. As such, they should be perceived ...
Writing localizable code
content code and reference different key-value pairs in l10n. Use a good source directory structure Be sure to put the localizable files in the right place. The addition of new top-level directories is a compromise between module ownership in the cvsroot repository and the ease of localization. Use a good chrome directory structure For a particular module mod, a target path jar:ab-CD.jar!/
locale/ab-CD/mod/foo.dtd has been widely tested and is a good place for your files referenced as chrome://mod/
locale/foo.dtd. Using a directory structure like this eases the localization process without the source code and is especcially recommended to extension authors. JAR Manifests can make this easy. l10n impact On frozen trees, there is the rule to not check in l10n-impact changes. So what does th...
...No change means that this query result is empty. ...
Index
eference(2), SpiderMonkey JS_GetLatin1InternedStringChars and JS_GetTwoByteInternedStringChars gets the characters of the string, str. 314 JS_GetLatin1StringCharsAndLength JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_GetLatin1StringCharsAndLength and JS_GetTwoByteStringCharsAndLength get the characters and the length of the string, str. 315 JS_Get
LocaleCallbacks JSAPI Reference, SpiderMonkey JS_Set
LocaleCallbacks establishes
locale callbacks. The pointer must persist as long as the JSRuntime. Passing nullptr restores the default behaviour. 316 JS_GetNaNValue JSAPI Reference, SpiderMonkey JS_GetNaNValue returns a value of type JS::Value that represents an IEEE floating-point quiet Not-a-Number (NaN). 317 ...
...nt will be named "<unknown>"</unknown>. 451 JS_SetContextCallback JSAPI Reference, SpiderMonkey JS_SetContextCallback specifies a callback function that is automatically called when JSContexts are created or destroyed. Only one callback function may be specified per JS runtime. This function returns the previous context callback, if any, else NULL. 452 JS_SetDefault
Locale JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_SetDefault
Locale sets the default
locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). 453 JS_SetDestroyCompartmentCallback JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_SetDestroyCompartmentCallback sets callback function which will be called...
JSAPI reference
ents Added in SpiderMonkey 17 JS_SetDestroyCompartmentCallback Added in SpiderMonkey 17 JS_SetCompartmentNameCallback Added in SpiderMonkey 17 JS_NewCompartmentAndGlobalObject Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 16 JS_EnterCrossCompartmentCall Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 18 JS_LeaveCrossCompartmentCall Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 18
Locale callbacks: struct JS
LocaleCallbacks JS_Get
LocaleCallbacks JS_Set
LocaleCallbacks
Locale callback types: JS
LocaleToUpperCase JS
LocaleToLowerCase JS
LocaleCompare JS
LocaleToUnicode Scripts Just running some JavaScript code is straightforward: class JS::CompileOptions Added in SpiderMonkey 17 class JS::OwningCompileOptions Added in SpiderMonkey 31 class JS::ReadonlyCompileOptions ...
...ifyStandardPrototype Added in SpiderMonkey 31 JS::IdentifyStandardInstanceOrPrototype Added in SpiderMonkey 31 JS::IdentifyStandardConstructor Added in SpiderMonkey 38 Date JS_NewDateObject Added in SpiderMonkey 1.8.5 JS_NewDateObjectMsec Added in SpiderMonkey 1.8.5 JS_ObjectIsDate Added in SpiderMonkey 1.8.5 JS_ClearDateCaches Added in SpiderMonkey 17 JS_Now Intl API JS_SetDefault
Locale Added in SpiderMonkey 24 JS_ResetDefault
Locale Added in SpiderMonkey 24 Properties These functions correspond directly to the ways scripts access object properties: JS_GetProperty JS_GetUCProperty JS_GetPropertyById Added in SpiderMonkey 1.8.1 JS_SetProperty JS_SetUCProperty JS_SetPropertyById Added in SpiderMonkey 1.8.1 JS_HasProperty JS_HasUCProperty JS_HasPropertyById Added in S...
IAccessible2
TR extendedRole ); [propget] HRESULT extendedStates([in] long maxExtendedStates, [out, size_is(,maxExtendedStates), length_is(, nExtendedStates)] BSTR extendedStates, [out] long nExtendedStates ); [propget] HRESULT groupPosition([out] long groupLevel, [out] long similarItemsInGroup, [out] long positionInGroup ); [propget] HRESULT indexInParent([out] long indexInParent ); [propget] HRESULT
locale([out] IA2
Locale locale ); [propget] HRESULT localizedExtendedRole([out] BSTR localizedExtendedRole ); [propget] HRESULT localizedExtendedStates([in] long maxLocalizedExtendedStates, [out, size_is(,maxLocalizedExtendedStates), length_is(, nLocalizedExtendedStates)] BSTR localizedExtendedStates, [out] long nLocalizedExtendedStates ); [propget] HRESULT nExtendedStates([out] long nExtendedState...
...s are valid. S_OK if at least one value is valid. indexInParent() Returns the index of this object in its parent object. [propget] HRESULT indexInParent( [out] long indexInParent ); Parameters indexInParent 0 based; -1 indicates there is no parent; the upper bound is the value returned by the parent's IAccessible::get_accChildCount. Return value S_FALSE if no parent, [out] value is -1. S_OK.
locale() Returns the IA2
Locale of the accessible object. [propget] HRESULT
locale( [out] IA2
Locale locale ); Parameters
locale Return value S_OK. localizedExtendedRole() Returns the localized extended role. [propget] HRESULT localizedExtendedRole( [out] BSTR localizedExtendedRole ); Parameters localizedExtendedRole Return value S_FALSE if there is nothing to return, [out] value is null. S_OK...
nsIChromeRegistry
ng that the filename portion of the URL is included, as in chrome://package/provider/file. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file" portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "
locale" package. void canonify( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be canonified. checkForNewChrome() Refreshes the chrome list at runtime, looking for new packages and so forth. void checkForNewChrome(); Parameters None. convertChromeURL() Resolves a chrome URL to an loadable URI using the information in the registry. A new nsIURI is returned; the original...
...l chrome URI, such as chrome://package/provider/file, and convert it into a canonical one. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file" portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "
locale" package. nsIURI convertChromeURL( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be converted. Return value A new nsIURI object containing the loadable URI for the specified chrome URL. Violates the XPCOM interface guidelines wrappersEnabled() Returns whether XPCNativeWrappers are enabled for the specified URI. boolean wrappersEnabled( in nsIURI aURI );...
nsIStringBundleService
ngBundle createBundle(in string aURLSpec); nsIStringBundle createExtensibleBundle(in string aRegistryKey); void flushBundles(); wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg); Methods createBundle() nsIStringBundle createBundle( in string aURLSpec ); Parameters aURLSpec The URL of the properties file to load. This is typically a
locale URL, e.g. chrome://global/
locale/global.properties Return value A string bundle corresponding to the properties file. This string bundle has functions available on it. On the return value object on you can call functions like GetStringFromName and formatStringFromName see nsIStringBundle. createExtensibleBundle() nsIStringBundle createExtensibleBundle( in string aRegistryKey ); Par...
...d formatStringFromName see nsIStringBundle. createExtensibleBundle() nsIStringBundle createExtensibleBundle( in string aRegistryKey ); Parameters aRegistryKey The name of the category under which the properties file(s) have been registered. Return value An extensible bundle corresponding to the properties file(s). flushBundles() Flushes the string bundle cache - useful when the
locale changes or when we need to get some extra memory back. (Automatically called for the memory-pressure and chrome-flush-caches global observer topics.) void flushBundles(); Parameters None. formatStatusMessage() Formats a message string from a status code and status arguments. Typically used to format a message received by a nsIProgressEventSink's onStatus method. wstring formatStatusMessage...
Storage
able of our mozIStorageConnection. mozStorageTransaction transaction(mDBConn); // Execute some statements. If we encounter an error, the transaction will // be rolled back. return transaction.Commit(); } Collation (sorting) SQLite provides several collation methods (BINARY, NOCASE, and RTRIM), but these are all very simple and have no support for various text encodings or the user's
locale. Gecko 1.9.2 added support for several new collation methods:
locale Case- and accent-insensitive collation.
locale_case_sensitive Case-sensitive, accent-insensitive collation.
locale_accent_sensitive Case-insensitive, accent-sensitive collation.
locale_case_accent_sensitive Case- and accent-sensitive collation. You can use them quite simply in your SELECT queries, like this: var ...
...You can find out more by reading SQLite's documentation on this. ...
Access StringBundle from Overlay
ndy for localizing your project by removing all of your strings into a separate, easy to access text file. Unfortunately adding the bundles into Thunderbird isn't as easy as adding them to your XUL overlay. ...
... var str = document.getElementById("your-extension-strings"); //get the stringbundle object itself str.getString("propertyName"); //get a string (and do something with it) Alternative way let stringBundleService = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService); let bundle = stringBundleService.createBundle("chrome://your_extension/
locale/overlay.properties"); let str = bundle.GetStringFromName("propertyName"); see nsIStringBundleService ...
Keyboard API - Web APIs
h as games or remote access apps that provide a full-screen immersive experience. Keyboard API concepts and usage Keyboard mapping On physical keyboards, the code attribute contains the physical location of the key that was pressed, and the key attribute contains the string generated by pressing the key at that physical location on the keyboard. The key value takes into account the keyboard's
locale (for example, 'en-US'), layout (for example, 'QWERTY'), and modifier-key state (Shift, Control, etc.). Historically there has been no way to retrieve that information. The Keyboard Map API provides a way to retrieve the string generated by a particular key press, through the Keyboard interface and the KeyboardLayoutMap interface. The Keyboard interface is accessed through navigator.keyboard. Key...
...ith "W" are sent to the app. The same applies to for KeyA, KeyS and KeyD. Writing system keys The codes passed Keyboard.lock and the various methods of the KeyboardLayoutMap interface are called "writing system keys". "Writing system keys" are defined in the Writing System Keys section of the UI Events KeyboardEvent code Values spec as the physical keys that change meaning based on the current
locale and keyboard layout. These keys are shown below. Blue keys are present on all standard keyboards while green keys are only available on some keyboards. Interfaces Keyboard Provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. KeyboardLayoutMap A map-like object with functions for retrieving the string associated with spe...
PaymentAddress.toJSON() - Web APIs
ags.Edge Full support 15Firefox Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO
locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari Full support YesWebView And...
...bled). To change preferences in Chrome, visit chrome://flags.Firefox Android Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO
locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS Full support YesSamsung Internet Android No support ...
PaymentCurrencyAmount.value - Web APIs
a valid decimal number; that is, some number of digits between 0 and 9 with up to one optional decimal point. An optional leading minus sign ("-") can be included to indicate a negative value, such as to represent a refund or discount. Important note: The number given in this string is always specified using the period (".") as the decimal point, rather than the comma (","), even if the user's
locale normally uses the comma. You must convert the entered text to this form or it will not be valid. Syntax value = paymentCurrencyAmount.value; Value A DOMString indicating the numeric value of the payment. This must be a valid decimal number, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit fol...
...ber, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit following it to represent fractional units. There must not be any leading or trailing whitespace in the string. For uniformity and consistency, the value is always given using the period (".") as the decimal character, regardless of the user's
locale. You need to convert the value to this format before submitting the payment. See the example Verifying a properly formatted price below for a simple regular expression that can be used to validate the value string prior to submission. Examples Representing prices This example represents the price of $42.95 in US dollars: let itemPrice = { currency: "USD", value: "42.95" }; This example...
<input type="date"> - HTML: Hypertext Markup Language
he date entered in the input. The date is formatted according to ISO8601, described in Format of a valid date string in Date and time formats used in HTML. You can set a default value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> The displayed date format will differ from the actual value -- the displayed date is formatted based on the
locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. You can get and set the date value in JavaScript with the input element's value and valueAsNumber properties. For example: var dateControl = document.querySelector('input[type="date"]'); dateControl.value = '2017-06-01'; console.log(dateControl.value); // prints "2017-06-01" console.log(dateControl.valueAsNumber); // p...
...to 86,400,000 times the step value (the underlying numeric value is in milliseconds). The default value of step is 1, indicating 1 day. Specifying any as the value for step has the same effect as 1 for date inputs. Using date inputs Date inputs sound convenient -- they provide an easy interface for choosing dates, and they normalize the data format sent to the server regardless of the user's
locale. However, there are currently issues with <input type="date"> because of its limited browser support. In this section, we'll look at basic and then more complex uses of <input type="date">, and offer advice on mitigating the browser support issue later (see Handling browser support). Hopefully, over time browser support will become ubiquitous, and this problem will fade away. Basic uses of d...
<input type="month"> - HTML: Hypertext Markup Language
ed in HTML. You can set a default value for the input control by including a month and year inside the value attribute, like so: <label for="bday-month">What month were you born in?</label> <input id="bday-month" type="month" name="bday-month" value="2017-06"> One thing to note is that the displayed date format differs from the actual value; most user agents display the month and year in a
locale-appropriate form, based on the set
locale of the user's operating system, whereas the date value is always formatted yyyy-MM. When the above value is submitted to the server, for example, it will look like bday-month=1978-06. You can also get and set the date value in JavaScript using the HTMLInputElement.value property, for example: <label for="bday-month">What month were you born in?</labe...
...ns. For month inputs, the value of step is given in months, with a scaling factor of 1 (since the underlying numeric value is also in months). The default value of step is 1 month. Using month inputs Date-related inputs (including month) sound convenient at first glance; they promise an easy UI for choosing dates, and they normalize the data format sent to the server, regardless of the user's
locale. However, there are issues with <input type="month"> because at this time, many major browsers don't yet support it. We'll look at basic and more complex uses of <input type="month">, then offer advice on mitigating the browser support issue in the section Handling browser support). Basic uses of month The simplest use of <input type="month"> involves a basic <input> and <label> element combin...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
for validation on the server side. Invalid values can still be sent by older browsers or by bad actors. Note: Firefox supported a proprietary error attribute -- x-moz-errormessage -- for many versions, which allowed you set custom error messages in a similar way. This has been removed as of version 66 (see bug 1513890). Localization The allowed inputs for certain <input> types depend on the
locale. In some
locales, 1,000.00 is a valid number, while in other
locales the valid way to enter this number is 1.000,00. Firefox uses the following heuristics to determine the
locale to validate the user's input (at least for type="number"): Try the language specified by a lang/xml:lang attribute on the element or any of its parents. Try the language specified by any Content-Language HTTP header...
... Technical summary Content categories Flow content, listed, submittable, resettable, form-associated element, phrasing content. If the type is not hidden, then labelable element, palpable content. Permitted content None, it is an empty element. Tag omission Must have a start tag and must not have an end tag. ...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
ory. Permitted parents Any element that accepts phrasing content. Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes Examples Basic example This example uses <tt> to show text entered into, and output by, a terminal application. ...
...You can override this using CSS by creating a rule using the tt selector, as seen in the example Overriding the default font above. User-configured changes to the default monospace font setting may t...
Array.prototype.sort() - JavaScript
ompare function: 700,80,9 Sorted with compareNumbers: 9,80,700 mixedNumericArray: 80,9,700,40,1,5,200 Sorted without a compare function: 1,200,40,5,700,80,9 Sorted with compareNumbers: 1,5,9,40,80,200,700 Sorting non-ASCII characters For sorting strings with non-ASCII characters, i.e. ...
...ting non-ASCII characters For sorting strings with non-ASCII characters, i.e. strings with accented characters (e, e, e, a, a, etc.), strings from languages other than English, use String.
localeCompare. This function can compare those characters so they appear in the right order. var items = ['reserve', 'premier', 'communique', 'cafe', 'adieu', 'eclair']; items.sort(function (a, b) { return a.
localeCompare(b); }); // items is ['adieu', 'cafe', 'communique', 'eclair', 'premier', 'reserve'] Sorting with map The compareFunction can be invoked multiple times per element within the array. Depending on the compareFunction's nature, this may yield a high overhead. The more work a compareFunction does and the more elements there are to sort, it may be more efficient to use map for sorting. The i...
Date.prototype.getTimezoneOffset() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateObj.getTimezoneOffset() Return value A number representing the time-zone offset, in minutes, from the date based on current host system settings to UTC. Description The time-zone offset is the difference, in minutes, from local time to UTC. ...
... current host system settings to UTC. Description The time-zone offset is the difference, in minutes, from local time to UTC. Note that this means that the offset is positive if the local timezone is behind UTC, and negative if it is ahead. For example, for time zone UTC+10:00 (Australian Eastern Standard Time, Vladivostok Time, Chamorro Standard Time), -600 will be returned. Current
Locale UTC-8 UTC UTC+3 Return Value 480 0 -180 The time zone offset returned is the one that applies for the Date that it's called on. If the host system is configured for daylight saving, the offset will change depending on the date and time that the Date represents and that daylight saving applies. Examples Using getTimezoneOffset() // Get current timezone off...
Intl.DisplayNames.prototype.of() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax displayNames.of(code); Parameters code The code to provide depends on the type: If the type is "region", code should be either an ISO-3166 two letters region code, or a three digits UN M49 Geographic Regions. If the type is "script", code should be an ISO-15924 four letters script code. ...
...If the type is "region", code should be either an ISO-3166 two letters region code, or a three digits UN M49 Geographic Regions. If the type is "script", code should be an ISO-15924 four letters script code. If the type is "language", code should be a languageCode ["-" scriptCode] ["-" regionCode ] *("-" variant ) subsequence of the unicode_language_id grammar in UTS 35's Unicode Language and
Locale Identifiers grammar. languageCode is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code. If the type is "currency", code should be a 3-letter ISO 4217 currency code. Return value A language-specific formatted string. Examples Using the of method let regionNames = new Intl.DisplayNames(['en'], {type: 'region'}); regionNames.of('419'); // "Latin Amer...
Intl.DisplayNames.prototype.resolvedOptions() - JavaScript
The Intl.DisplayNames.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and style formatting options computed during the construction of the current DisplayNames object. Syntax displayNames.resolvedOptions() Return value An object with properties reflecting the
locale and formatting options computed during the construction of the given DisplayNames object. Description The object returned by resolvedOptions() has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this
locale, the key-value pairs that were requested and are supported for this
locale are included in
locale. style The value provided for this property ...
... either "language", "region", "script", or "currency". fallback The value provided for this property in the options argument of the constructor or the default value ("code"). Its value is either "code" or "none". Examples Using resolvedOptions const displayNames = new Intl.DisplayNames(['de-DE'], {type: 'region'}); const usedOptions = displayNames.resolvedOptions(); console.log(usedOptions.
locale); // "de-DE" console.log(usedOptions.style); // "long" console.log(usedOptions.type); // "region" console.log(usedOptions.fallback); // "code" Specifications Specification Intl.DisplayNamesThe definition of 'resolvedOptions()' in that specification. ...
Intl.ListFormat.prototype.formatToParts() - JavaScript
The Intl.ListFormat.prototype.formatToParts() method returns an Array of objects representing the different components that can be used to format a list of values in a
locale-aware fashion. Syntax Intl.ListFormat.prototype.formatToParts(list) Parameters list An Array of values to be formatted according to a
locale. Return value An Array of components which contains the formatted parts from the list. Description Whereas Intl.ListFormat.prototype.format() returns a string being the formated version of the list (according to the given
locale and style options), formatToParts() returns an array of the different components of the formated string. Each element of the resulting array has two properties: type and value. The type property may be either "element", which refers to a value fr...
...the given
locale and style options), formatToParts() returns an array of the different components of the formated string. Each element of the resulting array has two properties: type and value. The type property may be either "element", which refers to a value from the list, or "literal" which refers to a linguistic construct. The value property gives the content, as a string, of the token. The
locale and style options used for formatting are given when constructing the Intl.ListFormat instance. Examples Using formatToParts const fruits = ['Apple', 'Orange', 'Pineapple']; const myListFormat = new Intl.ListFormat('en-GB', { style: 'long', type: 'conjunction' }); console.table(myListFormat.formatToParts(fruits)); // [ // { "type": "element", "value": "Apple" }, // { "type": "literal", "val...
Intl.ListFormat.prototype.resolvedOptions() - JavaScript
The Intl.ListFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the
locale and style formatting options computed during the construction of the current ListFormat object. Syntax listFormat.resolvedOptions() Return value An object with properties reflecting the
locale and formatting options computed during the construction of the given ListFormat object. Description The object returned by resolvedOptions() has the following properties:
locale The BCP 47 language tag for the
locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this
locale, the key-value pairs that were requested and are supported for this
locale are included in
locale. style The value provided for this property in the o...
... either "long", "short", or "narrow". type The value provided for this property in the options argument of the constructor or the default value ("conjunction"). Its value is either "conjunction", "disjunction", or "unit". Examples Using resolvedOptions const deListFormatter = new Intl.ListFormat("de-DE", { style: "short" }); const usedOptions = de.resolvedOptions(); console.log(usedOptions.
locale); // "de-DE" console.log(usedOptions.style); // "short" console.log(usedOptions.type); // "conjunction" (the default value) Specifications Specification Intl.ListFormatThe definition of 'resolvedOptions()' in that specification. ...
Intl.ListFormat - JavaScript
for objects that enable language-sensitive list formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constructor Intl.ListFormat() Creates a new ListFormat object. Static methods Intl.ListFormat.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.ListFormat.prototype.format() Returns a language-specific formatted string representing the elements of the list. Intl.ListFormat.prototype.formatToParts() Returns an array of objects representing the different components tha...
... Examples Using format The following example shows how to create a List formatter using the English language. ...
Intl.NumberFormat.prototype.formatToParts() - JavaScript
The Intl.Numberformat.prototype.formatToParts() method allows
locale-aware formatting of strings produced by NumberFormat formatters. Syntax Intl.NumberFormat.prototype.formatToParts(number) Parameters number Optional A Number or BigInt to format. Return value An Array of objects containing the formatted number in parts. Description The formatToParts() method is useful for custom formatting of number strings. It returns an Array of objects containing the
locale-specific tokens from which it possible to build custom strings while preserving the
locale-specific parts. The structure the formatToParts() method returns, looks like this: [ { type: "integer", value: "3" }, { type: "group", value: "." }, { type: "integer", value: "500" } ] Possible types are the following: curren...
...g format and formatToParts NumberFormat outputs localized, opaque strings that cannot be manipulated directly: var number = 3500; var formatter = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }); formatter.format(number); // "3.500,00 EUR" However, in many User Interfaces there is a desire to customize the formatting of this string. ...
Intl.PluralRules - JavaScript
The Intl.PluralRules object enables plural-sensitive formatting and plural-related language rules. Constructor Intl.PluralRules.PluralRules() Creates a new Intl.PluralRules object. Static methods Intl.PluralRules.supported
LocalesOf() Returns an array containing those of the provided
locales that are supported without having to fall back to the runtime's default
locale. Instance methods Intl.PluralRules.prototype.resolvedOptions() Returns a new object with properties reflecting the
locale and collation options computed during initialization of the object. Intl.PluralRules.prototype.select() Returns a String indicating which plural rule to use for
locale-aware formatting. Examples Using
locales This example shows some of the variations in localized plural rules. In order to...
... object. Intl.PluralRules.prototype.select() Returns a String indicating which plural rule to use for
locale-aware formatting. Examples Using
locales This example shows some of the variations in localized plural rules. ...
package.json - Archive of obsolete content
top-level module directory provided in this add-on. Defaults to "lib". Note: This is deprecated along with cfx and is not available when using jpm. license The name of the license under which the add-on is distributed, with an optional URL in parentheses. Defaults to "MPL-2.0". Note: It is recommended that you use an SPDX license ID.
locales An object holding JSON objects referenced by a
locale name that use the following keys: title, description and homepage. These JSON objects will be used to localizations for the add-on's meta data shown within the Add-ons Manager. See the documentation for how to localize the add-on's meta data. main A string representing the name of a program module that is loc...
File I/O - Archive of obsolete content
f DfltDwnld f The default Downloads directory (for example, ~/Downloads on Mac OS X). Home f The user's home directory (for example, /home/username). PrefD f Directory containing user prefs PrfDef d %installation%/defaults/pref ProfD f The profile directory. profDef d The profile defaults of the "current"
locale. Should be the first choice. ProfDefNoLoc d %installation%/defaults/profile - The profile defaults of the "default" installed
locale. Second choice when profDef is not available. ProfLD f Local Settings on Windows; where the network cache and fastload files are stored. Progs d User Start menu programs directory (for example, C:\Documents and Settings\u...
Enhanced Extension Installation - Archive of obsolete content
ds this value from the datasource and retrieves the Install Location from the hash of registered Install Locations. Item Type install.rdf Install Manifests should now specify a <em:type> property which tells the Extension System what their type is. Types are defined in nsIUpdateService.idl on the nsIUpdateItem interface. The types at the time of writing include: 2 - Extension 4 - Theme 8 -
Locale For backward compatibility the Extension System will continue to assume an item is an Extension by default, and a Theme if the item has a <em:internalName> property, but Extension and Theme authors should be good citizens and upgrade their Install Manifests to include the type. The type information supplied or inferred will be added to the Extensions datasource. Tracking Item Type We still t...
Extension Versioning, Update and Compatibility - Archive of obsolete content
splayed to the user. Since it is being displayed outside of a normal webpage context it is heavily sanitized, which means there are few formatting options available and scripting and images aren't allowed. The information page retrieved must currently be totally valid XHTML, including being delivered with the MIME type application/xhtml+xml (Important: see Problems section) You may include %APP_
LOCALE% in your updateInfoURL if you want to have
locale information included in the URL -- this allows you to customize the text based on the user's
locale. You may also use the other substitution strings supported by updateURL, although those may be less useful. Formatting Prior to Firefox 4 Prior to Firefox 4 you could only use the following tags, any other tags have themselves and their contents c...
Sorting Results - Archive of obsolete content
alphabetically but before it when sorted chronologically. For RDF datasources, another way to sort by dates is to use the the parseType="Date" construct in the RDF datasource. This marks a literal as being a date value rather than a string. The builder will recognize this and sort chronologically instead. This also has the advantage that the dates will be displayed according to the user's current
locale (meaning that the date is formatted so as to be suitable for the user's language). Here is a sample of how to specify this in the RDF/XML datasource: <rdf:RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:r="http://www.xulplanet.com/rdf/" xmlns:nc="http://home.netscape.com/NC-rdf#"> <rdf:Description rdf:about="ht...
The Joy of XUL - Archive of obsolete content
ion logic. This poses a significant problem in team environments because the skills required to develop these two parts are often satisfied by different people. XUL provides a clear separation among the client application definition and programmatic logic ("content" consisting of XUL, XBL, and JavaScript), presentation ("skin" consisting of CSS and images), and language-specific text labels ("
locale" consisting of DTDs and string bundles in .properties files). The layout and appearance of XUL applications can be altered independently of the application definition and logic. Further, the application can be localized for different languages and regions independently of its logic or presentation. This degree of separation results in applications that are easier to maintain by programmers a...
Accesskey display rules - Archive of obsolete content
cter of the label is an ellipsis or a colon, the accesskey text is inserted before them. I.e., when an accesskey of "Open..." is 'A', the generated label will be "Open (A)...". And also when an accesskey of "Your Name:" is 'B', the generated label will be "Your Name (B):". This document calls the appended text "accesskey text". Always appends accesskey text The basic rules are enough for Western
locales. However, in some
locales, e.g., Japanese localized build, its most UI labels don't have alphabets but alphabets are used to accesskey. For coherence of the labels on such localized builds, the accesskey text is always appended even if the labels have their accesskey characters. E.g., when an accesskey of "OK" is 'O' and an accesskey of "?????" (means "cancel") is 'C', the labels will be "OK(O)"...
Creating an Installer - Archive of obsolete content
provided with Mozilla are stored in this manner. Because the XPI file is just a special ZIP file, you can create it and add files to it using a zip utility. Our find files example For the find files dialog, we'll create a structure in the archive much like the following: install.js findfile content contents.rdf findfile.xul findfile.js skin contents.rdf findfile.css
locale contents.rdf findfile.dtd A directory has been added for each part of the package, the content, the skin and the
locale. The contents.rdf files have also been added because they will be needed to register the chrome files. Next, we'll look further at the install script. << PreviousNext >> ...
Cross Package Overlays - Archive of obsolete content
installed, there will be no New Message command. However, if Mail is installed, an overlay will be applied to the menu to add the New Message command. Below, we'll add a find files toolbar to the browser. It probably wouldn't be useful to have this feature, but we'll do it anyway. Mozilla allows you to add a list of overlays to the contents.rdf file that you use to list chrome packages, skins and
locales. Once you have created an overlay, you can add it to the contents.rdf file. Then add items, one for each window that you want the overlay to apply to. Our find files example First, let's create a simple overlay. It will just have a few elements for entering a filename and directory to search. Call the file foverlay.xul and add it to the findfile directory along with findfile.xul. Our fove...
Features of a Window - Archive of obsolete content
the window will still open at this size and there will be blank space in the remaining area. If there are too many elements, the window will not be large enough to fit the elements. The user will have to resize the dialog. You have to be careful when specifying a width and height that the window is not too small or too big. You should also consider that a user might be using a different theme or
locale. Note that you must specify both the width and the height. If you only specify one, the other will be set to 0. To have the window set its size automatically, leave both the width and height out. The width and height only specify the initial size of the window. The user may still resize the window to another size, assuming that the window is resizable. Other Window Features The flags below ca...
XUL Tutorial - Archive of obsolete content
Observers Document Object Model Document Object Model Modifying a XUL Interface Manipulating Lists Box Objects XPCOM Interfaces XPCOM Examples Trees Trees More Tree Features Tree Selection Custom Tree Views Tree View Details Tree Box Objects RDF and Templates Introduction to RDF Templates Trees and Templates RDF Datasources Advanced Rules Persistent Data Skins and
Locales Adding Style Sheets Styling a Tree Modifying the Default Skin Creating a Skin Skinning XUL files by hand Localization Property Files Bindings Introduction to XBL Anonymous Content XBL Attribute Inheritance Adding Properties Adding Methods Adding Event Handlers XBL Inheritance Creating reusable content using CSS and XBL XBL Example Specialized Window Types Features of a...
Using Visual Studio as your XUL IDE - Archive of obsolete content
S and ExtXml. Make sure that Visual Studio is not running, when you do this. 5. Problems that need to be solved There are still some problems for which I did not find a solution yet. 5.1 Localization using DTD You will get validation errors in Visual Studio, if you are localizing your XUL files. That has to do with the way Mozilla implemented localization: < !DOCTYPE window SYSTEM "chrome://loomo/
locale/main.dtd"> Visual Studio doesn't recognize the chrome URI prefix, what will give you an error at the previous line ("The URI prefix is not recognized"). As VS doesn't know how the chrome protocol works it can't detect where the dtd file is really located and thus will give you errors wherever you use the entities that are declared in this file. 5.2 Text preprocessor The Mozilla Build System incl...
button - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
caption - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
checkbox - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
datepicker - Archive of obsolete content
te out entirely. Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. firstdayofweek Type: integer which day of the week to display as the first day in the grid. The values range from 0 to 6, where 0 is Sunday and 6 is Saturday. The default value is determined by the
locale, so only use this attribute if you want to override it. readonly Type: boolean If set to true, then the user cannot change the value of the element. However, the value may still be modified by a script. tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex a...
description - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
dialogheader - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
label - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
listcell - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
listitem - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
menu - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
menuitem - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
menulist - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
menuseparator - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
radio - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
resizer - Archive of obsolete content
nce: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> Attributes dir Type: one of the values below The direction that the window is resized. left Resized to the left. right Resized to the right. top Resized up. bottom Resized down. bottomstart Resized down and toward the start of the line (toward the left for left-to-right
locales, toward the right for right-to-left
locales). bottomend Resized down and toward the end of the line (toward the right for left-to-right
locales, toward the left for right-to-left
locales). bottomleft Resized down and to the left. bottomright Resized down and to the right. topleft Resized up and to the left. topright Resized up and to the right. element Type: ...
<statusbarpanel> - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
tab - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
toolbarbutton - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
tooltip - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
treecol - Archive of obsolete content
Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. start The text will be cropped on its left side in left-to-right text
locales, and the right side in right-to-left
locales. end The text will be cropped on its right side in left-to-right text
locales, and the right side in right-to-left
locales. left The text will be cropped on its left side. right The text will be cropped on its right side. center ...
2006-09-29 - Archive of obsolete content
Summary: mozilla.dev.apps.calendar - September 22 - September 29, 2006 Announcements Lightning and Sunbird 0.3 RC1 TEST DAY! Clint announced the Lightning and Sunbird 0.3 RC1 TEST DAY Oct.3 to Oct. 4. Updated L10n status for Sunbird 0.3 release According to Simon Paquet, we now have a full l10n comparison on the trunk between en-US and all
locales with a calendar localization. Details are available for Calendar Only and for Calendar and Core. Discussions No Discussions available this week. Meetings Sept. 27 status meeting cancelled Most of the Mozilla Calendar participants were unavailable during Sept. 27, the meeting was cancelled and rescheduled for a later date. Sept 20 Brief Status Meeting The meeting consisted entirely of the status and details of Sunbird 0.3. Th...
2006-10-06 - Archive of obsolete content
n intense QA as outlined here. FFx 2 RC2 testing today L10n builds were completed was completed and ready for test. test resumt will be found here Another Lightning localization update with some bad news Difference has been located between SUNBIRD_0_3_BRANCH (for Sunbird 0.3) and MOZILLA_1_8_BRANCH. Sunbird/Lightning localization update You need to update your localization if you want your
locale to ship with Lightning 0.3 or Sunbird 0.3. MozillaTranslator 5.13 RFEs new version of MozillaTranslator will be relaesed in a few weeks. Calendar localization update RC1 for Sunbird 0.3 is out now and ready for testing. L10n locked down - FF2 RC2 Code Freeze 9/29/2006 at 9AM PDT the l10n repository is locked down. Discussions status update fx2 status update for firefox 2. Meeting...
MDN Web Docs Glossary: Definitions of Web-related terms
IPv4 IPv6 IRC ISO ISP ITU J Jank Java JavaScript JPEG jQuery JSON K Key Keyword L Latency Layout viewport Lazy load LGPL Ligature Local scope Local variable
Locale Localization Long task Loop Lossless compression lossy compression LTR (Left To Right) M Main Axis Main thread markup MathML Media Media (Audio-visual presentation) Media (CSS) Metadata Method Microsoft Edge Microsoft Internet Exp...
Client-side form validation - Learn web development
em. Implementing a customized error message As you saw in the HTML5 validation constraint examples earlier, each time a user tries to submit an invalid form, the browser displays an error message. The way this message is displayed depends on the browser. These automated messages have two drawbacks: There is no standard way to change their look and feel with CSS. They depend on the browser
locale, which means that you can have a page in one language but an error message displayed in another language, as seen in the following Firefox screenshot. Customizing these error messages is one of the most common use cases of the constraint validation API. Let's work through a simple example of how to do this. We'll start with some simple HTML (feel free to put this in a blank HTML file; use a ...
Strategies for carrying out testing - Learn web development
efox for Windows/Mac, Safari for Mac, Edge and IE for Windows (last two versions of each), iOS Safari for iPhone/iPad, Android stock browser (last two versions) on phone/tablet, Chrome and Firefox for Android (last two versions) on phone tablet B grade: IE 9 for Windows C grade: n/a If you live somewhere else, or are working on a site that will serve somewhere else (e.g. certain countries, or
locales), then you will probably have different common browsers to test. Note: "The CEO of my company uses a Blackberry, so we'd better make sure it looks good on that" can also be a persuasive argument. Browser support stats One helpful measure you can call on to inform your browser testing choices is browser support stats. There are a number of sites that provide such stats, for example: Netma...
Learn web development
only, they are used for collecting data from users, or allowing them to control a user interface. In the articles listed below, we'll cover all the essential aspects of structuring, styling, and interacting with web forms. Accessibility -- make the web usable by everyone Accessibility is the practice of making web content available to as many people as possible regardless of disability, device,
locale, or other differentiating factors. This topic gives you all you need to know. Web Performance -- making websites fast and responsive Web performance is the art of making sure web applications download fast and are responsive to user interaction, regardless of a user's bandwidth, screen size, network, or device capabilities. Tools and testing This topic covers the tools developers use to facil...
Obsolete
l ever be updated, but which we're keeping for the time being as potential source material for updated docs. ...
Adding a new word to the en-US dictionary
ns where perfectly legitimate words are missing from the English spell check dictionary in Firefox. This article describes the process for adding a word to the dictionary. The process is pretty straight-forward: Get a clone of UXP, if you don't already have one, and make sure you can build it successfully. Get into the dictionary sources directory using this command: cd extensions/spellcheck/
locales/hunspell/dictionary-sources There's a special script used for editing dictionaries. The script only works if you have the environment variable EDITOR set to the executable of an editor program; if you don't have it set, you can do EDITOR=vim sh edit-dictionary to edit using vim (or you can substitute some other editor), or you can just do sh edit-dictionary if you have an EDITOR already specif...
Configuring Build Options
he build system will automatically select the proper default set of extensions. Tests ac_add_options --disable-tests By default, many auxiliary test applications are built, which can help debug and patch the mozilla source. Disabling these tests can speed build time and reduce disk space considerably. Developers should generally not use this option. Localization mk_add_options MOZ_CO_
LOCALES=ISOcode TBD. ac_add_options --enable-ui-
locale=ISOcode TBD. ac_add_options --with-l10n-base=/path/to/base/dir TBD. Other Options mk_add_options AUTOCLOBBER=1 If a clobber would be required before a build, this will cause mach to clobber and continue with the build instead of asking the user to manually clobber and exiting. ac_add_options --disable-crypto Cryptography is enabled by ...
Makefile - variables
ET=$(DIST)/xpi-stage/$(XPI_NAME) DIST_SUBDIR If set FINAL_TARGET will be $(DIST)/bin/$(DIST_SUBDIR) [ metro build ] l10n.mk and localization Variable Description EN_US_BINARY_URL Server URL from which wget will FTP binaries. L10NBASEDIR MOZ_CHROME_MULTI
LOCALE A list of
locale names to process MOZ_CHROME_FILE_FORMAT both, file, jar, omni, symlink PACKAGER_NO_LIBS Hack to allow one makefile to include another without pulling in libs:: target definitions. STAGEDIST Local staging directory for localization and packaging. Todo: xpcom/xpinstall variables: https://developer.moz...
The Firefox codebase: CSS Guidelines
tead of margin-left: 3px. For RTL-aware positioning (left/right), use inset-inline-start/inset-inline-end. For RTL-aware float layouts, float: inline-start|inline-end can be used instead of float: left|right. The RTL-aware equivalents of border-{top/bottom}-{left/right}-radius are border-{start/end}-{start/end}-radius When there is no special RTL-aware property available, use the pseudo :-moz-
locale-dir(ltr|rtl) (for XUL files) or :dir(ltr|rtl) (for HTML files). Remember that while a tab content's scrollbar still shows on the right in RTL, an overflow scrollbar will show on the left. Write padding: 0 3px 4px; instead of padding: 0 3px 4px 3px;. This makes it more obvious that the padding is symmetrical (so RTL won't be an issue). Note: See CSS Logical Properties and Values for more info...
Reviewer Checklist
es, or build-time flags. Which one you choose depends on how the feature is implemented: a pure Java service can't easily check Gecko prefs, for example.] Strings There should be no string changes in patches that will be uplifted (including string removals). Rev entity names for string changes. When making UI changes, be aware of the fact that strings will be different lengths in different
locales. Documentation The commit message should describe what the patch is changing (not be a copy of the bug summary). The first line should be a short description (since only the first line is shown in the log), and additional description, if needed, should be present, properly wrapped, in later lines. Adequately document any potentially confusing pieces of code. Flag a bug with dev-doc-needed...
Gecko Keypress Event
rs do not need to use the Shift key to access the Zoom-in shortcut. Of course, this is not much help to users with other keyboard layouts. e.g., on a Japanese keyboard, '+' is entered with Shift+';' (bug 339723). Problem 2 The access keys for the menu items are specified with the localized characters on some localized builds. These localized access keys work fine with the keyboard layout of the
locale. However, users with the same non-Latin keyboard layouts would also like to be able to use Latin access keys of en-US builds (including nightly builds) without needing to switch keyboard layout (bug 399939). Problem 3 Users with non-Latin keyboard layouts would like to be able to use Latin access keys in web pages without switching to a Latin layout (bug 429510). Problem 4 The Shift key must...
AddonManager
method. The callbacks will be called just once but that may be before or after the method returns. One of the forces of the AddonManager is that it deals with any kind (type) of add-on in a generic manner. To do so many methods of the AddonManager take the add-on types as parameters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme,
locale, multipackage, dictionary and experiment. To import the AddonManager object in the Add-on SDK, use: const { AddonManager } = require("resource://gre/modules/AddonManager.jsm"); To import it in a normal bootstrapped extension or similar, use: Cu.import("resource://gre/modules/AddonManager.jsm"); Method Overview Promise? getInstallForURL(in string url, in InstallCallback? callback, ...
AddonType
string The unique ID for the type. name string The localized name for the type. uiPriority integer A number used to determine the order of types displayed in the user interface. The lower the number the higher in the list the type will appear. Built-in Values: Value Category 2000
Locale 4000 Extension 5000 Theme 6000 Plugin viewType integer The type of UI to use to display this type of add-on in the UI. If undefined the type will not appear in the UI. flags integer Additional behavior flags for the type. ...
Services.jsm
ce downloads nsIDownloadManager Download manager droppedLinkHandler nsIDroppedLinkHandler Dropped link handler service els nsIEventListenerService Event listener service eTLD nsIEffectiveTLDService EffectiveTLD service focus nsIFocusManager Focus manager io nsIIOService nsIIOService2 I/O Service
locale nsI
LocaleService
Locale service logins nsILoginManager Password Manager service metro nsIWinMetroUtils 2 mm nsIMessageBroadcaster nsIFrameScriptLoader Global frame message manager3 obs nsIObserverService Observer service perms nsIPermissionManager Permission manager service ppmm nsIMessageBroadcaster ...
Webapps.jsm
rs: function(aOldManifest, aNewManifest, aApp) checkForUpdate: function(aData, aMm) doInstall: function doInstall(aData, aMm) doInstallPackage: function doInstallPackage(aData, aMm) pushContentAction: function(windowID) popContentAction: function(windowID) actionCancelled: function(windowID) denyInstall: function(aData) _setupApp: function(aData, aId) _cloneApp: function(aData, aNewApp, a
LocaleManifest, aManifest, aId, aLocalId) _writeManifestFile: function(aId, aIsPackage, aJsonManifest) _nextLocalId: function() _appIdForManifestURL: function(aURI) makeAppId: function() _saveApps: function() _readManifests: function(aData) _ensureSufficientStorage: function(aNewApp) _checkDownloadSize: function(aFreeBytes, aNewApp) _getRequestChannel: function(aFullPackagePath, aIsLocalFileIns...
JavaScript code modules
cationLastURL.jsm Provides access to the last URL opened using the "Open Location" option in the File menu. OSFile.jsm Allows routines to access files. To which can be read, write, rename, create directories,etc. PerfMeasurement.jsm Provides access to low-level hardware and OS performance measurement tools. PluralForm.jsm Supplies an easy way to get the correct plural forms for the current
locale, as well as ways to localize to a specific plural rule. PopupNotifications.jsm Gives an easy way to present non-modal notifications to users. Promise.jsm Implements the Promises/A+ proposal as known in April 2013. PromiseWorker.jsm A version of ChromeWorker which uses Promises to return the worker's result instead of using an event to do so. Services.jsm Provides getters for conveniently ...
L10n testing with xcode
select your localized XLIFF file. A window will then appear showing the diff between the imported XLIFF file and the existing resources in the project folder. Click the Import button. Xcode will import your translated strings into the project by adding them to the project folder and replacing the existing strings. Next, you need to configure the iOS app simulator to run the app in your
locale. Choose Product > Scheme > Edit Scheme from the toolbar menu. In the Edit Scheme screen, select Run from the left pane and then navigate to the Options tab. Select your language from the Application Language menu and click Close. Tah dah! You're ready to test your localization of Firefox on iOS. Launching & testing your Firefox on iOS localization The iOS Simulator is fairly eas...
Localizing extension metadata on addons.mozilla.org
he extension, and doesn't necessarily change with each revision (but it can). The localizable data fields of an extension are: Name Homepage Summary Description EULA Privacy Policy Version Notes Developer Comments When you submit a new extension to AMO, the process is divided into several steps. In step 2, you'll be asked to provide the attributes listed above in the add-on's default
locale (selected in step 1). The values you provide here are used as fallback values if someone requests a language that doesn't exist. Step 4 allows you to translate any of the above fields into any other language AMO supports. Remember, all fields are optional when localizing. Any field that is blank will just show up in the default
locale. Getting translation help You are kindly advised NOT to use...
Localization sign-off reviews
rther indications of tool-originated corruption This is common. Most bugs filed from sign-offs are caused by a tool corrupting your localization's files. Newly translated strings that shouldn't have been translated Self-explanatory enough, right? Access key changes We ensure that when access keys are changed that they are consistent with the keyboard layout for that particular
locale and not blended between two or more distinct layouts. How it all works A large part of the review process takes place before you even submit your request for a sign-off review. To put it simply, when we receive your request, we expect that you have spent time testing your work and making sure all strings have been localized and that your changes are relatively functional. Your review request s...
A brief guide to Mozilla preferences
cause it can affect how updates are applied. browser/app/profile/firefox.js - defaults specific to Firefox browser/app/profile/firefox-branding.js - defaults specific to the specific kind of Firefox being installed (Nightly, Aurora, Beta, Release) browser/defaults/preferences/firefox-l10n.js - defaults specific to the installed language of Firefox. None of the other preference files contain
locale-specific preferences. Config. file A configuration file, usually with .cfg extension, may be called from a default pref file via the general.config.filename preference. This file allows preference locking via the lock_pref() function. Details on the config file is beyond the scope of this document. User pref. files In the profile directory are two user pref files: prefs.js and user.
Patches and pushes
on image which is linked within the XML file as an URI ID. Upload your plugins icon image to Data Kitchen to obtain its URI ID and add to the XML file within the Image tag. In list.txt, add the search plugin's XML filename (without extensions) on a new line and save. Note that if your team selects a local version of an already default plugin (e.g., Wikipedia), the XML filename should include the
locale code (e.g., Wikipedia-es). Create a patch of the searchplugins directory by entering the following command in your command-line tool, where mypatch.diff is where you give your patch a name: $ hg add mozilla/browser/searchplugins/ $ hg diff mozilla/browser/searchplugins/ > mypatch.diff Attach your patch file to the bug by clicking the "Add an attachment" link. Once attached and labeled as a p...
Productization guide
ol handlers, bookmarks, links to recommended sites on the in-product pages, etc. The web services that make up the productization of Mozilla software are often specific to a local market. For example, a search provider can deliver a very good quality of search results -- but only in a specific country or language, and we have to take this into account when considering default search engines for a
locale. Hence there is a need to customize the set of default web services on a per-
locale basis in order to ensure a good user experience across all
locales. Purpose of productization There are two main purposes of adding default web services to Mozilla products: Provide users with useful and relevant content Demonstrate certain features of the product The first one (provide users with useful and...
Rhino overview
ure, and Call. Attempts to invoke these constructors with the language version 1.4 will result in an error. For other versions, a warning will be generated. Internationalization The messages reported by the JavaScript engine are by default retrieved from the property file org/mozilla/javascript/resources/Messages.properties. If other properties files with extensions corresponding to the current
locale exist, they will be used instead. JavaScript Language Versions Some behavior in the JavaScript engine is dependent on the language version. In browser embeddings, this language version is selected using the LANGUAGE attribute of the SCRIPT tag with values such as "JavaScript1.2". Version 1.3 and greater are ECMA conformant. Operators == and != Version 1.2 only uses strict equality for the ==...
Mozilla Projects
Mozilla has a number of projects other than Firefox itself. Many of these are components of Firefox or are tools used to create Firefox, but may be used by other projects as well. Here you'll find links to documentation about these projects. compare-
locales compare-
locales is a Python script that helps localizers to check their work without running Firefox or another application. Crash reporting Firefox ships with an open-source crash reporting system. This system is combination of projects: Emscripten Emscripten is an LLVM to JavaScript compiler. It takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and co...
Mozilla internal string guide
ilar but different encoding used for interchange. In addition, there exist multiple other (legacy) encodings. The Web-relevant ones are defined in the Encoding Standard. Conversions from these encodings to UTF-8 and UTF-16 are provided by mozilla::Encoding. Additonally, on Windows the are some rare cases (e.g. drag&drop) where it's necessary to call a system API with data encoded in the Windows
locale-dependent legacy encoding instead of UTF-16. In those rare cases, use MultiByteToWideChar/WideCharToMultiByte from kernel32.dll. Do not use iconv on *nix. We only support UTF-8-encoded file paths on *nix, non-path Gtk strings are always UTF-8 and Cocoa and Java strings are always UTF-16. When working with existing code, it is important to examine the current usage of the strings that you are man...
Index
reground request then the groupObserver's onStartRequest will be called. 714 nsILocalFile Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference Implemented by: @mozilla.org/file/local;1. To create an instance, use: 715 nsILocalFileMac File I/O, Interfaces, Interfaces:Scriptable, NeedsContent, XPCOM Interface Reference None. 716 nsI
Locale Interfaces, Interfaces:Scriptable, Localization, XPCOM, XPCOM API Reference, XPCOM Interface Reference Retrieves a string with the current
locale name. 717 nsI
LocaleService Interfaces, Interfaces:Scriptable, XPCOM Interface Reference Implemented by: @mozilla.org/intl/ns
localeservice;1. To use this service, use: 718 nsILoginInfo Firefox 3, Interfaces, ...
amIInstallTrigger
nstallChrome(in PRUint32 aType, in AString aUrl, in AString aSkin); Deprecated since Gecko 2.0 boolean startSoftwareUpdate(in AString aUrl, [optional] in PRInt32 aFlags); Deprecated since Gecko 2.0 boolean updateEnabled(); Deprecated since Gecko 2.0 Constants Retained for backwards compatibility. Constant Value Description SKIN 1
LOCALE 2 CONTENT 4 PACKAGE 7 Methods enabled() Tests if installation is enabled. boolean enabled(); Parameters None. Return value install() Starts a new installation of a set of add-ons. boolean install( in nsIVariant aArgs, in amIInstallCallback aCallback Optional ); Parameters aArgs The add-ons to install. This should be a JS objec...
mozISpellCheckingEngine
ribute, and returns false if word is misspelled. getDictionaryList() Gets the list of dictionaries. void getDictionaryList( [array, size_is(count)] out wstring dictionaries, out PRUint32 count ); Parameters dictionaries A list of dictionaries supported by this spell checker. The dictionary attribute can be set to one of these. Each dictionary name is typically but not always a
locale code. count The length of dictionaries. removeDirectory() Removes all the dictionaries in the specified directory from the spell checker. void removeDirectory( nsIFile dir ); Parameters dir An nsIFile object indicating the directory whose spell checkers are to be removed from the spell checker. suggest() Gets a list of suggestions for a misspelled word. When this...
nsICRLInfo
security/manager/ssl/public/nsICRLInfo.idlScriptable Information on a Certificate Revocation List (CRL) issued by a Certificate Authority (CA). Inherits from: nsISupports Last changed in Gecko 1.7 Attributes Attribute Type Description lastFetchURL AUTF8String The URL this CRL was last fetched from. Read only. lastUpdate PRTime The time this CRL was created at. Read only. lastUpdate
Locale AString lastUpdate formatted as a human readable string formatted according to the environment
locale. Read only. nameInDb AString The key identifying the CRL in the database. Read only. nextUpdate PRTime The time the suggested next update for this CRL. Read only. nextUpdate
Locale AString nextUpdate formatted as a human readable string formatted according to the environment
locale. Read onl...
Building an Account Manager Extension
agerExtension]); Step3: Create the new panel As next Step we create the XUL and the property file for your new panel. We defined in Step 1 "devmo-account" as name and "example@mozilla.org" as chrome package. This means the XUL file for the new panel has to be located in chrome://example@mozilla.org/content/am-devmo-account.xul. And the property file needs to be in chrome://example@mozilla.org/
locale/am-devmo-account.properties. The XUL file needs a page element as root element, with a special on load command. Furthermore you should include the AccountManager.js script and accountManage.css styles. It is common practice to use for the JavaScript of the new panel, the same naming as used for the XUL. This means in our example, the JavaScript file should be located in chrome://example@mozilla.
nsIMsgAccountManagerExtension
e. Note: The Account Manager relies on a very strong naming scheme to load and unload a panel. An Account Manager Extension with a "name" attribute of "devmo" and the "chromePackageName" attribute set to "extension@example.org" means, that the Account Manager expects to find a XUL file in "chrome://extension@example.org/content/am-devmo.xul" and a property file in "chrome://extension@example.org/
locale/am-devmo.properties" containing a property named "prefPanel-devmo". You have to register any new Account Manager Extensions via the the category manager at start up. Simply add a new Entry with the Contact ID of the component to the "mailnews-accountmanager-extensions" category. //github.com/RealityRipple/UXP/blob/master/mailnews/base/public/nsIMsgAccountManager.idlScriptable Please add a sum...
nsINavHistoryQueryOptions
. Defaults to false. maxResults long This is the maximum number of results that you want. The query is exeucted, the results are sorted, and then the top maxResults results are taken and returned. Set to "0" (the default) to get all results. This does not work in conjunction with sorting by title. This is because sorting by title requires us to sort after using
locale-sensetive sorting (as opposed to letting the database do it for us). Instead, we get the result ordered by date, pick the maxResult most recent ones, and then sort by title. queryType short The type of search to use when querying the DB; This attribute is only honored by query nodes. It is silently ignored for simple folder queries. See Query type constants for ...
nsIProfile
void createNewProfile( in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir ); Parameters profileName The name to assign to the new profile. nativeProfileDir The pathname of the directory to use as the profile directory; if you specify null, a new folder will be created in the default profiles directory. langcode The
locale to use for the new profile. useExistingDir If true, an existing directory may be used; otherwise, the profile directory will be unique. deleteProfile() Deletes the specified profile. void deleteProfile( in wstring name, in boolean canDeleteFiles ); Parameters name The name of the profile to delete. canDeleteFiles If true, the Profile Manager will try to delete all o...
nsIPromptService
he user a choice of options, but still allowing the user to cancel the prompt. For instance, it might have the label "Don't Save". Button title flags These flags are used along with Button position flags to set the labels of buttons in the prompt. Constant Value Description BUTTON_TITLE_OK 1 These flags are used to select standard labels from the user's current
locale. BUTTON_TITLE_CANCEL 2 BUTTON_TITLE_YES 3 BUTTON_TITLE_NO 4 BUTTON_TITLE_SAVE 5 BUTTON_TITLE_DONT_SAVE 6 BUTTON_TITLE_REVERT 7 BUTTON_TITLE_IS_STRING 127 This flag indicates that the label is passed as a separate string. Use this for labels that don't match one of the constants above. Button default flags...
nsIURLFormatter
substitute variables in URL formats. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Variable names can contain 'A-Z' letters and '_' characters. Mozilla applications linking to Mozilla websites are strongly encouraged to use URLs of the following format: http[s]://%SERVICE%.mozilla.[com|org]/%
LOCALE%/ Method overview AString formatURL(in AString aFormat); AString formatURLPref(in AString aPref); Methods formatURL() Formats a string URL. The set of known variables is predefined. If a variable is unknown, it is left unchanged and a non-fatal error is reported. AString formatURL( in AString aFormat ); Parameters aFormat Unformatted URL as a string. Return va...
nsIUpdateItem
nts representing types of update checks. Constants that callers can use to indicate the reason for an add-on update check. Internal code uses other constants in nsExtensionManager.js.in. Constant Gecko version Description 1.8 1.8.1 1.9 1.9.1 1.9.2 TYPE_APP 0x01 TYPE_EXTENSION 0x02 TYPE_THEME 0x04 TYPE_
LOCALE 0x08 TYPE_MULTI_XPI 0x20 TYPE_ADDON TYPE_EXTENSION + TYPE_THEME + TYPE_
LOCALE + TYPE_PLUGIN TYPE_EXTENSION + TYPE_THEME + TYPE_
LOCALE TYPE_ANY TYPE_APP + TYPE_ADDON 0xff TYPE_PLUGIN 0x10 Methods init() Initializes the object. void init( in AString id, in AString version, in AString installLocati...
XPCOM Interface Reference
ttpServernsIHttpUpgradeListenernsIIDNServicensIIFrameBoxObjectnsIINIParsernsIINIParserFactorynsIINIParserWriternsIIOServicensIIdleServicensIInProcessContentFrameMessageManagernsIInputStreamnsIInputStreamCallbacknsIInstallLocationnsIInterfaceRequestornsIJSCIDnsIJSIDnsIJSIIDnsIJSONnsIJetpacknsIJetpackServicensIJumpListBuildernsIJumpListItemnsILivemarkServicensILoadGroupnsILocalFilensILocalFileMacnsI
LocalensI
LocaleServicensILoginInfonsILoginManagernsILoginManagerCryptonsILoginManagerIEMigrationHelpernsILoginManagerPrompternsILoginManagerStoragensILoginMetaInfonsIMIMEInputStreamnsIMacDockSupportnsIMarkupDocumentViewernsIMemorynsIMemoryMultiReporternsIMemoryMultiReporterCallbacknsIMemoryReporternsIMemoryReporterManagernsIMenuBoxObjectnsIMessageBroadcasternsIMessageListenernsIMessageListenerManagernsI...
XPCOM Interface Reference by grouping
nsICommandLine nsICommandLineHandler nsICommandLineRunner Component nsIComponentManager Preferences nsIContentPrefObserver nsIContentPrefService nsIComponentRegistrar Internationalization nsIBidiKeyboard nsI
Locale IO FileSystem nsIDirectoryEnumerator nsIDirectoryIterator nsIDirectoryService nsIDirectoryServiceProvider nsIDirectoryServiceProvider2 nsIDirIndex nsIDirIndexListener nsIDirIndexParser nsIFile nsILocalFile St...
Building a Thunderbird extension 2: extension file layout
rstext.xpi: //created in step 8 /install.rdf //created in step 3 /chrome.manifest //created in step 4 /chrome/ /content/ /content/myhelloworld.xul //created in step 5 /content/overlay.js //created in step 6 /chrome/
locale/* //Building an Extension# Localization /chrome/skin/ /defaults/preferences/ //Building an Extension# Defaults Files The following tutorial pages will explain how to write each of these files (except
locale/ and defaults/) and package them into an XPI (zippy) file. You can find information about the
locale/ and defaults/ folders in the more...
Filter Incoming Mail
// Querying mime conversion interface var mimeConvert = Components.classes["@mozilla.org/messenger/mimeconverter;1"] .getService(Components.interfaces.nsIMimeConverter); var subject = mimeConvert.decodeMimeHeader(aMsgHdr.subject, null, false, true); // Here with have a string to modify with Javascript. ...
Mozilla
, links to recommended sites on the in-product pages, etc. The web services that make up the productization of Mozilla software are often specific to a local market. For example, a search provider can deliver a very good quality of search results -- but only in a specific country or language, and we have to take this into account when considering default search engines for a
locale. Hence there is a need to customize the set of default web services on a per-
locale basis in order to ensure a good user experience across all
locales. Profile Manager Firefox and other XULRunner applications store user settings and data in special folders, called profiles. Firefox provides a built-in applet to manage these profiles, but it wi...
Accessibility Inspector - Firefox Developer Tools
use it. A (very) brief guide to accessibility Accessibility is the practice of making your websites usable by as many people as possible. This means trying your best to not lock anyone out of accessing information because of any disability they may have, or any other personal circumstances such as the device they are using, the speed of their network connection, or their geographic location or
locale. You can find more extensive information in the Accessibility section of MDN Web Docs. Here we are mainly talking about exposing information to people with visual disabilities -- this is done via the accessibility APIs available inside web browsers, which expose information on what roles the different elements on your page play (e.g., are they just text, or are they buttons, links, form elements...
DOM Inspector internals - Firefox Developer Tools
ritten, we should now be at a place where we can look at the way the DOM Inspector source is organized. Source code organization The contents of the top-level directory for the DOM Inspector repository should look like base/ js/ inspector-cmdline.js Makefile.in build/ install.js Makefile.in resources/ content/ ...
locale/ ... skin/ ... Makefile.in install.rdf jar.mn Makefile.in makefiles.sh Almost all the interesting stuff is in resources/content/. Its contents should resemble the following: extensions/ ... jsutil/ ... prefs/ ... res/ ... tests/ ... viewers/ ... browserOverlay.xul com...
All keyboard shortcuts - Firefox Developer Tools
This page lists all keyboard shortcuts used by the developer tools built into Firefox. The first section lists the shortcut for opening each tool and the second section lists shortcuts that are applicable to the Toolbox itself. After that there's one section for each tool, which lists the shortcuts that you can use within that tool. Because access keys are
locale-dependent, they're not documented in this page. Opening and closing tools These shortcuts work in the main browser window to open the specified tool. The same shortcuts will work to close tools hosted in the Toolbox, if the tool is active. For tools like the Browser Console that open in a new window, you have to close the window to close the tool. Command Windows macOS Linux Open Toolbox (with the most r...
CanvasRenderingContext2D.textAlign - Web APIs
r example, if textAlign is "center", then the text's left edge will be at x - (textWidth / 2). Syntax ctx.textAlign = "left" || "right" || "center" || "start" || "end"; Options Possible values: "left" The text is left-aligned. "right" The text is right-aligned. "center" The text is centered. "start" The text is aligned at the normal start of the line (left-aligned for left-to-right
locales, right-aligned for right-to-left
locales). "end" The text is aligned at the normal end of the line (right-aligned for left-to-right
locales, left-aligned for right-to-left
locales). The default value is "start". Examples General text alignment This example demonstrates the three "physical" values of the textAlign property: "left", "center", and "right". HTML <canvas id="canvas"></canvas...
CompositionEvent.initCompositionEvent() - Web APIs
The initCompositionEvent() method of the CompositionEvent interface initializes the attributes of a CompositionEvent object instance. Syntax compositionEventInstance.initCompositionEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg,
localeArg) Parameters typeArg A DOMString representing the type of composition event; this will be one of compositionstart, compositionupdate, or compositionend. canBubbleArg A Boolean specifying whether or not the event can bubble. cancelableArg A Boolean shether or not the event can be canceled. viewArg The Window object from which the event was generated. dataArg A DOMString representing the value of the data attribute.
localeArg A DOMString representing the value of the
locale attribute. Return value Void. Specifications ...
CompositionEvent - Web APIs
ructor CompositionEvent() Creates a new CompositionEvent object instance. Properties This interface also inherits properties of its parent, UIEvent, and its ancestor -- Event. CompositionEvent.data Read only Returns the characters generated by the input method that raised the event; its varies depending on the type of event that generated the CompositionEvent object. CompositionEvent.
locale Read only Returns the
locale of current input method (for example, the keyboard layout
locale if the composition is associated with IME). Methods This interface also inherits methods of its parent, UIEvent, and its ancestor -- Event. CompositionEvent.initCompositionEvent() Initializes the attributes of a CompositionEvent object. Specifications Specification Status C...
Element.classList - Web APIs
nt = window.document, Object = window.Object, hasOwnProp = Object.prototype.hasOwnProperty; var defineProperty = Object.defineProperty, allowTokenListConstruction = 0, skipPropChange = 0; function DOMTokenList(){ if (!allowTokenListConstruction) throw TypeError("Illegal constructor"); // internally let it through } DOMTokenList.prototype.toString = DOMTokenList.prototype.to
LocaleString = function(){return this.value}; DOMTokenList.prototype.add = function(){ a: for(var v=0, argLen=arguments.length,val="",ele=this[" uCL"],proto=ele[" uCLp"]; v!==argLen; ++v) { val = arguments[v] + "", checkIfValidClassListEntry("add", val); for (var i=0, Len=proto.length, resStr=val; i !== Len; ++i) if (this[i] === val) continue a; else r...
Element.innerHTML - Web APIs
rejected. For example, if you use innerHTML in a browser extension and submit the extension to addons.mozilla.org, it will not pass the automated review process. Example This example uses innerHTML to create a mechanism for logging messages into a box on a web page. JavaScript function log(msg) { var logElem = document.querySelector(".log"); var time = new Date(); var timeStr = time.to
LocaleTimeString(); logElem.innerHTML += timeStr + ": " + msg + "<br/>"; } log("Logging mouse events inside this container..."); The log() function creates the log output by getting the current time from a Date object using to
LocaleTimeString(), and building a string with the timestamp and the message text. Then the message is appended to the box with the class "log". We add a second method that l...
HTMLFormElement.elements - Web APIs
form's element list, then iterates over the list, looking for <input> elements of type "text" so that some form of processing can be performed on them. ...
HTMLInputElement - Web APIs
unsigned long: Returns / Sets the end index of the selected text. When there's no selection, this returns the offset of the character immediately following the current text input cursor position. selectionDirection string: Returns / Sets the direction in which selection occurred. Possible values are: forward if selection was performed in the start-to-end direction of the current
locale backward for the opposite direction none if the direction is unknown size unsigned long: Returns / Sets the element's size attribute, containing visual size of the control. This value is in pixels unless the value of type is text or password, in which case, it is an integer number of characters. Applies only when type is set to text, search, tel, url, email, or password; otherwi...
HTMLTextAreaElement - Web APIs
indicating that the user must specify a value before submitting the form. rows unsigned long: Returns / Sets the element's rows attribute, indicating the number of visible text lines for the control. selectionDirection string: Returns / Sets the direction in which selection occurred. This is "forward" if selection was performed in the start-to-end direction of the current
locale, or "backward" for the opposite direction. This can also be "none" if the direction is unknown. selectionEnd unsigned long: Returns / Sets the index of the end of selected text. If no text is selected, contains the index of the character that follows the input cursor. On being set, the control behaves as if setSelectionRange() had been called with this as the second argument, and sele...
Basic concepts - Web APIs
over most cases that need client-side storage. However, it is not designed for a few cases like the following: Internationalized sorting. Not all languages sort strings in the same way, so internationalized sorting is not supported. While the database can't store data in a specific internationalized order, you can sort the data that you've read out of the database yourself. Note, however, that
locale-aware sorting has been allowed with an experimental flag enabled (currently for Firefox only) since Firefox 43. Synchronizing. The API is not designed to take care of synchronizing with a server-side database. You have to write code that synchronizes a client-side indexedDB database with a server-side database. Full text searching. The API does not have an equivalent of the LIKE operator in SQL...
IndexedDB API - Web APIs
DB database, but uses an index to retrieve the record(s) rather than the primary key. This is sometimes faster than using IDBObjectStore. IDBCursor Iterates over object stores and indexes. IDBCursorWithValue Iterates over object stores and indexes and returns the cursor's current value. IDBKeyRange Defines a key range that can be used to retrieve data from a database in a certain range. IDB
LocaleAwareKeyRange Defines a key range that can be used to retrieve data from a database in a certain range, sorted according to the rules of the
locale specified for a certain index (see createIndex()'s optionalParameters.). This interface isn't part of the 2.0 specification. Custom event interfaces This specification fires events with the following custom interface: IDBVersionChangeEvent Th...
installChrome - Web APIs
Method of InstallTrigger object Syntax int installChrome( TYPE, url, name ) Parameters The installChrome method has the following parameters: TYPE TYPE can be InstallTrigger.SKIN or InstallTrigger.
LOCALE. url url is a string containing a full or relative URL to download name name is displayed in the dialog, but is also used to *select* the theme somust match exactly the name in the internal manifest.rdf file. Returns A boolean value indicating False if the software install feature has been turned off, and True if it's on. Note that this return value does not indicate anything about the success of the installation. ...
InstallTrigger - Web APIs
hether or not Software Installation is enabled for this client machine. getVersion Returns an object representing the version number from the Client Version Registry for the specified component. It is used in both trigger scripts and installation scripts. install Installs one or more XPI files on the local machine. installChrome Installs new skin or
locale packages in Netscape 6 and Mozilla. startSoftwareUpdate Triggers the downloading and installation of the software at the specified URL. ...
KeyboardEvent.key - Web APIs
Its value is determined as follows: Key values See a full list of key values. If the pressed key has a printed representation, the returned value is a non-empty Unicode character string containing the printable representation of the key. If the pressed key is a control or special character, the returned value is one of the pre-defined key values. ...
KeyboardEvent - Web APIs
rdEvent.ctrlKey Read only Returns a Boolean that is true if the Ctrl key was active when the key event was generated. KeyboardEvent.isComposing Read only Returns a Boolean that is true if the event is fired between after compositionstart and before compositionend. KeyboardEvent.key Read only Returns a DOMString representing the key value of the key represented by the event. KeyboardEvent.
locale Read only Returns a DOMString representing a
locale string indicating the
locale the keyboard is configured for. This may be the empty string if the browser or device doesn't know the keyboard's
locale. Note: This does not describe the
locale of the data being entered. A user may be using one keyboard layout while typing text in a different language. KeyboardEvent.location Read only Retur...
NDEFRecord.lang - Web APIs
The lang property ofthe NDEFRecord interface is USVString containing the language tag of the record contents, if it is a vailable. The record might be missing a language tag, for example, if the recorded information is not
locale-specific. Syntax NDEFRecord.lang Value A USVString. Specifications Specification Status Comment Web NFC, NDEFRecord.lang Draft Initial definition. ...
PaymentCurrencyAmount - Web APIs
g a valid 3-letter ISO 4217 currency identifier (ISO 4217) indicating the currency used for the payment value. value A string containing a valid decimal value representing the mount of currency constituting the payment amount. This string must only contain an optional leading "-" to indicate a negative value, then one or more digits from 0 to 9, and an optional decimal point (".", regardless of
locale) followed by at least one more digit. No whitespace is permitted. Obsolete properties These properties have been removed from the specification and should no longer be used. currencySystem Optional A string describing the standard or specification as well as the currency system identifier within that system which was used to provide the value. This has been removed; instead of allowing s...
Writing WebSocket client applications - Web APIs
d types of data packets the client might receive, such as: Login handshake Message text User list updates The code that interprets these incoming messages might look like this: exampleSocket.onmessage = function(event) { var f = document.getElementById("chatbox").contentDocument; var text = ""; var msg = JSON.parse(event.data); var time = new Date(msg.date); var timeStr = time.to
LocaleTimeString(); switch(msg.type) { case "id": clientID = msg.id; setUsername(); break; case "username": text = "<b>User <em>" + msg.name + "</em> signed in at " + timeStr + "</b><br>"; break; case "message": text = "(" + timeStr + ") <b>" + msg.name + "</b>: " + msg.text + "<br>"; break; case "rejectusername": text = "<b>Your usernam...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
h the camera, you keep it fixed in space at the same coordinates while changing the direction in which it's facing vertically without altering the horizontal portion of its facing at all. It simply adjusts the direction it's pointing up and down. Tilting is good for capturing the scope of a tall object or scene, such as a forest or a mountain, but is also a popular way to introduce a character or
locale of importance or which inspires awe. it's also of course useful for implementing support for a player looking up and down. Thus, tilting the camera can be achieved by rotating the camera around the X axis, so that it pivots to look up and down. This can be done using the appropriate method in your matrix math library, such as the rotateX() method in glMatrix's mat4 class: mat4.rotateX(viewMat...
Using XMLHttpRequest - Web APIs
MLHttpRequest(); oReq.open("HEAD" /* use HEAD - we only need the headers! */, sURL); oReq.callback = fCallback; oReq.filepath = sURL; oReq.onload = getHeaderTime; oReq.send(); } And to test: /* Let's test the file "yourpage.html"... */ ifHasChanged("yourpage.html", function (nModif, nVisit) { console.log("The page '" + this.filepath + "' has been changed on " + (new Date(nModif)).to
LocaleString() + "!"); }); If you want to know if the current page has changed, please read the article about document.lastModified. Cross-site XMLHttpRequest Modern browsers support cross-site requests by implementing the Cross-Origin Resource Sharing (CORS) standard. As long as the server is configured to allow requests from your web application's origin, XMLHttpRequest will work. Otherwise, an INV...
Web APIs
t HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement HashChangeEvent Headers History HkdfParams HmacImportParams HmacKeyGenParams I IDBCursor IDBCursorSync IDBCursorWithValue IDBDatabase IDBDatabaseException IDBDatabaseSync IDBEnvironment IDBEnvironmentSync IDBFactory IDBFactorySync IDBIndex IDBIndexSync IDBKeyRange IDB
LocaleAwareKeyRange IDBMutableFile IDBObjectStore IDBObjectStoreSync IDBOpenDBRequest IDBRequest IDBTransaction IDBTransactionSync IDBVersionChangeEvent IDBVersionChangeRequest IIRFilterNode IdleDeadline ImageBitmap ImageBitmapRenderingContext ImageCapture ImageData Index InputDeviceCapabilities InputEvent InstallEvent InstallTrigger IntersectionObserver IntersectionObserverEntry Inter...
Understanding the Web Content Accessibility Guidelines - Accessibility
Legal standing This guide is intended to provide practical information to help you build better, more accessible websites. However, we are not lawyers, and none of this constitutes legal advice. If you are worried about the legal implications of web accessibility, we'd recommend that you check the specific legislation governing accessibility for the web/public resources in your country or
locale, and seek the advice of a qualified lawyer. What is accessibility? and particularity the Accessibility guidelines and the law section provide more related information. ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
] :-moz-broken ::-moz-canvas ::-moz-color-swatch ::-moz-cell-content :-moz-drag-over F - I :-moz-first-node ::-moz-focus-inner ::-moz-focus-outer :-moz-focusring :-moz-full-screen :-moz-full-screen-ancestor :-moz-handler-blocked :-moz-handler-crashed :-moz-handler-disabled ::-moz-inline-table L :-moz-last-node :-moz-list-bullet :-moz-list-number :-moz-loading :-moz-
locale-dir(ltr) :-moz-
locale-dir(rtl) :-moz-lwtheme :-moz-lwtheme-brighttext :-moz-lwtheme-darktext N - R :-moz-native-anonymous :-moz-only-whitespace ::-moz-page ::-moz-page-sequence ::-moz-pagebreak ::-moz-pagecontent :-moz-placeholderObsolete since Gecko 51 ::-moz-placeholderDeprecated since Gecko 51 ::-moz-progress-bar ::-moz-range-progress ::-moz-range-thumb ::-moz-range-track...
WebKit CSS extensions - CSS: Cascading Style Sheets
sion -webkit-cursor-visibility D-I -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-character -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphenate-limit-lines -webkit-initial-letter L -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -webkit-line-snap -webkit-
locale -webkit-logical-height -webkit-logical-width M -webkit-margin-after-collapse -webkit-margin-after -webkit-margin-before-collapse -webkit-margin-before -webkit-margin-bottom-collapse -webkit-margin-collapse -webkit-margin-end** -webkit-margin-start** -webkit-margin-top-collapse -webkit-marquee-direction -webkit-marquee-increment -webkit-marquee-repetition -webkit-marquee-speed ...
<input type="tel"> - HTML: Hypertext Markup Language
; color: #8b0000; } input:valid+span:after { position: absolute; content: '?'; padding-left: 5px; color: #009000; } Notice how the entered value is reported as invalid unless the pattern xxx-xxx-xxxx is matched; for instance, 41-323-421 won't be accepted. Neither will 800-MDN-ROCKS. However, 865-555-6502 will be accepted. This particular pattern is obviously only useful for certain
locales -- in a real application you'd probably have to vary the pattern used depending on the
locale of the user. Examples In this example, we present a simple interface with a <select> element that lets the user choose which country they're in, and a set of <input type="tel"> elements to let them enter each part of their phone number; there is no reason why you can't have multiple tel inputs. Each ...
<input type="week"> - HTML: Hypertext Markup Language
he first week of 1970 ("1970-W01"). At this time, it's unclear what a value of "any" means for step when used with week inputs. This will be updated as soon as that information is determined. Using week inputs Week inputs sound convenient at first glance, since they provide an easy UI for choosing weeks, and they normalize the data format sent to the server, regardless of the user's browser or
locale. However, there are issues with <input type="week"> because browser support is not guaranteed across all browsers. We'll look at basic and more complex uses of <input type="week">, then offer advice on mitigating the browser support issue later on (see Handling browser support). Basic uses of week The simplest use of <input type="week"> involves a basic <input> and <label> element combination,...
inputmode - HTML: Hypertext Markup Language
The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. It can have the following values: none No virtual keyboard. For when the page implements its own keyboard input control. text (default value) Standard input keyboard for the user's current
locale. decimal Fractional numeric input keyboard containing the digits and decimal separator for the user's
locale (typically . or ,). Devices may or may not show a minus key (-). numeric Numeric input keyboard, but only requires the digits 0-9. Devices may or may not show a minus key. tel A telephone keypad input, including the digits 0-9, the asterisk (*), and the pound (#) key. Inputs that require a telephone number should typical...
Resource URLs - HTTP
n. For example: http://searchfox.org/mozilla-central/rev/48ea452803907f2575d81021e8678634e8067fc2/browser/app/profile/firefox.js#575 Web sites can easily collect Firefox default preferences by overriding this pref() function and using the script resource:///defaults/preferences/firefox.js. Furthermore, some default values of preferences differ between build configurations, such as platform and
locale, which means web sites could identify individual users using this information. Solution In order to fix this problem, Mozilla changed the behavior of loading resource: URIs in bug 863246, which landed in Firefox 57 (Quantum). In the past, web content was able to access whatever resource: URIs were desired -- not only Firefox's internal resources, but also extensions' assets. Now this behavior...
Content negotiation - HTTP
Viewport-Width Indicates the layout viewport width in CSS pixels. Width Indicates the resource width in physical pixels (in other words the intrinsic size of an image). The Accept-Charset header The Accept-Charset header indicates to the server what kinds of character encodings are understood by the user-agent. Traditionally, it was set to a different value for each
locale for the browser, like ISO-8859-1,utf-8;q=0.7,*;q=0.7 for a Western European
locale. With UTF-8 now being well-supported, being the preferred way of encoding characters, and to guarantee better privacy through less configuration-based entropy, browsers omit the Accept-Charset header: Internet Explorer 8, Safari 5, Opera 11, Firefox 10 and Chrome 27 have abandoned this header. The Accept-CH-Lifet...
Index - HTTP
ient is able to understand. Using content negotiation, the server selects one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header. 5 Accept-Language Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-Language request HTTP header advertises which languages the client is able to understand, and which
locale variant is preferred. (By languages, we mean natural languages, such as English, and not programming languages.) Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Language response header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, thi...
HTTP Index - HTTP
derstand. Using content negotiation, the server selects one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header. 52 Accept-Language Accept-Language, Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-Language request HTTP header advertises which languages the client is able to understand, and which
locale variant is preferred. (By languages, we mean natural languages, such as English, and not programming languages.) Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Language response header. Browsers set adequate values for this header according to their user interface language and even if a user can change it, thi...
A re-introduction to JavaScript (JS tutorial) - JavaScript
, index, array) { // Do something with currentValue or array[index] }); If you want to append an item to an array simply do it like this: a.push(item); Arrays come with a number of methods. See also the full documentation for array methods. Method name Description a.toString() Returns a string with the toString() of each element separated by commas. a.to
LocaleString() Returns a string with the to
LocaleString() of each element separated by commas. a.concat(item1[, item2[, ...[, itemN]]]) Returns a new array with the items added on to it. a.join(sep) Converts the array to a string -- with values delimited by the sep param a.pop() Removes and returns the last item. a.push(item1, ..., itemN) Appends items ...
Deprecated and obsolete features - JavaScript
Iterator is deprecated. Object methods watch and unwatch are deprecated. Use Proxy instead. __iterator__ is deprecated. __noSuchMethod__ is deprecated. Use Proxy instead. Date methods getYear and setYear are affected by the Year-2000-Problem and have been subsumed by getFullYear and setFullYear. You should use toISOString instead of the deprecated toGMTString method in new code. to
LocaleFormat is deprecated. Functions Expression closures are deprecated. Use regular functions or arrow functions instead. Proxy Proxy.create and Proxy.createFunction are deprecated. Use Proxy instead. The following traps are obsolete: hasOwn (bug 980565, Firefox 33). getEnumerablePropertyKeys (bug 783829, Firefox 37) getOwnPropertyNames (bug 1007334, Firefox 33) keys (bug 100...
JavaScript error reference - JavaScript
r: invalid argumentsTypeError: invalid assignment to const "x"TypeError: property "x" is non-configurable and can't be deletedTypeError: setting getter-only property "x"TypeError: variable "x" redeclares argumentURIError: malformed URI sequenceWarning: 08/09 is not a legal ECMA-262 octal constantWarning: -file- is being assigned a //# sourceMappingURL, but already has oneWarning: Date.prototype.to
LocaleFormat is deprecatedWarning: JavaScript 1.6's for-each-in loops are deprecatedWarning: String.x is deprecated; use String.prototype.x insteadWarning: expression closures are deprecatedWarning: unreachable code after return statement ...
Array - JavaScript
that element. Array.prototype.slice() Extracts a section of the calling array and returns a new array. Array.prototype.some() Returns true if at least one element in this array satisfies the provided testing function. Array.prototype.sort() Sorts the elements of an array in place and returns the array. Array.prototype.splice() Adds and/or removes elements from an array. Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. Overrides the Object.prototype.to
LocaleString() method. Array.prototype.toString() Returns a string representing the array and its elements. Overrides the Object.prototype.toString() method. Array.prototype.unshift() Adds one or more elements to the front of an array, and returns the new length of the array. Array.p...
BigInt - JavaScript
n 0n && 12n // ? 0n Boolean(0n) // ? false Boolean(12n) // ? true !12n // ? false !0n // ? true Constructor BigInt() Creates a new bigint value. Static methods BigInt.asIntN() Wraps a BigInt value to a signed integer between -2width-1 and 2width-1 - 1. BigInt.asUintN() Wraps a BigInt value to an unsigned integer between 0 and 2width - 1. Instance methods BigInt.prototype.to
LocaleString() Returns a string with a language-sensitive representation of this number. Overrides the Object.prototype.to
LocaleString() method. BigInt.prototype.toString() Returns a string representing the specified object in the specified radix (base). Overrides the Object.prototype.toString() method. BigInt.prototype.valueOf() Returns the primitive value of the specified object. Overrides the Ob...
BigInt64Array - JavaScript
ort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). BigInt64Array.prototype.subarray() Returns a new BigUint64Array from the given start and end element index. BigInt64Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). BigInt64Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). BigInt64Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). BigInt64Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Diffe...
BigUint64Array - JavaScript
() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). BigUint64Array.prototype.subarray() Returns a new BigUint64Array from the given start and end element index. BigUint64Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). BigUint64Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). BigUint64Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). BigUint64Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Dif...
Float32Array - JavaScript
ype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Float32Array.prototype.subarray() Returns a new Float32Array from the given start and end element index. Float32Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Float32Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Float32Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Float32Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Differe...
Float64Array - JavaScript
ype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Float64Array.prototype.subarray() Returns a new Float64Array from the given start and end element index. Float64Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Float64Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Float64Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Float64Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Differe...
Int16Array - JavaScript
y.prototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Int16Array.prototype.subarray() Returns a new Int16Array from the given start and end element index. Int16Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Int16Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Int16Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Int16Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Different w...
Int32Array - JavaScript
y.prototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Int32Array.prototype.subarray() Returns a new Int32Array from the given start and end element index. Int32Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Int32Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Int32Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Int32Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Different w...
Int8Array - JavaScript
Array.prototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Int8Array.prototype.subarray() Returns a new Int8Array from the given start and end element index. Int8Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Int8Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Int8Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Int8Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Different way...
Intl.DateTimeFormat.prototype.format() - JavaScript
The Intl.DateTimeFormat.prototype.format() method formats a date according to the
locale and formatting options of this Intl.DateTimeFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax dateTimeFormat.format(date) Parameters date The date to format. Description The format getter formats a date into a string according to the
locale and formatting options of this Intl.DateTimeFormat object. Examples Using format Use the format getter function for formatting a single date, here for Serbia: var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; var dateTimeFormat =...
Intl.DateTimeFormat.prototype.formatRange() - JavaScript
The Intl.DateTimeFormat.prototype.formatRange() formats a date range in the most concise way based on the
locale and options provided when instantiating Intl.DateTimeFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.DateTimeFormat.prototype.formatRange(startDate, endDate) Examples Basic formatRange usage This method receives two Dates and formats the date range in the most concise way based on the
locale and options provided when instantiating Intl.DateTimeFormat. let date1 = new Date(Date.UTC(2007, 0, 10, 10, 0, 0)); let date2 = new Date(Date.UTC(2007, 0, 10, 11, 0, 0)); let date3 = new ...
Intl.DateTimeFormat.prototype.formatRangeToParts() - JavaScript
The Intl.DateTimeFormat.prototype.formatRangeToParts() method allows
locale-specific tokens representing each part of the formatted date range produced by DateTimeFormat formatters. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Intl.DateTimeFormat.prototype.formatRangeToParts(startDate, endDate) Examples Basic formatRangeToParts usage This method receives two Dates and returns an Array of objects containing the
locale-specific tokens representing each part of the formatted date range. let date1 = new Date(Date.UTC(2007, 0, 10, 10, 0, 0)); let date2 = new Date(Date.UTC(2007, 0, 10, 11, 0, 0)); // > 'Wed, ...
Intl.ListFormat() constructor - JavaScript
The Intl.ListFormat() constructor creates objects that enable language-sensitive list formatting. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax new Intl.ListFormat([
locales[, options]]) Parameters
locales Optional. A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the
locales argument, see the Intl page. options Optional. An object with some or all of the following properties:
localeMatcher The
locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option...
Intl.ListFormat.prototype.format() - JavaScript
hod returns a string with a language-specific representation of the list. Syntax listFormat.format([list]); Parameters list An iterable object, such as an Array Return value A language-specific formatted string representing the elements of the list Description The format() method returns a string that has been formatted based on parameters provided in the Intl.ListFormat object. The
locales and options parameters customize the behavior of format() and let applications specify the language conventions that should be used to format the list. Examples Using format The following example shows how to create a List formatter using the English language. const list = ['Motorcycle', 'Bus', 'Car']; console.log(new Intl.ListFormat('en-GB', { style: 'long', type: 'conjunction' }).format(...
Intl.NumberFormat.prototype.format() - JavaScript
The Intl.NumberFormat.prototype.format() method formats a number according to the
locale and formatting options of this NumberFormat object. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax numberFormat.format(number) Parameters number A Number or BigInt to format. Description The format getter function formats a number into a string according to the
locale and formatting options of this NumberFormat object. Examples Using format Use the format getter function for formatting a single currency value, here for Russia: var options = { style: 'currency', currency: 'RUB' }; var numberFormat = new Intl.Nu...
Intl.PluralRules.select() - JavaScript
The Intl.PluralRules.prototype.select method returns a String indicating which plural rule to use for
locale-aware formatting. Syntax pluralCategory = pluralRule.select(number) Parameters number The number to get a plural rule for. Return value A string representing the pluralization category of the number, can be one of zero, one, two, few, many or other. Description This function selects a pluralization category according to the
locale and formatting options of a PluralRules object. Examples Using select() new Intl.PluralRules('ar-EG').select(0); // -> 'zero' new Intl.PluralRules('ar-EG').select(1); // -> 'one' new Intl.PluralRules('ar-EG').select(2); // -> 'two' new Intl.PluralRules('ar-EG').select(6); // -> 'few' new Intl.PluralRules('ar-EG').select(18); // -> 'many' S...
Intl.RelativeTimeFormat.prototype.formatToParts() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax RelativeTimeFormat.formatToParts(value, unit) Parameters value Numeric value to use in the internationalized relative time message. unit Unit to use in the relative time internationalized message. ...
Number - JavaScript
This is the same as the global parseFloat() function. Number.parseInt(string, [radix]) This is the same as the global parseInt() function. Instance methods Number.prototype.toExponential(fractionDigits) Returns a string representing the number in exponential notation. Number.prototype.toFixed(digits) Returns a string representing the number in fixed-point notation. Number.prototype.to
LocaleString([
locales [, options]]) Returns a string with a language sensitive representation of this number. Overrides the Object.prototype.to
LocaleString() method. Number.prototype.toPrecision(precision) Returns a string representing the number to a specified precision in fixed-point or exponential notation. Number.prototype.toString([radix]) Returns a string representing the specified object in ...
Object.entries() - JavaScript
ue] pairs, in the same order as that provided by a for...in loop. (The only important difference is that a for...in loop enumerates properties in the prototype chain as well). The order of the array returned by Object.entries() does not depend on how an object is defined. If there is a need for certain ordering, then the array should be sorted first, like Object.entries(obj).sort((a, b) => b[0].
localeCompare(a[0]));. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax Object.entries(obj) Parameters obj The object whose own enumerable string-keyed property [key, value] pairs are to be returned. Return value...
Object.keys() - JavaScript
onments that do not natively support it, copy the following snippet: // From /docs/Web/JavaScript/Reference/Global_Objects/Object/keys if (!Object.keys) { Object.keys = (function() { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'to
LocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ], dontEnumsLength = dontEnums.length; return function(obj) { if (typeof obj !== 'function' && (typeof obj !== 'object' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result...
Object - JavaScript
erty as a direct property of that object and not inherited through the prototype chain. Object.prototype.isPrototypeOf() Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object. Object.prototype.propertyIsEnumerable() Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set. Object.prototype.to
LocaleString() Calls toString(). Object.prototype.toString() Returns a string representation of the object. Object.prototype.unwatch() Removes a watchpoint from a property of the object. Object.prototype.valueOf() Returns the primitive value of the specified object. Object.prototype.watch() Adds a watchpoint to a property of the object. Examples Using Object given undefined and null types T...
TypedArray - JavaScript
y.prototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). TypedArray.prototype.subarray() Returns a new TypedArray from the given start and end element index. TypedArray.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). TypedArray.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). TypedArray.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). TypedArray.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples New is requ...
Uint16Array - JavaScript
ototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Uint16Array.prototype.subarray() Returns a new Uint16Array from the given start and end element index. Uint16Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Uint16Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Uint16Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Uint16Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Different...
Uint32Array - JavaScript
ototype.sort() Sorts the elements of an array in place and returns the array. See also Array.prototype.sort(). Uint32Array.prototype.subarray() Returns a new Uint32Array from the given start and end element index. Uint32Array.prototype.values() Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values(). Uint32Array.prototype.to
LocaleString() Returns a localized string representing the array and its elements. See also Array.prototype.to
LocaleString(). Uint32Array.prototype.toString() Returns a string representing the array and its elements. See also Array.prototype.toString(). Uint32Array.prototype[@@iterator]() Returns a new Array Iterator object that contains the values for each index in the array. Examples Different...