Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,183 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
/**
The `Collator` object is a constructor for collators, objects that enable language
sensitive string comparison.
Documentation [Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.Collator")
extern class Collator {
@:overload(function(?locales:Array<String>, ?options:CollatorOptions):Void {})
@:pure function new(?locales:String, ?options:CollatorOptions);
/**
Getter function that compares two strings according to the sort order of this `Collator` object.
*/
@:pure function compare(string1:String, string2:String):Int;
/**
Returns a new object with properties reflecting the locale and collation options computed
during initialization of the object.
*/
@:pure function resolvedOptions():CollatorResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
@param locales A string with a BCP 47 language tag, or an array of such strings.
**/
@:overload(function(locales:Array<String>, ?options:CollatorSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:CollatorSupportedLocalesOfOptions):Array<String>;
}
typedef CollatorOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
Whether the comparison is for sorting or for searching for matching strings.
The default is `Sort`.
**/
var ?usage:Usage;
/**
Which differences in the strings should lead to non-zero result values.
The default is `Variant` for usage `Sort`; it's locale dependent for usage `Search`.
**/
var ?sensitivity:Sensitivity;
/**
Whether punctuation should be ignored.
The default is `false`.
**/
var ?ignorePunctuation:Bool;
/**
Whether numeric collation should be used, such that "1" < "2" < "10".
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.
**/
var ?numeric:Bool;
/**
Whether upper case or lower case should sort first.
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.
**/
var ?caseFirst:String;
}
typedef CollatorResolvedOptions = {
/**
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`.
**/
final locale:String;
final usage:Usage;
final sensitivity:Sensitivity;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
**/
final ignorePunctuation:Bool;
/**
he value requested using the Unicode extension key `"co"`, if it is supported for `Locale`,
or `Default`.
**/
final collation:Collation;
final numeric:Bool;
/**
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.
**/
final caseFirst:CaseFirst;
}
enum abstract Usage(String) {
var Sort = "sort";
var Search = "search";
}
enum abstract Sensitivity(String) {
/**
Only strings that differ in base letters compare as unequal.
Examples: a ≠ b, a = á, a = A.
**/
var Base = "base";
/**
Only strings that differ in base letters or accents and other diacritic marks compare as unequal.
Examples: a ≠ b, a ≠ á, a = A.
**/
var Accent = "accent";
/**
Only strings that differ in base letters or case compare as unequal.
Examples: a ≠ b, a = á, a ≠ A.
**/
var Case = "case";
/**
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.
**/
var Variant = "variant";
}
enum abstract CaseFirst(String) {
var Upper = "upper";
var Lower = "lower";
var False = "false";
}
enum abstract Collation(String) {
var Locale = "locale";
var Default = "default";
}
typedef CollatorSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,386 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
/**
The `DateTimeFormat` object is a constructor for objects that enable language-sensitive
date and time formatting.
Documentation [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.DateTimeFormat")
extern class DateTimeFormat {
@:overload(function(?locales:Array<String>, ?options:DateTimeFormatOptions):Void {})
@:pure function new(?locales:String, ?options:DateTimeFormatOptions);
/**
Getter function that formats a date according to the locale and formatting options
of this `DateTimeFormat` object.
**/
@:overload(function(date:js.lib.Date):String {})
@:pure function format(date:Date):String;
/**
Returns an `Array` of objects representing the date string in parts that can be used
for custom locale-aware formatting.
**/
@:overload(function(date:js.lib.Date):Array<DateTimeFormatPart> {})
@:pure function formatToParts(date:Date):Array<DateTimeFormatPart>;
/**
Returns a new object with properties reflecting the locale and formatting options
computed during initialization of the object.
**/
@:pure function resolvedOptions():DateTimeFormatResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:DateTimeFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:DateTimeFormatSupportedLocalesOfOptions):Array<String>;
}
typedef DateTimeFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
**/
var ?localeMatcher:LocaleMatcher;
/**
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](https://www.iana.org/time-zones),
such as `"Asia/Shanghai"`, `"Asia/Kolkata"`, `"America/New_York"`.
**/
var ?timeZone:String;
/**
Whether to use 12-hour time (as opposed to 24-hour time).
The default is locale dependent.
This option overrides the hc language tag and/or the `hourCycle` option in case both are present.
**/
var ?hour12:Bool;
/**
The hour cycle to use. This option overrides the `hc` language tag, if both are present,
and the `Hour12` option takes precedence in case both options have been specified.
**/
var ?hourCycle:HourCycle;
/**
The format matching algorithm to use.
The default is `BestFit`.
See the following paragraphs for information about the use of this property.
**/
var ?formatMatcher:FormatMatcher;
/**
The representation of the weekday.
**/
var ?weekday:WeekdayRepresentation;
/**
The representation of the era.
**/
var ?era:EraRepresentation;
/**
The representation of the year.
**/
var ?year:YearRepresentation;
/**
The representation of the month.
**/
var ?month:MonthRepresentation;
/**
The representation of the day.
**/
var ?day:DayRepresentation;
/**
The representation of the hour.
**/
var ?hour:HourRepresentation;
/**
The representation of the minute.
**/
var ?minute:MinuteRepresentation;
/**
The representation of the second.
**/
var ?second:SecondRepresentation;
/**
The representation of the time zone name.
**/
var ?timeZoneName:TimeZoneName;
}
typedef DateTimeFormatResolvedOptions = {
/**
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`.
**/
final locale:String;
/**
E.g. "gregory"
**/
final calendar:String;
/**
The values requested using the Unicode extension keys "ca" and "nu" or filled in as default values.
**/
final numberingSystem:String;
/**
The value provided for this property in the options argument; `undefined` (representing the runtime's
default time zone) if none was provided.
Warning: Applications should not rely on `undefined` being returned, as future versions may return
a String value identifying the runtimes default time zone instead.
**/
final timeZone:Null<String>;
/**
The value provided for this property in the `options` argument or filled in as a default.
**/
final hour12:Bool;
final weekday:WeekdayRepresentation;
final era:EraRepresentation;
final year:YearRepresentation;
final month:MonthRepresentation;
final day:DayRepresentation;
final hour:HourRepresentation;
final minute:MinuteRepresentation;
final second:SecondRepresentation;
/**
The values resulting from format matching between the corresponding properties in the `options` argument
and the available combinations and representations for date-time formatting in the selected locale.
Some of these properties may not be present, indicating that the corresponding components will not be
represented in formatted output.
**/
final timeZoneName:TimeZoneName;
}
enum abstract HourCycle(String) {
var H11 = "h11";
var H12 = "h12";
var H23 = "h23";
var H24 = "h24";
}
enum abstract FormatMatcher(String) {
var Basic = "basic";
var BestFit = "best fit";
}
enum abstract WeekdayRepresentation(String) {
/**
(e.g., Thursday)
*/
var Long = "long";
/**
(e.g., Thu)
*/
var Short = "short";
/**
(e.g., T). Two weekdays may have the same narrow style for some locales (e.g. Tuesday's narrow style is also T).
*/
var Narrow = "narrow";
}
enum abstract EraRepresentation(String) {
/**
(e.g., Anno Domini)
*/
var Long = "long";
/**
(e.g., AD)
*/
var Short = "short";
/**
(e.g., A)
*/
var Narrow = "narrow";
}
enum abstract YearRepresentation(String) {
/**
(e.g., 2012)
**/
var Numeric = "numeric";
/**
(e.g., 12)
**/
var TwoDigit = "2-digit";
}
enum abstract MonthRepresentation(String) {
/**
(e.g., 2)
**/
var Numeric = "numeric";
/**
(e.g., 02)
**/
var TwoDigit = "2-digit";
/**
(e.g., March)
**/
var Long = "long";
/**
(e.g., Mar)
**/
var Short = "short";
/**
(e.g., M). Two months may have the same narrow style for some locales (e.g. May's narrow style is also M).
**/
var Narrow = "narrow";
}
enum abstract DayRepresentation(String) {
/**
(e.g., 1)
**/
var Numeric = "numeric";
/**
(e.g., 01)
**/
var TwoDigit = "2-digit";
}
enum abstract HourRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract MinuteRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract SecondRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract TimeZoneName(String) {
/**
(e.g., British Summer Time)
**/
var Long = "long";
/**
(e.g., GMT+1)
**/
var Short = "short";
}
typedef DateTimeFormatPart = {
var type(default, never):DateTimeFormatPartType;
var value(default, never):String;
}
enum abstract DateTimeFormatPartType(String) {
/**
The string used for the day, for example "17".
**/
var Day = "day";
/**
The string used for the day period, for example, "AM" or "PM".
**/
var DayPeriod = "dayPeriod";
/**
The string used for the era, for example "BC" or "AD".
**/
var Era = "era";
/**
The string used for the hour, for example "3" or "03".
**/
var Hour = "hour";
/**
The string used for separating date and time values, for example "/", ",", "o'clock", "de", etc.
**/
var Literal = "literal";
/**
The string used for the minute, for example "00".
**/
var Minute = "minute";
/**
The string used for the month, for example "12".
**/
var Month = "month";
/**
The string used for the second, for example "07" or "42".
**/
var Second = "second";
/**
The string used for the name of the time zone, for example "UTC".
**/
var TimeZoneName = "timeZoneName";
/**
The string used for the weekday, for example "M", "Monday", or "Montag".
**/
var Weekday = "weekday";
/**
The string used for the year, for example "2012" or "96".
**/
var Year = "year";
}
typedef DateTimeFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
enum abstract LocaleMatcher(String) {
var Lookup = "lookup";
var BestFit = "best fit";
}

View File

@ -0,0 +1,283 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
/**
The `NumberFormat` object is a constructor for objects that enable language sensitive number formatting.
Documentation [NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.NumberFormat")
extern class NumberFormat {
@:overload(function(?locales:Array<String>, ?options:NumberFormatOptions):Void {})
@:pure function new(?locales:String, ?options:NumberFormatOptions);
/**
Getter function that formats a number according to the locale
and formatting options of this `NumberFormat` object.
**/
@:pure function format(number:Float):String;
/**
Returns an `Array` of objects representing the number string in parts
that can be used for custom locale-aware formatting.
**/
@:pure function formatToParts(?number:Float):Array<NumberFormatPart>;
/**
Returns a new object with properties reflecting the locale and collation options
computed during initialization of the object.
**/
@:pure function resolvedOptions():NumberFormatResolvedOption;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:NumberFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:NumberFormatSupportedLocalesOfOptions):Array<String>;
}
typedef NumberFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
The formatting style to use.
The default is `Decimal`.
**/
var ?style:NumberFormatStyle;
/**
The currency to use in currency formatting. Possible values are the ISO 4217 currency codes,
such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB — see the
[Current currency & funds code list](https://www.currency-iso.org/en/home/tables/table-a1.html).
There is no default value; if the style is "currency", the currency property must be provided.
**/
var ?currency:String;
/**
How to display the currency in currency formatting.
The default is `Symbol`.
**/
var ?currencyDisplay:CurrencyDisplay;
/**
Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators.
The default is `true`.
**/
var ?useGrouping:Bool;
/**
The minimum number of integer digits to use.
Possible values are from 1 to 21; the default is 1.
**/
var ?minimumIntegerDigits:Int;
/**
The minimum number of fraction digits to use.
Possible values are from 0 to 20; the default for plain number and percent formatting is 0;
the default for currency formatting is the number of minor unit digits provided by the
[ISO 4217 currency code list](http://www.currency-iso.org/en/home/tables/table-a1.html)
(2 if the list doesn't provide that information).
**/
var ?minimumFractionDigits:Int;
/**
The maximum number of fraction digits to use.
Possible values are from 0 to 20; the default for plain number formatting is the larger of
minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits
and the number of minor unit digits provided by the [ISO 4217 currency code list](http://www.currency-iso.org/en/home/tables/table-a1.html)
(2 if the list doesn't provide that information); the default for percent formatting is the larger of
minimumFractionDigits and 0.
**/
var ?maximumFractionDigits:Int;
/**
The minimum number of significant digits to use.
Possible values are from 1 to 21; the default is 1.
**/
var ?minimumSignificantDigits:Int;
/**
The maximum number of significant digits to use.
Possible values are from 1 to 21; the default is 21.
**/
var ?maximumSignificantDigits:Int;
}
typedef NumberFormatResolvedOption = {
/**
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`.
**/
final locale:String;
/**
The value requested using the Unicode extension key `"nu"` or filled in as a default.
**/
final numberingSystem:String;
final style:NumberFormatStyle;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
**/
final useGrouping:String;
final currency:String;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are only present if `style` is `"currency"`.
**/
final currencyDisplay:String;
final minimumIntegerDigits:Int;
final minimumFractionDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if neither m`inimumSignificantDigits` nor `maximumSignificantDigits`
was provided in the `options` argument.
**/
final maximumFractionDigits:Int;
final minimumSignificantDigits:Int;
/**
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.
**/
final maximumSignificantDigits:Int;
}
enum abstract NumberFormatStyle(String) {
/**
plain number formatting
**/
var Decimal = "decimal";
/**
currency formatting
**/
var Currency = "currency";
/**
percent formatting
**/
var Percent = "percent";
}
enum abstract CurrencyDisplay(String) {
/**
To use a localized currency symbol such as €.
**/
var Symbol = "symbol";
/**
To use the ISO currency code.
**/
var Code = "code";
/**
To use a localized currency name such as "dollar".
**/
var Name = "name";
}
typedef NumberFormatPart = {
final type:NumberFormatPartType;
final value:String;
}
enum abstract NumberFormatPartType(String) {
/**
The currency string, such as the symbols "$" and "€" or the name "Dollar", "Euro" depending
on how currencyDisplay is specified.
**/
var Currency = "currency";
/**
The decimal separator string (".").
**/
var Decimal = "decimal";
/**
The fraction number.
**/
var Fraction = "fraction";
/**
The group separator string (",").
**/
var group = "group";
/**
The Infinity string ("∞").
**/
var infinity = "infinity";
/**
The integer number.
**/
var integer = "integer";
/**
Any literal strings or whitespace in the formatted number.
**/
var literal = "literal";
/**
The minus sign string ("-").
**/
var minusSign = "minusSign";
/**
The NaN string ("NaN").
**/
var nan = "nan";
/**
The plus sign string ("+").
**/
var plusSign = "plusSign";
/**
The percent sign string ("%").
**/
var percentSign = "percentSign";
}
typedef NumberFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,124 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
/**
The `PluralRules` object is a constructor for objects that enable plural sensitive formatting
and plural language rules.
Documentation [PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.PluralRules")
extern class PluralRules {
@:overload(function(?locales:Array<String>, ?options:PluralRulesOptions):Void {})
@:pure function new(?locales:String, ?options:PluralRulesOptions);
/**
Returns a new object with properties reflecting the locale and collation options computed during initialization of the object.
**/
@:pure function resolvedOptions():PluralRulesResolvedOptions;
/**
Returns a String indicating which plurar rule to use for locale-aware formatting.
**/
@:pure function select(number:Int):String;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:PluralRulesSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:PluralRulesSupportedLocalesOfOptions):Array<String>;
}
typedef PluralRulesOptions = {
/**
The locale matching algorithm to use.
The default is "best fit".
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
*/
var ?localeMatcher:LocaleMatcher;
/**
The type to use.
The default is `Cardinal`.
*/
var ?type:PluralRulesType;
}
typedef PluralRulesResolvedOptions = {
/**
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`.
*/
final locale:String;
/**
An `Array` of plural rules used by the given language.
**/
final pluralCategories:Array<String>;
/**
The type used (cardinal or ordinal).
**/
final type:PluralRulesType;
final minimumIntegerDigits:Int;
final minimumFractionDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if neither `minimumSignificantDigits` nor `maximumSignificantDigits`
was provided in the options argument.
**/
final maximumFractionDigits:Int;
final minimumSignificantDigits:Int;
/**
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.
**/
final maximumSignificantDigits:Int;
}
enum abstract PluralRulesType(String) {
/**
For cardinal numbers (refering to the quantity of things).
*/
var Cardinal = "cardinal";
/**
For ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in English).
*/
var Ordinal = "ordinal";
}
typedef PluralRulesSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,163 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package js.lib.intl;
/**
The `RelativeTimeFormat` object is a constructor for objects that enable language-sensitive
relative time formatting.
Documentation [RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.RelativeTimeFormat")
extern class RelativeTimeFormat {
@:overload(function(?locales:Array<String>, ?options:RelativeTimeFormatOptions):Void {})
@:pure function new(?locales:String, ?options:RelativeTimeFormatOptions);
/**
Formats a value and a unit according to the locale and formatting options
of the given Intl.RelativeTimeFormat object.
**/
@:pure function format(value:Float, unit:RelativeTimeUnit):String;
/**
Returns an Array of objects representing the relative time format in parts
that can be used for custom locale-aware formatting.
**/
@:pure function formatToParts(value:Float, unit:RelativeTimeUnit):Array<RelativeTimeFormatPart>;
/**
Returns a new object with properties reflecting the locale and formatting options
computed during initialization of the object.
**/
@:pure function resolvedOptions():RelativeTimeFormatResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String>;
}
typedef RelativeTimeFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
The format of output message.
The default value is `Always`.
The `Auto` value allows to not always have to use numeric values in the output.
**/
var ?numeric:RelativeTimeNumeric;
/**
The length of the internationalized message.
The default value is `Long`.
The `Narrow` style could be similar to the short style for some locales.
**/
var ?style:RelativeTimeFormatStyle;
}
typedef RelativeTimeFormatResolvedOptions = {
/**
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`.
**/
final locale:String;
/**
The length of the internationalized message.
**/
final style:RelativeTimeFormatStyle;
/**
The format of output message.
**/
final numeric:RelativeTimeNumeric;
/**
The value requested using the Unicode extension key `"nu"` or filled in as a default.
**/
final numberingSystem:String;
}
enum abstract RelativeTimeNumeric(String) {
/**
(e.g., 1 day ago),
**/
var Always = "always";
/**
(e.g., yesterday).
**/
var Auto = "auto";
}
enum abstract RelativeTimeFormatStyle(String) {
/**
(e.g., in 1 month)
*/
var Long = "long";
/**
(e.g., in 1 mo.)
*/
var Short = "short";
/**
(e.g., in 1 mo.)
*/
var Narrow = "narrow";
}
enum abstract RelativeTimeUnit(String) from String to String {
var Year = "year";
var Quarter = "quarter";
var Month = "month";
var Week = "week";
var Day = "day";
var Hour = "hour";
var Minute = "minute";
var Second = "second";
}
typedef RelativeTimeFormatPart = {
final type:RelativeTimeFormatPartType;
final value:String;
final ?unit:RelativeTimeUnit;
}
typedef RelativeTimeFormatPartType = NumberFormat.NumberFormatPartType;
typedef RelativeTimeFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}