UNPKG

9.37 kBSource Map (JSON)View Raw
1{"version":3,"file":"Localization.types.js","sourceRoot":"","sources":["../src/Localization.types.ts"],"names":[],"mappings":"AAgIA;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAuCX;AAvCD,WAAY,kBAAkB;IAC5B,6BAA6B;IAC7B,2CAAqB,CAAA;IACrB,mCAAmC;IACnC,yCAAmB,CAAA;IACnB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,kCAAkC;IAClC,qCAAe,CAAA;IACf,+DAA+D;IAC/D,yCAAmB,CAAA;IACnB,6DAA6D;IAC7D,2CAAqB,CAAA;IACrB,yBAAyB;IACzB,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,kCAAkC;IAClC,uCAAiB,CAAA;IACjB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,kGAAkG;IAClG,qDAA+B,CAAA;IAC/B,8CAA8C;IAC9C,mDAA6B,CAAA;IAC7B,wGAAwG;IACxG,mDAA6B,CAAA;IAC7B,oCAAoC;IACpC,2DAAqC,CAAA;IACrC,+EAA+E;IAC/E,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,0CAA0C;IAC1C,iCAAW,CAAA;AACb,CAAC,EAvCW,kBAAkB,KAAlB,kBAAkB,QAuC7B","sourcesContent":["// @needsAudit\nexport type Localization = {\n /**\n * Three-character ISO 4217 currency code. Returns `null` on web.\n * @example\n * `'USD'`, `'EUR'`, `'CNY'`, `null`\n */\n currency: string | null;\n /**\n * Decimal separator used for formatting numbers.\n * @example\n * `','`, `'.'`\n */\n decimalSeparator: string;\n /**\n * Digit grouping separator used when formatting numbers larger than 1000.\n * @example\n * `'.'`, `''`, `','`\n */\n digitGroupingSeparator: string;\n /**\n * A list of all the supported language ISO codes.\n */\n isoCurrencyCodes: string[];\n /**\n * Boolean value that indicates whether the system uses the metric system.\n * On Android and web, this is inferred from the current region.\n */\n isMetric: boolean;\n /**\n * Returns if the system's language is written from Right-to-Left.\n * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).\n *\n * Returns `false` in Server Side Rendering (SSR) environments.\n */\n isRTL: boolean;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),\n * consisting of a two-character language code and optional script, region and variant codes.\n * @example\n * `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'`\n */\n locale: string;\n /**\n * List of all the native languages provided by the user settings.\n * These are returned in the order that the user defined in the device settings.\n * @example\n * `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']`\n */\n locales: string[];\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS.\n * This value is always available on iOS, but might return `null` on Android or web.\n * @example\n * `'US'`, `'NZ'`, `null`\n */\n region: string | null;\n /**\n * The current time zone in display format.\n * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a\n * better estimation you could use the moment-timezone package but it will add significant bloat to\n * your website's bundle size.\n * @example\n * `'America/Los_Angeles'`\n */\n timezone: string;\n};\n\nexport type Locale = {\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) with a region code.\n * @example\n * `'en-US'`, `'es-419'`, `'pl-PL'`.\n */\n languageTag: string;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) without the region code.\n * @example\n * `'en'`, `'es'`, `'pl'`.\n */\n languageCode: string | null;\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS, Region settings on Android and is parsed from locale on Web (can be `null` on Web).\n */\n regionCode: string | null;\n /**\n * Currency code for the locale.\n * Is `null` on Web, use a table lookup based on region instead.\n * @example\n * `'USD'`, `'EUR'`, `'PLN'`.\n */\n currencyCode: string | null;\n /**\n * Currency symbol for the locale.\n * Is `null` on Web, use a table lookup based on region (if available) instead.\n * @example\n * `'$'`, `'€'`, `'zł'`.\n */\n currencySymbol: string | null;\n /**\n * Decimal separator used for formatting numbers with fractional parts.\n * @example\n * `'.'`, `','`.\n */\n decimalSeparator: string | null;\n /**\n * Digit grouping separator used for formatting large numbers.\n * @example\n * `'.'`, `','`.\n */\n digitGroupingSeparator: string | null;\n /**\n * Text direction for the locale. One of: `'ltr'`, `'rtl'`, but can also be `null` on some browsers without support for the [textInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/textInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n textDirection: 'ltr' | 'rtl' | null;\n /**\n * The measurement system used in the locale.\n * Is `null` on Web, as user chosen measurement system is not exposed on the web and using locale to determine measurement systems is unreliable.\n * Ask for user preferences if possible.\n */\n measurementSystem: `metric` | `us` | `uk` | null;\n /**\n * The temperature unit used in the locale.\n * Returns `null` if the region code is unknown.\n */\n temperatureUnit: 'celsius' | 'fahrenheit' | null;\n};\n\n/**\n * An enum mapping days of the week in Gregorian calendar to their index as returned by the `firstWeekday` property.\n */\nexport enum Weekday {\n SUNDAY = 1,\n MONDAY = 2,\n TUESDAY = 3,\n WEDNESDAY = 4,\n THURSDAY = 5,\n FRIDAY = 6,\n SATURDAY = 7,\n}\n\n/**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n * Gregorian calendar is aliased and can be referred to as both `CalendarIdentifier.GREGORIAN` and `CalendarIdentifier.GREGORY`.\n */\nexport enum CalendarIdentifier {\n /** Thai Buddhist calendar */\n BUDDHIST = 'buddhist',\n /** Traditional Chinese calendar */\n CHINESE = 'chinese',\n /** Coptic calendar */\n COPTIC = 'coptic',\n /** Traditional Korean calendar */\n DANGI = 'dangi',\n /** Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E) */\n ETHIOAA = 'ethioaa',\n /** Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.) */\n ETHIOPIC = 'ethiopic',\n /** Gregorian calendar */\n GREGORY = 'gregory',\n /** Gregorian calendar (alias) */\n GREGORIAN = 'gregory',\n /** Traditional Hebrew calendar */\n HEBREW = 'hebrew',\n /** Indian calendar */\n INDIAN = 'indian',\n /** Islamic calendar */\n ISLAMIC = 'islamic',\n /** Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - civil epoch) */\n ISLAMIC_CIVIL = 'islamic-civil',\n /** Islamic calendar, Saudi Arabia sighting */\n ISLAMIC_RGSA = 'islamic-rgsa',\n /**Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch) */\n ISLAMIC_TBLA = 'islamic-tbla',\n /** Islamic calendar, Umm al-Qura */\n ISLAMIC_UMALQURA = 'islamic-umalqura',\n /** ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules) */\n ISO8601 = 'iso8601',\n /** Japanese imperial calendar */\n JAPANESE = 'japanese',\n /** Persian calendar */\n PERSIAN = 'persian',\n /** Civil (algorithmic) Arabic calendar */\n ROC = 'roc',\n}\n\nexport type Calendar = {\n /**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n *\n * On Android is limited to one of device's [available calendar types](https://developer.android.com/reference/java/util/Calendar#getAvailableCalendarTypes()).\n *\n * On iOS uses [calendar identifiers](https://developer.apple.com/documentation/foundation/calendar/identifier), but maps them to the corresponding Unicode types, will also never contain `'dangi'` or `'islamic-rgsa'` due to it not being implemented on iOS.\n */\n calendar: CalendarIdentifier | null;\n /**\n * True when current device settings use 24-hour time format.\n * Can be null on some browsers that don't support the [hourCycle](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n uses24hourClock: boolean | null;\n /**\n * The first day of the week. For most calendars Sunday is numbered `1`, with Saturday being number `7`.\n * Can be null on some browsers that don't support the [weekInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n * @example\n * `1`, `7`.\n */\n firstWeekday: Weekday | null;\n /**\n * Time zone for the calendar. Can be `null` on Web.\n * @example\n * `'America/Los_Angeles'`, `'Europe/Warsaw'`, `'GMT+1'`.\n */\n timeZone: string | null;\n};\n"]}
\No newline at end of file