From ee1f19385d481386ae2c1d911545143999329d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Andre=20Sundt?= Date: Sun, 30 Aug 2020 01:44:56 +0200 Subject: [PATCH 1/4] Added build tool to generate translations for any language based on Intl.RelativeTimeFormat with node full-icu; updated existing translations. --- build/translation-generator/all-locales.ts | 375 +++++++++++ .../generate-translations.ts | 186 ++++++ build/translation-generator/index.ts | 31 + .../supported-locales.ts | 6 + dist/amd/aurelia-i18n.js | 588 ++++++++--------- dist/commonjs/aurelia-i18n.js | 588 ++++++++--------- dist/es2015/aurelia-i18n.js | 594 +++++++++--------- dist/es2017/aurelia-i18n.js | 594 +++++++++--------- dist/native-modules/aurelia-i18n.js | 588 ++++++++--------- dist/system/aurelia-i18n.js | 588 ++++++++--------- dist/umd-es2015/aurelia-i18n.js | 594 +++++++++--------- dist/umd/aurelia-i18n.js | 588 ++++++++--------- package-lock.json | 6 +- package.json | 3 +- src/defaultTranslations/relative.time.ts | 588 ++++++++--------- test/unit/relative.time.spec.ts | 17 +- 16 files changed, 3302 insertions(+), 2632 deletions(-) create mode 100644 build/translation-generator/all-locales.ts create mode 100644 build/translation-generator/generate-translations.ts create mode 100644 build/translation-generator/index.ts create mode 100644 build/translation-generator/supported-locales.ts diff --git a/build/translation-generator/all-locales.ts b/build/translation-generator/all-locales.ts new file mode 100644 index 00000000..ebe244b9 --- /dev/null +++ b/build/translation-generator/all-locales.ts @@ -0,0 +1,375 @@ +// Complete list of the locales in the Unicode CLDR registry +const locales: string[] = [ + "af", + "af-NA", + "am", + "ar", + "ar-AE", + "ar-BH", + "ar-DJ", + "ar-DZ", + "ar-EG", + "ar-EH", + "ar-ER", + "ar-IL", + "ar-IQ", + "ar-JO", + "ar-KM", + "ar-KW", + "ar-LB", + "ar-LY", + "ar-MA", + "ar-MR", + "ar-OM", + "ar-PS", + "ar-QA", + "ar-SA", + "ar-SD", + "ar-SO", + "ar-SS", + "ar-SY", + "ar-TD", + "ar-TN", + "ar-YE", + "as", + "az", + "az-Latn", + "be", + "bg", + "bn", + "bn-IN", + "bs", + "bs-Latn", + "ca", + "ca-AD", + "ca-ES-VALENCIA", + "ca-FR", + "ca-IT", + "cs", + "cy", + "da", + "da-GL", + "de", + "de-AT", + "de-BE", + "de-CH", + "de-IT", + "de-LI", + "de-LU", + "el", + "el-CY", + "en", + "en-001", + "en-150", + "en-AE", + "en-AG", + "en-AI", + "en-AS", + "en-AT", + "en-AU", + "en-BB", + "en-BE", + "en-BI", + "en-BM", + "en-BS", + "en-BW", + "en-BZ", + "en-CA", + "en-CC", + "en-CH", + "en-CK", + "en-CM", + "en-CX", + "en-CY", + "en-DE", + "en-DG", + "en-DK", + "en-DM", + "en-ER", + "en-FI", + "en-FJ", + "en-FK", + "en-FM", + "en-GB", + "en-GD", + "en-GG", + "en-GH", + "en-GI", + "en-GM", + "en-GU", + "en-GY", + "en-HK", + "en-IE", + "en-IL", + "en-IM", + "en-IN", + "en-IO", + "en-JE", + "en-JM", + "en-KE", + "en-KI", + "en-KN", + "en-KY", + "en-LC", + "en-LR", + "en-LS", + "en-MG", + "en-MH", + "en-MO", + "en-MP", + "en-MS", + "en-MT", + "en-MU", + "en-MW", + "en-MY", + "en-NA", + "en-NF", + "en-NG", + "en-NL", + "en-NR", + "en-NU", + "en-NZ", + "en-PG", + "en-PH", + "en-PK", + "en-PN", + "en-PR", + "en-PW", + "en-RW", + "en-SB", + "en-SC", + "en-SD", + "en-SE", + "en-SG", + "en-SH", + "en-SI", + "en-SL", + "en-SS", + "en-SX", + "en-SZ", + "en-TC", + "en-TK", + "en-TO", + "en-TT", + "en-TV", + "en-TZ", + "en-UG", + "en-UM", + "en-US-POSIX", + "en-VC", + "en-VG", + "en-VI", + "en-VU", + "en-WS", + "en-ZA", + "en-ZM", + "en-ZW", + "es", + "es-419", + "es-AR", + "es-BO", + "es-BR", + "es-BZ", + "es-CL", + "es-CO", + "es-CR", + "es-CU", + "es-DO", + "es-EA", + "es-EC", + "es-GQ", + "es-GT", + "es-HN", + "es-IC", + "es-MX", + "es-NI", + "es-PA", + "es-PE", + "es-PH", + "es-PR", + "es-PY", + "es-SV", + "es-US", + "es-UY", + "es-VE", + "et", + "eu", + "fa", + "fa-AF", + "fi", + "fil", + "fr", + "fr-BE", + "fr-BF", + "fr-BI", + "fr-BJ", + "fr-BL", + "fr-CA", + "fr-CD", + "fr-CF", + "fr-CG", + "fr-CH", + "fr-CI", + "fr-CM", + "fr-DJ", + "fr-DZ", + "fr-GA", + "fr-GF", + "fr-GN", + "fr-GP", + "fr-GQ", + "fr-HT", + "fr-KM", + "fr-LU", + "fr-MA", + "fr-MC", + "fr-MF", + "fr-MG", + "fr-ML", + "fr-MQ", + "fr-MR", + "fr-MU", + "fr-NC", + "fr-NE", + "fr-PF", + "fr-PM", + "fr-RE", + "fr-RW", + "fr-SC", + "fr-SN", + "fr-SY", + "fr-TD", + "fr-TG", + "fr-TN", + "fr-VU", + "fr-WF", + "fr-YT", + "ga", + "ga-GB", + "gl", + "gu", + "he", + "hi", + "hr", + "hr-BA", + "hu", + "hy", + "id", + "is", + "it", + "it-CH", + "it-SM", + "it-VA", + "ja", + "jv", + "ka", + "kk", + "km", + "kn", + "ko", + "ko-KP", + "ky", + "lo", + "lt", + "lv", + "mk", + "ml", + "mn", + "mr", + "ms", + "ms-BN", + "ms-SG", + "my", + "nb", + "nb-SJ", + "ne", + "ne-IN", + "nl", + "nl-AW", + "nl-BE", + "nl-BQ", + "nl-CW", + "nl-SR", + "nl-SX", + "or", + "pa", + "pa-Guru", + "pl", + "ps", + "ps-PK", + "pt", + "pt-AO", + "pt-CH", + "pt-CV", + "pt-GQ", + "pt-GW", + "pt-LU", + "pt-MO", + "pt-MZ", + "pt-PT", + "pt-ST", + "pt-TL", + "ro", + "ro-MD", + "ru", + "ru-BY", + "ru-KG", + "ru-KZ", + "ru-MD", + "ru-UA", + "sd", + "si", + "sk", + "sl", + "so", + "so-DJ", + "so-ET", + "so-KE", + "sq", + "sq-MK", + "sq-XK", + "sr", + "sr-Cyrl", + "sr-Cyrl-BA", + "sr-Cyrl-ME", + "sr-Cyrl-XK", + "sr-Latn", + "sr-Latn-BA", + "sr-Latn-ME", + "sr-Latn-XK", + "sv", + "sv-AX", + "sv-FI", + "sw", + "sw-CD", + "sw-KE", + "sw-UG", + "ta", + "ta-LK", + "ta-MY", + "ta-SG", + "te", + "th", + "tk", + "tr", + "tr-CY", + "uk", + "ur", + "ur-IN", + "uz", + "uz-Latn", + "vi", + "yue", + "yue-Hant", + "zh", + "zh-Hans", + "zh-Hans-HK", + "zh-Hans-MO", + "zh-Hans-SG", + "zh-Hant", + "zh-Hant-HK", + "zh-Hant-MO", + "zu" +]; + +export = locales; diff --git a/build/translation-generator/generate-translations.ts b/build/translation-generator/generate-translations.ts new file mode 100644 index 00000000..b15af813 --- /dev/null +++ b/build/translation-generator/generate-translations.ts @@ -0,0 +1,186 @@ +declare namespace Intl { + + type RelativeTimeUnit = "year" | "quarter" | "month" | "week" | "day" | "hour" | "minute" | "second" | + "years" | "quarters" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"; + + interface LocaleMatchable { + localeMatcher?: "best fit" | "lookup"; + } + interface FormatPart { + type: "integer" | "string"; + value: number | string; + } + interface IntegerFormatPart extends FormatPart { + type: "integer"; + value: number; + unit: string; + } + interface LiteralFormatPart { + type: "literal"; + value: string; + } + interface RelativeTimeOptions extends LocaleMatchable { + numeric?: "auto" | "always", + style?: "long" | "short" | "narrow"; + } + + interface RelativeTimeFormat { + format: (value: number, unit: RelativeTimeUnit) => string; + formatToParts: (value: number, unit: RelativeTimeUnit) => Array; + resolvedOptions(): RelativeTimeOptions; + } + + var RelativeTimeFormat: { + new(locales?: string | string[], options?: RelativeTimeOptions): RelativeTimeFormat; + (locales?: string | string[], options?: RelativeTimeOptions): RelativeTimeFormat; + supportedLocalesOf(locales: string | string[], options?: LocaleMatchable): string[]; + }; +} + +export type TranslationData = Record; + +export interface TranslationTemplate extends Record { + second_ago: T; + second_ago_plural: T; + second_in: T; + second_in_plural: T; + minute_ago: T; + minute_ago_plural: T; + minute_in: T; + minute_in_plural: T; + hour_ago: T; + hour_ago_plural: T; + hour_in: T; + hour_in_plural: T; + day_ago: T; + day_ago_plural: T; + day_in: T; + day_in_plural: T; + month_ago: T; + month_ago_plural: T; + month_in: T; + month_in_plural: T; + year_ago: T; + year_ago_plural: T; + year_in: T; + year_in_plural: T; +} + +export type Translation = TranslationTemplate; + +const template: TranslationTemplate<[number, Intl.RelativeTimeUnit]> = { + second_ago: [-1, "second"], + second_ago_plural: [-53, "second"], + second_in: [1, "second"], + second_in_plural: [53, "second"], + minute_ago: [-1, "minute"], + minute_ago_plural: [-53, "minute"], + minute_in: [1, "minute"], + minute_in_plural: [53, "minute"], + hour_ago: [-1, "hour"], + hour_ago_plural: [-53, "hour"], + hour_in: [1, "hour"], + hour_in_plural: [53, "hour"], + day_ago: [-1, "day"], + day_ago_plural: [-53, "day"], + day_in: [1, "day"], + day_in_plural: [53, "day"], + month_ago: [-1, "month"], + month_ago_plural: [-53, "month"], + month_in: [1, "month"], + month_in_plural: [53, "month"], + year_ago: [-1, "year"], + year_ago_plural: [-53, "year"], + year_in: [1, "year"], + year_in_plural: [53, "year"], +}; + +function getRuntimeSupportedLocales(list: string[]): string[] { + const result = []; + let batchIndex = 0; + const batchSize = 10; + while (batchIndex + batchSize < list.length) { + const batch = list.slice( + batchIndex, + Math.min(batchIndex + batchSize, list.length) + ); + const supported = Intl.RelativeTimeFormat.supportedLocalesOf(batch); + result.push(...supported); + batchIndex += batchSize; + } + return result; +} + +function buildCompleteTranslations(locales: string[]): TranslationData { + + const allTranslations: TranslationData = {}; + + for (const locale of locales) { + const translation: Partial = {}; + + const relTime = new Intl.RelativeTimeFormat(locale, { numeric: "always", style: "long" }); + + Object.keys(template).forEach(key => { + const params = template[key]; + const parts = relTime.formatToParts(...params); + + const val = parts.map(part => { + if (!["literal", "integer"].includes(part.type)) { + throw new Error(`Unexpected part! locale ${locale}, key: ${key}, type: ${part.type}`); + } + return part.type === "integer" ? "__count__" : part.value; + }).join(""); + + translation[key] = val; + }); + + allTranslations[locale] = { translation: translation as Translation }; + } + + return allTranslations; + +} + +function areEqual(tr1: Translation, tr2: Translation): boolean { + const tr1Keys = Object.keys(tr1).sort(); + const tr2Keys = Object.keys(tr2).sort(); + const keysAreEqual = tr1Keys.join("") === tr2Keys.join(""); + if (!keysAreEqual) { + return false; + } + let result = true; + for (const key of tr1Keys) { + if (tr1[key] !== tr2[key]) { + result = false; + break; + } + } + return result; +} + +function removeRedundantTranslations(trData: TranslationData): void { + const subLocales = Object.keys(trData).filter(k => k.includes("-")); + for (const sl of subLocales) { + const mainLocale = sl.split("-")[0]; + if (trData[mainLocale] && areEqual(trData[mainLocale].translation, trData[sl].translation)) { + delete trData[sl]; + } + } +} + +export function generateTranslations(locales: string[]): TranslationData { + console.log(locales); + const runtimeSupportedLocales = getRuntimeSupportedLocales(locales); + + // Getting a list of the unsupported locales for debugging + const unsupportedLocales = locales.filter(l => !runtimeSupportedLocales.includes(l)); + console.log("Ignoring following unsupported locales:", unsupportedLocales); + + console.log("Building translations..."); + const translations = buildCompleteTranslations(runtimeSupportedLocales); + + console.log("Removing redundant translations..."); + removeRedundantTranslations(translations); + + return translations; +} diff --git a/build/translation-generator/index.ts b/build/translation-generator/index.ts new file mode 100644 index 00000000..137b348e --- /dev/null +++ b/build/translation-generator/index.ts @@ -0,0 +1,31 @@ +import * as fs from "fs"; +import * as path from "path"; +import * as process from "process"; +import { generateTranslations } from "./generate-translations"; + +/** + * Generates translations file by using Intl.RelativeTimeFormat with node full-icu + * Can generate the full translation for any language, except the "now" variable + * command line args: outputPath for file to generate + */ + +const outFile = process.argv[2]; +if (!outFile || !fs.existsSync(path.dirname(outFile))) { + throw new Error("Invalid or missing output file argument"); +} + +const translations = generateTranslations(require("./supported-locales")); +const transJs = JSON.stringify(translations, null, 2) + .replace(/"([^"-]+)":/g, (_, g) => `${g}:`) + .replace(/"/g, "'"); + +fs.writeFileSync( + outFile, + `// tslint:disable +export type DefaultTranslations = { + [key: string]: string | DefaultTranslations +} + +export const translations: DefaultTranslations = ${transJs}; +// tslint:enable +`); diff --git a/build/translation-generator/supported-locales.ts b/build/translation-generator/supported-locales.ts new file mode 100644 index 00000000..1580db69 --- /dev/null +++ b/build/translation-generator/supported-locales.ts @@ -0,0 +1,6 @@ +// List of the locales supported in aurelia-i18n +const locales: string[] = [ + "ar", "da", "de", "en", "es", "fi", "fr", "it", "ja", "lt", "nl", "nn", "nb", "pl", "pt", "sv", "th", "zh", "zh-CN", "zh-HK", "zh-TW" +]; + +export = locales; diff --git a/dist/amd/aurelia-i18n.js b/dist/amd/aurelia-i18n.js index a48939bc..1390b810 100644 --- a/dist/amd/aurelia-i18n.js +++ b/dist/amd/aurelia-i18n.js @@ -605,59 +605,59 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -723,57 +723,57 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -810,28 +810,28 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -839,28 +839,28 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -897,171 +897,171 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1069,51 +1069,59 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1148,59 +1156,59 @@ define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-depend 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/commonjs/aurelia-i18n.js b/dist/commonjs/aurelia-i18n.js index 88cdfbd6..7e576da9 100644 --- a/dist/commonjs/aurelia-i18n.js +++ b/dist/commonjs/aurelia-i18n.js @@ -618,59 +618,59 @@ var translations = { ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -736,57 +736,57 @@ var translations = { now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -823,28 +823,28 @@ var translations = { now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -852,28 +852,28 @@ var translations = { now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -910,171 +910,171 @@ var translations = { now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1082,51 +1082,59 @@ var translations = { th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1161,59 +1169,59 @@ var translations = { 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/es2015/aurelia-i18n.js b/dist/es2015/aurelia-i18n.js index 03189557..8388e6b8 100644 --- a/dist/es2015/aurelia-i18n.js +++ b/dist/es2015/aurelia-i18n.js @@ -224,9 +224,9 @@ class I18N { node.au.controller && node.au.controller.viewModel && attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n + i18nLogger.warn(`Aurelia I18N reserved attribute name\n + [${reservedNames.join(", ")}]\n + Your custom element has a bindable named ${attr} which is a reserved word.\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); } if (this.i18next.options.skipTranslationOnMissingKey && @@ -566,59 +566,59 @@ const translations = { ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -684,57 +684,57 @@ const translations = { now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -771,28 +771,28 @@ const translations = { now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -800,28 +800,28 @@ const translations = { now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -858,171 +858,171 @@ const translations = { now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1030,51 +1030,59 @@ const translations = { th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1109,59 +1117,59 @@ const translations = { 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/es2017/aurelia-i18n.js b/dist/es2017/aurelia-i18n.js index db8efbb1..3ee12d85 100644 --- a/dist/es2017/aurelia-i18n.js +++ b/dist/es2017/aurelia-i18n.js @@ -191,9 +191,9 @@ class I18N { node.au.controller && node.au.controller.viewModel && attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n + i18nLogger.warn(`Aurelia I18N reserved attribute name\n + [${reservedNames.join(", ")}]\n + Your custom element has a bindable named ${attr} which is a reserved word.\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); } if (this.i18next.options.skipTranslationOnMissingKey && @@ -555,59 +555,59 @@ const translations = { ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -673,57 +673,57 @@ const translations = { now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -760,28 +760,28 @@ const translations = { now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -789,28 +789,28 @@ const translations = { now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -847,171 +847,171 @@ const translations = { now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1019,51 +1019,59 @@ const translations = { th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1098,59 +1106,59 @@ const translations = { 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/native-modules/aurelia-i18n.js b/dist/native-modules/aurelia-i18n.js index 5765abe4..029a9311 100644 --- a/dist/native-modules/aurelia-i18n.js +++ b/dist/native-modules/aurelia-i18n.js @@ -612,59 +612,59 @@ var translations = { ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -730,57 +730,57 @@ var translations = { now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -817,28 +817,28 @@ var translations = { now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -846,28 +846,28 @@ var translations = { now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -904,171 +904,171 @@ var translations = { now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1076,51 +1076,59 @@ var translations = { th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1155,59 +1163,59 @@ var translations = { 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/system/aurelia-i18n.js b/dist/system/aurelia-i18n.js index d97e75fe..f2bfaa38 100644 --- a/dist/system/aurelia-i18n.js +++ b/dist/system/aurelia-i18n.js @@ -636,59 +636,59 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -754,57 +754,57 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -841,28 +841,28 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -870,28 +870,28 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -928,171 +928,171 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1100,51 +1100,59 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1179,59 +1187,59 @@ System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', ' 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/umd-es2015/aurelia-i18n.js b/dist/umd-es2015/aurelia-i18n.js index a3da75e5..2c104f91 100644 --- a/dist/umd-es2015/aurelia-i18n.js +++ b/dist/umd-es2015/aurelia-i18n.js @@ -221,9 +221,9 @@ node.au.controller && node.au.controller.viewModel && attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n + i18nLogger.warn(`Aurelia I18N reserved attribute name\n + [${reservedNames.join(", ")}]\n + Your custom element has a bindable named ${attr} which is a reserved word.\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); } if (this.i18next.options.skipTranslationOnMissingKey && @@ -563,59 +563,59 @@ ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -681,57 +681,57 @@ now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -768,28 +768,28 @@ now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -797,28 +797,28 @@ now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -855,171 +855,171 @@ now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1027,51 +1027,59 @@ th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1106,59 +1114,59 @@ 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/dist/umd/aurelia-i18n.js b/dist/umd/aurelia-i18n.js index 9ac08204..bacc9fc1 100644 --- a/dist/umd/aurelia-i18n.js +++ b/dist/umd/aurelia-i18n.js @@ -609,59 +609,59 @@ ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -727,57 +727,57 @@ now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -814,28 +814,28 @@ now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -843,28 +843,28 @@ now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -901,171 +901,171 @@ now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -1073,51 +1073,59 @@ th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -1152,59 +1160,59 @@ 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/package-lock.json b/package-lock.json index 39d475cc..816b4b58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3377,9 +3377,9 @@ } }, "full-icu": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/full-icu/-/full-icu-1.2.1.tgz", - "integrity": "sha512-E2s1b4GVbt8PyG+iaRN6ks8N0Oy2LOJz7SIMUwWWWx7Mr5Z08hKkfpkKQbOtOGqzkFpckDJHjjZ8qfigN2W86A==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/full-icu/-/full-icu-1.3.1.tgz", + "integrity": "sha512-VMtK//85QJomhk3cXOCksNwOYaw1KWnYTS37GYGgyf7A3ajdBoPGhaJuJWAH2S2kq8GZeXkdKn+3Mfmgy11cVw==", "dev": true }, "function-bind": { diff --git a/package.json b/package.json index 9b384ac9..69aa4229 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "prebuild": "cross-env rimraf dist", "build": "cross-env TS_NODE_PROJECT=build/tsconfig.json ts-node build/build.ts", "build:dts": "dts-bundle-generator -o dist/aurelia-i18n.d.ts src/aurelia-i18n.ts --external-types --no-check", + "build:translations": "cross-env TS_NODE_PROJECT=build/tsconfig.json NODE_ICU_DATA=./node_modules/full-icu ts-node build/translation-generator/index.ts ./src/defaultTranslations/generated.ts", "precommit": "npm run lint", "changelog": "cross-env conventional-changelog -p angular -i doc/CHANGELOG.md -s", "bump-version": "npm --no-git-tag-version version", @@ -146,7 +147,7 @@ "coveralls": "^3.0.2", "cross-env": "^5.2.0", "dts-bundle-generator": "^1.6.1", - "full-icu": "^1.2.1", + "full-icu": "^1.3.1", "html-loader": "^0.5.5", "husky": "^0.14.3", "intl": "^1.2.5", diff --git a/src/defaultTranslations/relative.time.ts b/src/defaultTranslations/relative.time.ts index 9ceca1e4..0b032f84 100644 --- a/src/defaultTranslations/relative.time.ts +++ b/src/defaultTranslations/relative.time.ts @@ -7,59 +7,59 @@ export const translations: DefaultTranslations = { ar: { translation: { now: 'الآن', - second_ago: 'منذ __count__ ثانية', - second_ago_plural: 'منذ __count__ ثواني', - second_in: 'في __count__ ثانية', - second_in_plural: 'في __count__ ثواني', - minute_ago: 'منذ __count__ دقيقة', - minute_ago_plural: 'منذ __count__ دقائق', - minute_in: 'في __count__ دقيقة', - minute_in_plural: 'في __count__ دقائق', - hour_ago: 'منذ __count__ ساعة', - hour_ago_plural: 'منذ __count__ ساعات', - hour_in: 'في __count__ ساعة', - hour_in_plural: 'في __count__ ساعات', - day_ago: 'منذ __count__ يوم', - day_ago_plural: 'منذ __count__ أيام', - day_in: 'في __count__ يوم', - day_in_plural: 'في __count__ أيام', - month_ago: 'منذ __count__ شهر', - month_ago_plural: 'منذ __count__ أشهر', - month_in: 'في __count__ شهر', - month_in_plural: 'في __count__ أشهر', - year_ago: 'منذ __count__ سنة', - year_ago_plural: 'منذ __count__ سنوات', - year_in: 'في __count__ سنة', - year_in_plural: 'في __count__ سنوات' + second_ago: 'قبل ثانية واحدة', + second_ago_plural: 'قبل __count__ ثانية', + second_in: 'خلال ثانية واحدة', + second_in_plural: 'خلال __count__ ثانية', + minute_ago: 'قبل دقيقة واحدة', + minute_ago_plural: 'قبل __count__ دقيقة', + minute_in: 'خلال دقيقة واحدة', + minute_in_plural: 'خلال __count__ دقيقة', + hour_ago: 'قبل ساعة واحدة', + hour_ago_plural: 'قبل __count__ ساعة', + hour_in: 'خلال ساعة واحدة', + hour_in_plural: 'خلال __count__ ساعة', + day_ago: 'قبل يوم واحد', + day_ago_plural: 'قبل __count__ يومًا', + day_in: 'خلال يوم واحد', + day_in_plural: 'خلال __count__ يومًا', + month_ago: 'قبل شهر واحد', + month_ago_plural: 'قبل __count__ شهرًا', + month_in: 'خلال شهر واحد', + month_in_plural: 'خلال __count__ شهرًا', + year_ago: 'قبل سنة واحدة', + year_ago_plural: 'قبل __count__ سنة', + year_in: 'خلال سنة واحدة', + year_in_plural: 'خلال __count__ سنة' } }, da: { translation: { now: 'lige nu', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', - second_in: 'i __count__ sekund', - second_in_plural: 'i __count__ sekunder', - minute_ago: '__count__ minut siden', - minute_ago_plural: '__count__ minutter siden', - minute_in: 'i __count__ minut', - minute_in_plural: 'i __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', - hour_in: 'i __count__ time', - hour_in_plural: 'i __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dage siden', - day_in: 'i __count__ dag', - day_in_plural: 'i __count__ dage', - month_ago: '__count__ måned siden', - month_ago_plural: '__count__ måneder siden', - month_in: 'i __count__ måned', - month_in_plural: 'i __count__ måneder', - year_ago: '__count__ år siden', - year_ago_plural: '__count__ år siden', - year_in: 'i __count__ år', - year_in_plural: 'i __count__ år' + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', + second_in: 'om __count__ sekund', + second_in_plural: 'om __count__ sekunder', + minute_ago: 'for __count__ minut siden', + minute_ago_plural: 'for __count__ minutter siden', + minute_in: 'om __count__ minut', + minute_in_plural: 'om __count__ minutter', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', + hour_in: 'om __count__ time', + hour_in_plural: 'om __count__ timer', + day_ago: 'for __count__ dag siden', + day_ago_plural: 'for __count__ dage siden', + day_in: 'om __count__ dag', + day_in_plural: 'om __count__ dage', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, de: { @@ -125,57 +125,57 @@ export const translations: DefaultTranslations = { now: 'ahora mismo', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', - second_in: 'en __count__ segundo', - second_in_plural: 'en __count__ segundos', + second_in: 'dentro de __count__ segundo', + second_in_plural: 'dentro de __count__ segundos', minute_ago: 'hace __count__ minuto', minute_ago_plural: 'hace __count__ minutos', - minute_in: 'en __count__ minuto', - minute_in_plural: 'en __count__ minutos', + minute_in: 'dentro de __count__ minuto', + minute_in_plural: 'dentro de __count__ minutos', hour_ago: 'hace __count__ hora', hour_ago_plural: 'hace __count__ horas', - hour_in: 'en __count__ hora', - hour_in_plural: 'en __count__ horas', + hour_in: 'dentro de __count__ hora', + hour_in_plural: 'dentro de __count__ horas', day_ago: 'hace __count__ día', day_ago_plural: 'hace __count__ días', - day_in: 'en __count__ día', - day_in_plural: 'en __count__ días', + day_in: 'dentro de __count__ día', + day_in_plural: 'dentro de __count__ días', month_ago: 'hace __count__ mes', month_ago_plural: 'hace __count__ meses', - month_in: 'en __count__ mes', - month_in_plural: 'en __count__ meses', + month_in: 'dentro de __count__ mes', + month_in_plural: 'dentro de __count__ meses', year_ago: 'hace __count__ año', year_ago_plural: 'hace __count__ años', - year_in: 'en __count__ año', - year_in_plural: 'en __count__ años' + year_in: 'dentro de __count__ año', + year_in_plural: 'dentro de __count__ años' } }, fi: { translation: { now: 'Nyt', - second_ago: '__count__ sekuntti sitten', - second_ago_plural: '__count__ sekunttia sitten', - second_in: ' __count__ sekunnin kuluttua', - second_in_plural: ' __count__ sekunttien kuluttua', + second_ago: '__count__ sekunti sitten', + second_ago_plural: '__count__ sekuntia sitten', + second_in: '__count__ sekunnin päästä', + second_in_plural: '__count__ sekunnin päästä', minute_ago: '__count__ minuutti sitten', minute_ago_plural: '__count__ minuuttia sitten', - minute_in: ' __count__ minuutin kuluttua', - minute_in_plural: ' __count__ minuuttien kuluttua', + minute_in: '__count__ minuutin päästä', + minute_in_plural: '__count__ minuutin päästä', hour_ago: '__count__ tunti sitten', hour_ago_plural: '__count__ tuntia sitten', - hour_in: ' __count__ tunnin kuluttua', - hour_in_plural: ' __count__ tunnin kuluttua', + hour_in: '__count__ tunnin päästä', + hour_in_plural: '__count__ tunnin päästä', day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päiviä sitten', - day_in: ' __count__ päivän kuluttua', - day_in_plural: '__count__ päivien kuluttua', + day_ago_plural: '__count__ päivää sitten', + day_in: '__count__ päivän päästä', + day_in_plural: '__count__ päivän päästä', month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukausia sitten', - month_in: ' __count__ kuukauden kuluttua', - month_in_plural: ' __count__ kuukausien kuluttua', + month_ago_plural: '__count__ kuukautta sitten', + month_in: '__count__ kuukauden päästä', + month_in_plural: '__count__ kuukauden päästä', year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuosia sitten', - year_in: ' __count__ vuoden kuluttua', - year_in_plural: ' __count__ vuosien kuluttua' + year_ago_plural: '__count__ vuotta sitten', + year_in: '__count__ vuoden päästä', + year_in_plural: '__count__ vuoden päästä' } }, fr: { @@ -212,28 +212,28 @@ export const translations: DefaultTranslations = { now: 'adesso', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', - second_in: 'in __count__ secondo', - second_in_plural: 'in __count__ secondi', + second_in: 'tra __count__ secondo', + second_in_plural: 'tra __count__ secondi', minute_ago: '__count__ minuto fa', minute_ago_plural: '__count__ minuti fa', - minute_in: 'in __count__ minuto', - minute_in_plural: 'in __count__ minuti', + minute_in: 'tra __count__ minuto', + minute_in_plural: 'tra __count__ minuti', hour_ago: '__count__ ora fa', hour_ago_plural: '__count__ ore fa', - hour_in: 'in __count__ ora', - hour_in_plural: 'in __count__ ore', + hour_in: 'tra __count__ ora', + hour_in_plural: 'tra __count__ ore', day_ago: '__count__ giorno fa', day_ago_plural: '__count__ giorni fa', - day_in: 'in __count__ giorno', - day_in_plural: 'in __count__ giorni', + day_in: 'tra __count__ giorno', + day_in_plural: 'tra __count__ giorni', month_ago: '__count__ mese fa', month_ago_plural: '__count__ mesi fa', - month_in: 'in __count__ mese', - month_in_plural: 'in __count__ mesi', + month_in: 'tra __count__ mese', + month_in_plural: 'tra __count__ mesi', year_ago: '__count__ anno fa', year_ago_plural: '__count__ anni fa', - year_in: 'in __count__ anno', - year_in_plural: 'in __count__ anni' + year_in: 'tra __count__ anno', + year_in_plural: 'tra __count__ anni' } }, ja: { @@ -241,28 +241,28 @@ export const translations: DefaultTranslations = { now: 'たった今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', - second_in: 'あと __count__ 秒', - second_in_plural: 'あと __count__ 秒', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分前', minute_ago_plural: '__count__ 分前', - minute_in: 'あと __count__ 分', - minute_in_plural: 'あと __count__ 分', + minute_in: '__count__ 分後', + minute_in_plural: '__count__ 分後', hour_ago: '__count__ 時間前', hour_ago_plural: '__count__ 時間前', - hour_in: 'あと __count__ 時間', - hour_in_plural: 'あと __count__ 時間', - day_ago: '__count__ 日間前', - day_ago_plural: '__count__ 日間前', - day_in: 'あと __count__ 日間', - day_in_plural: 'あと __count__ 日間', - month_ago: '__count__ ヶ月前', - month_ago_plural: '__count__ ヶ月前', - month_in: 'あと __count__ ヶ月', - month_in_plural: 'あと __count__ ヶ月', + hour_in: '__count__ 時間後', + hour_in_plural: '__count__ 時間後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ か月前', + month_ago_plural: '__count__ か月前', + month_in: '__count__ か月後', + month_in_plural: '__count__ か月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: 'あと __count__ 年', - year_in_plural: 'あと __count__ 年' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' } }, lt: { @@ -299,171 +299,171 @@ export const translations: DefaultTranslations = { now: 'zonet', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', - second_in: 'in __count__ seconde', - second_in_plural: 'in __count__ seconden', + second_in: 'over __count__ seconde', + second_in_plural: 'over __count__ seconden', minute_ago: '__count__ minuut geleden', minute_ago_plural: '__count__ minuten geleden', - minute_in: 'in __count__ minuut', - minute_in_plural: 'in __count__ minuten', + minute_in: 'over __count__ minuut', + minute_in_plural: 'over __count__ minuten', hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uren geleden', - hour_in: 'in __count__ uur', - hour_in_plural: 'in __count__ uren', + hour_ago_plural: '__count__ uur geleden', + hour_in: 'over __count__ uur', + hour_in_plural: 'over __count__ uur', day_ago: '__count__ dag geleden', day_ago_plural: '__count__ dagen geleden', - day_in: 'in __count__ dag', - day_in_plural: 'in __count__ dagen', + day_in: 'over __count__ dag', + day_in_plural: 'over __count__ dagen', month_ago: '__count__ maand geleden', month_ago_plural: '__count__ maanden geleden', - month_in: 'in __count__ maand', - month_in_plural: 'in __count__ maanden', + month_in: 'over __count__ maand', + month_in_plural: 'over __count__ maanden', year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaren geleden', - year_in: 'in __count__ jaar', - year_in_plural: 'in __count__ jaren' + year_ago_plural: '__count__ jaar geleden', + year_in: 'over __count__ jaar', + year_in_plural: 'over __count__ jaar' } }, nn: { translation: { - now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + now: 'akkurat no', + second_ago: 'for __count__ sekund sidan', + second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + second_in_plural: 'om __count__ sekund', + minute_ago: 'for __count__ minutt sidan', + minute_ago_plural: 'for __count__ minutt sidan', minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + minute_in_plural: 'om __count__ minutt', + hour_ago: 'for __count__ time sidan', + hour_ago_plural: 'for __count__ timar sidan', hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + hour_in_plural: 'om __count__ timar', + day_ago: 'for __count__ døgn sidan', + day_ago_plural: 'for __count__ døgn sidan', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ månad sidan', + month_ago_plural: 'for __count__ månadar sidan', + month_in: 'om __count__ månad', + month_in_plural: 'om __count__ månadar', + year_ago: 'for __count__ år sidan', + year_ago_plural: 'for __count__ år sidan', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, - no: { + nb: { translation: { now: 'akkurat nå', - second_ago: '__count__ sekund siden', - second_ago_plural: '__count__ sekunder siden', + second_ago: 'for __count__ sekund siden', + second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minutt siden', - minute_ago_plural: '__count__ minutter siden', + minute_ago: 'for __count__ minutt siden', + minute_ago_plural: 'for __count__ minutter siden', minute_in: 'om __count__ minutt', minute_in_plural: 'om __count__ minutter', - hour_ago: '__count__ time siden', - hour_ago_plural: '__count__ timer siden', + hour_ago: 'for __count__ time siden', + hour_ago_plural: 'for __count__ timer siden', hour_in: 'om __count__ time', hour_in_plural: 'om __count__ timer', - day_ago: '__count__ dag siden', - day_ago_plural: '__count__ dager siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dager', - month_ago: '__count__ en måned siden', - month_ago_plural: '__count__ flere måneder siden', - month_in: 'I løpet av en __count__ måned', - month_in_plural: 'I løpet av __count__ måneder', - year_ago: '__count__ et år siden', - year_ago_plural: '__count__ flere å siden', - year_in: 'I løpet av ett år __count__ år', - year_in_plural: 'på flere __count__ år' + day_ago: 'for __count__ døgn siden', + day_ago_plural: 'for __count__ døgn siden', + day_in: 'om __count__ døgn', + day_in_plural: 'om __count__ døgn', + month_ago: 'for __count__ måned siden', + month_ago_plural: 'for __count__ måneder siden', + month_in: 'om __count__ måned', + month_in_plural: 'om __count__ måneder', + year_ago: 'for __count__ år siden', + year_ago_plural: 'for __count__ år siden', + year_in: 'om __count__ år', + year_in_plural: 'om __count__ år' } }, pl: { translation: { now: 'teraz', - second_ago: '__count__ s temu', - second_ago_plural: '__count__ s temu', - second_in: 'za __count__ s', - second_in_plural: 'za __count__ s', - minute_ago: '__count__ min temu', - minute_ago_plural: '__count__ min temu', - minute_in: 'za __count__ min', - minute_in_plural: 'za __count__ min', - hour_ago: '__count__ h temu', - hour_ago_plural: '__count__ h temu', - hour_in: 'za __count__ h', - hour_in_plural: 'za __count__ h', + second_ago: '__count__ sekundę temu', + second_ago_plural: '__count__ sekundy temu', + second_in: 'za __count__ sekundę', + second_in_plural: 'za __count__ sekundy', + minute_ago: '__count__ minutę temu', + minute_ago_plural: '__count__ minuty temu', + minute_in: 'za __count__ minutę', + minute_in_plural: 'za __count__ minuty', + hour_ago: '__count__ godzinę temu', + hour_ago_plural: '__count__ godziny temu', + hour_in: 'za __count__ godzinę', + hour_in_plural: 'za __count__ godziny', day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dias atrás', - day_in: 'za __count__ dni', + day_ago_plural: '__count__ dni temu', + day_in: 'za __count__ dzień', day_in_plural: 'za __count__ dni', month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ mies. temu', + month_ago_plural: '__count__ miesiące temu', month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ mies.', + month_in_plural: 'za __count__ miesiące', year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata/lat temu', + year_ago_plural: '__count__ lata temu', year_in: 'za __count__ rok', - year_in_plural: '__count__ lata/lat' + year_in_plural: 'za __count__ lata' } }, pt: { translation: { now: 'neste exato momento', - second_ago: '__count__ segundo atrás', - second_ago_plural: '__count__ segundos atrás', + second_ago: 'há __count__ segundo', + second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', second_in_plural: 'em __count__ segundos', - minute_ago: '__count__ minuto atrás', - minute_ago_plural: '__count__ minutos atrás', + minute_ago: 'há __count__ minuto', + minute_ago_plural: 'há __count__ minutos', minute_in: 'em __count__ minuto', minute_in_plural: 'em __count__ minutos', - hour_ago: '__count__ hora atrás', - hour_ago_plural: '__count__ horas atrás', + hour_ago: 'há __count__ hora', + hour_ago_plural: 'há __count__ horas', hour_in: 'em __count__ hora', hour_in_plural: 'em __count__ horas', - day_ago: '__count__ dia atrás', - day_ago_plural: '__count__ dias atrás', + day_ago: 'há __count__ dia', + day_ago_plural: 'há __count__ dias', day_in: 'em __count__ dia', day_in_plural: 'em __count__ dias', - month_ago: '__count__ mês atrás', - month_ago_plural: '__count__ meses atrás', + month_ago: 'há __count__ mês', + month_ago_plural: 'há __count__ meses', month_in: 'em __count__ mês', month_in_plural: 'em __count__ meses', - year_ago: '__count__ ano atrás', - year_ago_plural: '__count__ anos atrás', + year_ago: 'há __count__ ano', + year_ago_plural: 'há __count__ anos', year_in: 'em __count__ ano', year_in_plural: 'em __count__ anos' } }, sv: { translation: { - now: 'nu', - second_ago: '__count__ sekund sedan', - second_ago_plural: '__count__ sekunder sedan', + now: 'just nu', + second_ago: 'för __count__ sekund sedan', + second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', second_in_plural: 'om __count__ sekunder', - minute_ago: '__count__ minut sedan', - minute_ago_plural: '__count__ minuter sedan', + minute_ago: 'för __count__ minut sedan', + minute_ago_plural: 'för __count__ minuter sedan', minute_in: 'om __count__ minut', minute_in_plural: 'om __count__ minuter', - hour_ago: '__count__ timme sedan', - hour_ago_plural: '__count__ timmar sedan', + hour_ago: 'för __count__ timme sedan', + hour_ago_plural: 'för __count__ timmar sedan', hour_in: 'om __count__ timme', hour_in_plural: 'om __count__ timmar', - day_ago: '__count__ dag sedan', - day_ago_plural: '__count__ dagar sedan', + day_ago: 'för __count__ dag sedan', + day_ago_plural: 'för __count__ dagar sedan', day_in: 'om __count__ dag', day_in_plural: 'om __count__ dagar', - month_ago: '__count__ månad sedan', - month_ago_plural: '__count__ månader sedan', + month_ago: 'för __count__ månad sedan', + month_ago_plural: 'för __count__ månader sedan', month_in: 'om __count__ månad', month_in_plural: 'om __count__ månader', - year_ago: '__count__ år sedan', - year_ago_plural: '__count__ år sedan', + year_ago: 'för __count__ år sedan', + year_ago_plural: 'för __count__ år sedan', year_in: 'om __count__ år', year_in_plural: 'om __count__ år' } @@ -471,51 +471,59 @@ export const translations: DefaultTranslations = { th: { translation: { now: 'เมื่อกี้', - second_ago: '__count__ วินาที ที่ผ่านมา', - second_ago_plural: '__count__ วินาที ที่ผ่านมา', - second_in: 'อีก __count__ วินาที', - second_in_plural: 'อีก __count__ วินาที', - minute_ago: '__count__ นาที ที่ผ่านมา', - minute_ago_plural: '__count__ นาที ที่ผ่านมา', - minute_in: 'อีก __count__ นาที', - minute_in_plural: 'อีก __count__ นาที', - hour_ago: '__count__ ชั่วโมง ที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมง ที่ผ่านมา', - hour_in: 'อีก __count__ ชั่วโมง', - hour_in_plural: 'อีก __count__ ชั่วโมง', - day_ago: '__count__ วัน ที่ผ่านมา', - day_ago_plural: '__count__ วัน ที่ผ่านมา', - day_in: 'อีก __count__ วัน', - day_in_plural: 'อีก __count__ วัน' + second_ago: '__count__ วินาทีที่ผ่านมา', + second_ago_plural: '__count__ วินาทีที่ผ่านมา', + second_in: 'ในอีก __count__ วินาที', + second_in_plural: 'ในอีก __count__ วินาที', + minute_ago: '__count__ นาทีที่ผ่านมา', + minute_ago_plural: '__count__ นาทีที่ผ่านมา', + minute_in: 'ในอีก __count__ นาที', + minute_in_plural: 'ในอีก __count__ นาที', + hour_ago: '__count__ ชั่วโมงที่ผ่านมา', + hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', + hour_in: 'ในอีก __count__ ชั่วโมง', + hour_in_plural: 'ในอีก __count__ ชั่วโมง', + day_ago: '__count__ วันที่ผ่านมา', + day_ago_plural: '__count__ วันที่ผ่านมา', + day_in: 'ในอีก __count__ วัน', + day_in_plural: 'ในอีก __count__ วัน', + month_ago: '__count__ เดือนที่ผ่านมา', + month_ago_plural: '__count__ เดือนที่ผ่านมา', + month_in: 'ในอีก __count__ เดือน', + month_in_plural: 'ในอีก __count__ เดือน', + year_ago: '__count__ ปีที่แล้ว', + year_ago_plural: '__count__ ปีที่แล้ว', + year_in: 'ในอีก __count__ ปี', + year_in_plural: 'ในอีก __count__ ปี' } }, zh: { translation: { now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' + second_ago: '__count__秒钟前', + second_ago_plural: '__count__秒钟前', + second_in: '__count__秒钟后', + second_in_plural: '__count__秒钟后', + minute_ago: '__count__分钟前', + minute_ago_plural: '__count__分钟前', + minute_in: '__count__分钟后', + minute_in_plural: '__count__分钟后', + hour_ago: '__count__小时前', + hour_ago_plural: '__count__小时前', + hour_in: '__count__小时后', + hour_in_plural: '__count__小时后', + day_ago: '__count__天前', + day_ago_plural: '__count__天前', + day_in: '__count__天后', + day_in_plural: '__count__天后', + month_ago: '__count__个月前', + month_ago_plural: '__count__个月前', + month_in: '__count__个月后', + month_in_plural: '__count__个月后', + year_ago: '__count__年前', + year_ago_plural: '__count__年前', + year_in: '__count__年后', + year_in_plural: '__count__年后' } }, 'zh-CN': { @@ -550,59 +558,59 @@ export const translations: DefaultTranslations = { 'zh-HK': { translation: { now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', + second_ago: '__count__ 秒前', + second_ago_plural: '__count__ 秒前', + second_in: '__count__ 秒後', + second_in_plural: '__count__ 秒後', minute_ago: '__count__ 分鐘前', minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', + minute_in: '__count__ 分鐘後', + minute_in_plural: '__count__ 分鐘後', hour_ago: '__count__ 小時前', hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', + hour_in: '__count__ 小時後', + hour_in_plural: '__count__ 小時後', + day_ago: '__count__ 日前', + day_ago_plural: '__count__ 日前', + day_in: '__count__ 日後', + day_in_plural: '__count__ 日後', + month_ago: '__count__ 個月前', + month_ago_plural: '__count__ 個月前', + month_in: '__count__ 個月後', + month_in_plural: '__count__ 個月後', year_ago: '__count__ 年前', year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' + year_in: '__count__ 年後', + year_in_plural: '__count__ 年後' + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' + } } } }; diff --git a/test/unit/relative.time.spec.ts b/test/unit/relative.time.spec.ts index d146060f..20f9e845 100644 --- a/test/unit/relative.time.spec.ts +++ b/test/unit/relative.time.spec.ts @@ -1,14 +1,13 @@ -import { BindingSignaler } from "aurelia-templating-resources"; -import { EventAggregator } from "aurelia-event-aggregator"; -import { StageComponent } from "aurelia-testing"; import { bootstrap } from "aurelia-bootstrapper"; import { Container } from "aurelia-dependency-injection"; - -import { I18N, AureliaEnhancedOptions } from "../../src/i18n"; -import { RelativeTime } from "../../src/relativeTime"; +import { EventAggregator } from "aurelia-event-aggregator"; +import { TaskQueue } from "aurelia-framework"; +import { BindingSignaler } from "aurelia-templating-resources"; +import { StageComponent } from "aurelia-testing"; import { translations } from "../../src/defaultTranslations/relative.time"; +import { AureliaEnhancedOptions, I18N } from "../../src/i18n"; +import { RelativeTime } from "../../src/relativeTime"; import { bootstrapTestEnvironment } from "./staging-helpers"; -import { TaskQueue } from "aurelia-framework"; function modifiedDateFromNow(days: number, months: number, years: number) { const date = new Date(); @@ -158,7 +157,7 @@ describe("testing relative time support", () => { const expectedDate = new Date(); expectedDate.setHours(new Date().getHours() + 2); - expect(sut.getRelativeTime(expectedDate)).toBe("in 2 uren"); + expect(sut.getRelativeTime(expectedDate)).toBe("over 2 uur"); }); it("should provide the translation for the full locale when available", async () => { @@ -185,7 +184,7 @@ describe("testing relative time support", () => { const expectedDate = new Date(); expectedDate.setMinutes(new Date().getMinutes() + 2); - expect(sut.getRelativeTime(expectedDate)).toBe("in 2 minuten"); + expect(sut.getRelativeTime(expectedDate)).toBe("over 2 minuten"); }); it("should handle non-defined interpolation prefix and suffix", async () => { From 49c2114a7776f5e2ee0efbda603102a54a22cf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Andre=20Sundt?= Date: Sun, 30 Aug 2020 23:47:32 +0200 Subject: [PATCH 2/4] Remove dist + translation-generator improvements --- .../generate-translations.ts | 29 +- build/translation-generator/index.ts | 33 +- dist/amd/aurelia-i18n.js | 1458 ---------------- dist/aurelia-i18n.d.ts | 175 -- dist/commonjs/aurelia-i18n.js | 1467 ---------------- dist/es2015/aurelia-i18n.js | 1385 ---------------- dist/es2017/aurelia-i18n.js | 1372 --------------- dist/native-modules/aurelia-i18n.js | 1447 ---------------- dist/system/aurelia-i18n.js | 1473 ----------------- dist/umd-es2015/aurelia-i18n.js | 1390 ---------------- dist/umd/aurelia-i18n.js | 1462 ---------------- package.json | 2 +- 12 files changed, 43 insertions(+), 11650 deletions(-) delete mode 100644 dist/amd/aurelia-i18n.js delete mode 100644 dist/aurelia-i18n.d.ts delete mode 100644 dist/commonjs/aurelia-i18n.js delete mode 100644 dist/es2015/aurelia-i18n.js delete mode 100644 dist/es2017/aurelia-i18n.js delete mode 100644 dist/native-modules/aurelia-i18n.js delete mode 100644 dist/system/aurelia-i18n.js delete mode 100644 dist/umd-es2015/aurelia-i18n.js delete mode 100644 dist/umd/aurelia-i18n.js diff --git a/build/translation-generator/generate-translations.ts b/build/translation-generator/generate-translations.ts index b15af813..62f2c725 100644 --- a/build/translation-generator/generate-translations.ts +++ b/build/translation-generator/generate-translations.ts @@ -111,7 +111,7 @@ function getRuntimeSupportedLocales(list: string[]): string[] { return result; } -function buildCompleteTranslations(locales: string[]): TranslationData { +function buildCompleteTranslations(locales: string[], interpolationPrefix: string, interpolationSuffix: string): TranslationData { const allTranslations: TranslationData = {}; @@ -128,7 +128,7 @@ function buildCompleteTranslations(locales: string[]): TranslationData { if (!["literal", "integer"].includes(part.type)) { throw new Error(`Unexpected part! locale ${locale}, key: ${key}, type: ${part.type}`); } - return part.type === "integer" ? "__count__" : part.value; + return part.type === "integer" ? `${interpolationPrefix}count${interpolationSuffix}` : part.value; }).join(""); translation[key] = val; @@ -158,29 +158,36 @@ function areEqual(tr1: Translation, tr2: Translation): boolean { return result; } -function removeRedundantTranslations(trData: TranslationData): void { +function removeRedundantSubLocaleTranslations(trData: TranslationData): string[] { const subLocales = Object.keys(trData).filter(k => k.includes("-")); + const redundantSubLocales: string[] = []; for (const sl of subLocales) { const mainLocale = sl.split("-")[0]; if (trData[mainLocale] && areEqual(trData[mainLocale].translation, trData[sl].translation)) { + redundantSubLocales.push(sl); delete trData[sl]; } } + return redundantSubLocales; } -export function generateTranslations(locales: string[]): TranslationData { - console.log(locales); +export function generateTranslations( + locales: string[], + interpolationPrefix: string = "__", + interpolationSuffix: string = "__" +): TranslationData { + const runtimeSupportedLocales = getRuntimeSupportedLocales(locales); // Getting a list of the unsupported locales for debugging - const unsupportedLocales = locales.filter(l => !runtimeSupportedLocales.includes(l)); - console.log("Ignoring following unsupported locales:", unsupportedLocales); + const runtimeNonSupportedLocales = locales.filter(l => !runtimeSupportedLocales.includes(l)); + console.log("[translationgen] Ignoring following runtime unsupported locales:", runtimeNonSupportedLocales); - console.log("Building translations..."); - const translations = buildCompleteTranslations(runtimeSupportedLocales); + console.log("[translationgen] Generating translations for the following runtime supported locales:", runtimeSupportedLocales); + const translations = buildCompleteTranslations(runtimeSupportedLocales, interpolationPrefix, interpolationSuffix); - console.log("Removing redundant translations..."); - removeRedundantTranslations(translations); + const redundant = removeRedundantSubLocaleTranslations(translations); + console.log("[translationgen] Removing the following redundant (identical) sub-locale translations:", redundant); return translations; } diff --git a/build/translation-generator/index.ts b/build/translation-generator/index.ts index 137b348e..e60a212f 100644 --- a/build/translation-generator/index.ts +++ b/build/translation-generator/index.ts @@ -1,7 +1,7 @@ import * as fs from "fs"; import * as path from "path"; import * as process from "process"; -import { generateTranslations } from "./generate-translations"; +import { generateTranslations, TranslationData } from "./generate-translations"; /** * Generates translations file by using Intl.RelativeTimeFormat with node full-icu @@ -14,18 +14,33 @@ if (!outFile || !fs.existsSync(path.dirname(outFile))) { throw new Error("Invalid or missing output file argument"); } -const translations = generateTranslations(require("./supported-locales")); -const transJs = JSON.stringify(translations, null, 2) - .replace(/"([^"-]+)":/g, (_, g) => `${g}:`) - .replace(/"/g, "'"); +function toTsCode(data: TranslationData): string { + const transJs = JSON.stringify(data, null, 2) + .replace(/"([^"-]+)":/g, (_, g) => `${g}:`) + .replace(/"/g, "'"); -fs.writeFileSync( - outFile, - `// tslint:disable + return `// tslint:disable export type DefaultTranslations = { [key: string]: string | DefaultTranslations } export const translations: DefaultTranslations = ${transJs}; // tslint:enable -`); +`; +} + +// Get list of locales to generate translations for. +const locales = require("./supported-locales"); + +// Generate translations for specified list of locales, use "__" as count interpolation prefix/suffix: +const translations = generateTranslations(locales, "__", "__"); + +// Convert to TS file similar to "src/defaultTranslations/relative.time.ts": +const content = toTsCode(translations); + +// Alternatively convert to JSON +//const content = JSON.stringify(translations, null, 2); + +console.log("[translationgen] Writing generated output file..."); +fs.writeFileSync(outFile, content); +console.log("[translationgen] Done!"); diff --git a/dist/amd/aurelia-i18n.js b/dist/amd/aurelia-i18n.js deleted file mode 100644 index 1390b810..00000000 --- a/dist/amd/aurelia-i18n.js +++ /dev/null @@ -1,1458 +0,0 @@ -define('aurelia-i18n', ['exports', 'i18next', 'aurelia-logging', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-metadata', 'aurelia-pal', 'aurelia-framework', 'aurelia-templating-resources', 'aurelia-event-aggregator', 'aurelia-binding'], function (exports, i18next, LogManager, aureliaDependencyInjection, aureliaTemplating, aureliaMetadata, aureliaPal, aureliaFramework, aureliaTemplatingResources, aureliaEventAggregator, aureliaBinding) { 'use strict'; - - i18next = i18next && i18next.hasOwnProperty('default') ? i18next['default'] : i18next; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - var I18N_EA_SIGNAL = "i18n:locale:changed"; - var I18N = /** @class */ (function () { - function I18N(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = aureliaPal.PLATFORM.global.Intl; - } - I18N.inject = function () { return [aureliaEventAggregator.EventAggregator, aureliaTemplatingResources.BindingSignaler]; }; - I18N.prototype.setup = function (options) { - return __awaiter(this, void 0, void 0, function () { - var defaultOptions; - var _this = this; - return __generator(this, function (_a) { - defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise(function (resolve, reject) { - _this.i18next.init(options || defaultOptions, function (err) { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (_this.i18next.options.attributes instanceof String) { - _this.i18next.options.attributes = [_this.i18next.options.attributes]; - } - resolve(_this.i18next); - }); - }); - return [2 /*return*/, this.i18nextDeferred]; - }); - }); - }; - I18N.prototype.i18nextReady = function () { - return this.i18nextDeferred; - }; - I18N.prototype.setLocale = function (locale) { - var _this = this; - return new Promise(function (resolve, reject) { - var oldLocale = _this.getLocale(); - _this.i18next.changeLanguage(locale, function (err, tr) { - if (err) { - reject(err); - } - _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - _this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - }; - I18N.prototype.getLocale = function () { - return this.i18next.language; - }; - I18N.prototype.nf = function (options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - }; - I18N.prototype.uf = function (numberLike, locale) { - var nf = this.nf({}, locale || this.getLocale()); - var comparer = nf.format(10000 / 3); - var thousandSeparator = comparer[1]; - var decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - var result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - }; - I18N.prototype.df = function (options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - }; - I18N.prototype.tr = function (key, options) { - var fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - }; - I18N.prototype.registerGlobalVariable = function (key, value) { - this.globalVars[key] = value; - }; - I18N.prototype.unregisterGlobalVariable = function (key) { - delete this.globalVars[key]; - }; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - I18N.prototype.updateTranslations = function (el) { - if (!el || !el.querySelectorAll) { - return; - } - var i; - var l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - var attributes = this.i18next.options.attributes; - var selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - var nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - var keys = void 0; - var params = void 0; - // test every attribute and get the first one that has a value - for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - var pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - }; - I18N.prototype.updateValue = function (node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - var keys = value.toString().split(";"); - var i = keys.length; - while (i--) { - var key = keys[i]; - // remove the optional attribute - var re = /\[([a-z\-, ]*)\]/ig; - var m = void 0; - var attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - var attrs = attr.split(","); - var j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - var reservedNames = ["prepend", "append", "text", "html"]; - var i18nLogger = LogManager.getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn("Aurelia I18N reserved attribute name\n\n [" + reservedNames.join(", ") + "]\n\n Your custom element has a bindable named " + attr + " which is a reserved word.\n\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name."); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn("Couldn't find translation for key: " + key); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - var newChild = aureliaPal.DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - var prependParser = aureliaPal.DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - var appendParser = aureliaPal.DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - }; - return I18N; - }()); - - var TBindingBehavior = /** @class */ (function () { - function TBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - TBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - TBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "t", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - TBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - TBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("t") - ], TBindingBehavior); - return TBindingBehavior; - }()); - - // tslint:disable-next-line:only-arrow-functions - var isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; - }; - var LazyOptional = /** @class */ (function () { - function LazyOptional(key) { - this.key = key; - } - LazyOptional_1 = LazyOptional; - LazyOptional.of = function (key) { - return new LazyOptional_1(key); - }; - LazyOptional.prototype.get = function (container) { - var _this = this; - return function () { - if (container.hasResolver(_this.key, false)) { - return container.get(_this.key); - } - return null; - }; - }; - var LazyOptional_1; - LazyOptional = LazyOptional_1 = __decorate([ - aureliaDependencyInjection.resolver() - ], LazyOptional); - return LazyOptional; - }()); - - var TParamsCustomAttribute = /** @class */ (function () { - function TParamsCustomAttribute(element) { - this.element = element; - } - TParamsCustomAttribute_1 = TParamsCustomAttribute; - TParamsCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element]; - }; - TParamsCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - }; - TParamsCustomAttribute.prototype.valueChanged = function () { }; - var TParamsCustomAttribute_1; - TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t-params") - ], TParamsCustomAttribute); - return TParamsCustomAttribute; - }()); - - var TCustomAttribute = /** @class */ (function () { - function TCustomAttribute(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - TCustomAttribute_1 = TCustomAttribute; - TCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element, I18N, aureliaEventAggregator.EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - }; - TCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - }; - TCustomAttribute.prototype.bind = function () { - var _this = this; - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = function (newParams, oldParams) { - _this.paramsChanged(_this.value, newParams, oldParams); - }; - } - var p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () { - _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - }; - TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - }; - TCustomAttribute.prototype.valueChanged = function (newValue) { - var p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - }; - TCustomAttribute.prototype.unbind = function () { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - }; - var TCustomAttribute_1; - TCustomAttribute = TCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t") - ], TCustomAttribute); - return TCustomAttribute; - }()); - - var TValueConverter = /** @class */ (function () { - function TValueConverter(service) { - this.service = service; - } - TValueConverter.inject = function () { return [I18N]; }; - TValueConverter.prototype.toView = function (value, options) { - return this.service.tr(value, options); - }; - TValueConverter = __decorate([ - aureliaFramework.valueConverter("t") - ], TValueConverter); - return TValueConverter; - }()); - - var NfBindingBehavior = /** @class */ (function () { - function NfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - NfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - NfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "nf", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - NfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - NfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("nf") - ], NfBindingBehavior); - return NfBindingBehavior; - }()); - - var NfValueConverter = /** @class */ (function () { - function NfValueConverter(service) { - this.service = service; - } - NfValueConverter.inject = function () { return [I18N]; }; - NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - }; - NfValueConverter = __decorate([ - aureliaBinding.valueConverter("nf") - ], NfValueConverter); - return NfValueConverter; - }()); - - var DfBindingBehavior = /** @class */ (function () { - function DfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - DfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - DfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "df", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - DfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - DfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("df") - ], DfBindingBehavior); - return DfBindingBehavior; - }()); - - var DfValueConverter = /** @class */ (function () { - function DfValueConverter(service) { - this.service = service; - } - DfValueConverter.inject = function () { return [I18N]; }; - DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - var df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - }; - DfValueConverter = __decorate([ - aureliaBinding.valueConverter("df") - ], DfValueConverter); - return DfValueConverter; - }()); - - var RtBindingBehavior = /** @class */ (function () { - function RtBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - RtBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - RtBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "rt", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - RtBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - RtBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("rt") - ], RtBindingBehavior); - return RtBindingBehavior; - }()); - - var translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } - }; - // tslint:enable - - var RelativeTime = /** @class */ (function () { - function RelativeTime(service, ea) { - var _this = this; - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(function () { - _this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, function (locales) { - _this.setup(locales); - }); - } - RelativeTime.inject = function () { return [I18N, aureliaEventAggregator.EventAggregator]; }; - RelativeTime.prototype.setup = function (locales) { - var trans = translations; - var fallbackLng = this.service.i18next.fallbackLng; - var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - var key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - var index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - var baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - }; - RelativeTime.prototype.addTranslationResource = function (key, translation) { - var options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (var subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", (options.interpolation.prefix || "{{") + "count" + (options.interpolation.suffix || "}}")); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - }; - RelativeTime.prototype.getRelativeTime = function (time) { - var now = new Date(); - var diff = now.getTime() - time.getTime(); - var timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - }; - RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) { - var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - var abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - }; - return RelativeTime; - }()); - - var RtValueConverter = /** @class */ (function () { - function RtValueConverter(service) { - this.service = service; - } - RtValueConverter.inject = function () { return [RelativeTime]; }; - RtValueConverter.prototype.toView = function (value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - }; - RtValueConverter = __decorate([ - aureliaBinding.valueConverter("rt") - ], RtValueConverter); - return RtValueConverter; - }()); - - var Backend = /** @class */ (function () { - function Backend(services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - Backend.with = function (loader) { - this.loader = loader; - return this; - }; - Backend.prototype.init = function (services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - }; - Backend.prototype.readMulti = function (languages, namespaces, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - var url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - }; - Backend.prototype.read = function (language, namespace, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - }; - Backend.prototype.loadUrl = function (url, callback) { - return __awaiter(this, void 0, void 0, function () { - var response, ret, err, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, Backend.loader.loadText(url)]; - case 1: - response = _b.sent(); - ret = void 0; - err = void 0; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return [2 /*return*/, callback(err, false)]; - } - callback(null, ret); - return [3 /*break*/, 3]; - case 2: - _a = _b.sent(); - callback("failed loading " + url, false /* no retry */); - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - // tslint:disable-next-line:variable-name - Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) { - // not supported - }; - Backend.type = "backend"; - return Backend; - }()); - - function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - var errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - var instance = frameworkConfig.container.get(I18N); - var ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(function () { - var resources = frameworkConfig.container.get(aureliaTemplating.ViewResources); - var htmlBehaviorResource = resources.getAttribute("t"); - var htmlParamsResource = resources.getAttribute("t-params"); - var attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, "t"); }); - attributes.forEach(function (alias) { return resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params"); }); - }); - return ret; - } - - exports.configure = configure; - exports.DfValueConverter = DfValueConverter; - exports.DfBindingBehavior = DfBindingBehavior; - exports.NfValueConverter = NfValueConverter; - exports.NfBindingBehavior = NfBindingBehavior; - exports.RtValueConverter = RtValueConverter; - exports.RtBindingBehavior = RtBindingBehavior; - exports.TValueConverter = TValueConverter; - exports.TBindingBehavior = TBindingBehavior; - exports.TCustomAttribute = TCustomAttribute; - exports.TParamsCustomAttribute = TParamsCustomAttribute; - exports.I18N_EA_SIGNAL = I18N_EA_SIGNAL; - exports.I18N = I18N; - exports.RelativeTime = RelativeTime; - exports.Backend = Backend; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}); diff --git a/dist/aurelia-i18n.d.ts b/dist/aurelia-i18n.d.ts deleted file mode 100644 index d924ad84..00000000 --- a/dist/aurelia-i18n.d.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Container } from 'aurelia-dependency-injection'; -import { EventAggregator } from 'aurelia-event-aggregator'; -import { FrameworkConfiguration } from 'aurelia-framework'; -import { Loader } from 'aurelia-loader'; -import { BindingSignaler, SignalBindingBehavior } from 'aurelia-templating-resources'; -import i18next from 'i18next'; - -export interface AureliaEnhancedOptions extends i18next.InitOptions { - attributes?: string[]; - skipTranslationOnMissingKey?: boolean; -} -export interface AureliaEnhancedI18Next extends i18next.i18n { - options: AureliaEnhancedOptions; -} -export interface I18NEventPayload { - oldValue: string; - newValue: string; -} -export declare const I18N_EA_SIGNAL = "i18n:locale:changed"; -export declare class I18N { - private ea; - private signaler; - static inject(): (typeof EventAggregator | typeof BindingSignaler)[]; - i18nextDeferred: Promise; - i18next: AureliaEnhancedI18Next; - Intl: typeof Intl; - private globalVars; - constructor(ea: EventAggregator, signaler: BindingSignaler); - setup(options?: AureliaEnhancedOptions & i18next.InitOptions): Promise; - i18nextReady(): Promise; - setLocale(locale: string): Promise; - getLocale(): string; - nf(options?: Intl.NumberFormatOptions, locales?: string | string[]): Intl.NumberFormat; - uf(numberLike: string, locale?: string): number; - df(options?: Intl.DateTimeFormatOptions, locales?: string | string[]): Intl.DateTimeFormat; - tr(key: string | string[], options?: i18next.TOptions): string; - registerGlobalVariable(key: string, value: any): void; - unregisterGlobalVariable(key: string): void; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - updateTranslations(el: HTMLElement): void; - updateValue(node: Element & { - au: any; - }, value: string, params: any): void; -} -export declare class RelativeTime { - private service; - private ea; - static inject(): (typeof EventAggregator | typeof I18N)[]; - constructor(service: I18N, ea: EventAggregator); - setup(locales?: { - oldValue: string; - newValue: string; - }): void; - addTranslationResource(key: string, translation: any): void; - getRelativeTime(time: Date): string; - getTimeDiffDescription(diff: number, unit: "year" | "month" | "day" | "hour" | "minute" | "second", timeDivisor: number): string | null; -} -export declare type LoadPathOption = string | ((lngs: string[], namespaces: string[]) => string); -export declare type LoadCallback = (error: any, result: string | false | undefined) => void; -export interface AureliaBackendOptions { - loadPath?: LoadPathOption; - parse?(data: string, url: string): string; -} -export declare class Backend { - services: any; - options: AureliaBackendOptions; - static type: string; - static loader: Loader; - static with(loader: Loader): typeof Backend; - type: string; - constructor(services: any, options?: AureliaBackendOptions); - init(services: any, options?: AureliaBackendOptions): void; - readMulti(languages: string[], namespaces: string[], callback: LoadCallback): void; - read(language: string, namespace: string, callback: LoadCallback): void; - loadUrl(url: string, callback: LoadCallback): Promise; - create(_languages: string | string[], _namespace: string, _key: string, _fallbackValue: string): void; -} -export declare class DfBindingBehavior { - private signalBindingBehavior; - static inject(): (typeof SignalBindingBehavior)[]; - constructor(signalBindingBehavior: SignalBindingBehavior); - bind(binding: any, source: any): void; - unbind(binding: any, source: any): void; -} -export declare class DfValueConverter { - private service; - static inject(): (typeof I18N)[]; - constructor(service: I18N); - toView(value: any, dfOrOptions?: Intl.DateTimeFormat | Intl.DateTimeFormatOptions, locale?: string): any; -} -export declare class NfBindingBehavior { - private signalBindingBehavior; - static inject(): (typeof SignalBindingBehavior)[]; - constructor(signalBindingBehavior: SignalBindingBehavior); - bind(binding: any, source: any): void; - unbind(binding: any, source: any): void; -} -export declare class NfValueConverter { - private service; - static inject(): (typeof I18N)[]; - constructor(service: I18N); - toView(value: any, nfOrOptions?: Intl.NumberFormat | Intl.NumberFormatOptions, locale?: string): any; -} -export declare class RtBindingBehavior { - private signalBindingBehavior; - static inject(): (typeof SignalBindingBehavior)[]; - constructor(signalBindingBehavior: SignalBindingBehavior); - bind(binding: any, source: any): void; - unbind(binding: any, source: any): void; -} -export declare class RtValueConverter { - private service; - static inject(): (typeof RelativeTime)[]; - constructor(service: RelativeTime); - toView(value: any): any; -} -export declare class TBindingBehavior { - private signalBindingBehavior; - static inject(): (typeof SignalBindingBehavior)[]; - constructor(signalBindingBehavior: SignalBindingBehavior); - bind(binding: any, source: any): void; - unbind(binding: any, source: any): void; -} -declare class LazyOptional { - private key; - static of(key: any): LazyOptional; - constructor(key: string); - get(container: Container): () => any; -} -export declare class TCustomAttribute { - private element; - private service; - private ea; - static inject(): ({ - new (): Element; - prototype: Element; - } | typeof EventAggregator | typeof I18N | LazyOptional)[]; - static configureAliases(aliases: string[]): void; - private params; - private lazyParams; - private subscription; - private value; - constructor(element: Element & { - au: any; - }, service: I18N, ea: EventAggregator, p: any); - bind(): void; - paramsChanged(newValue: any, newParams: any): void; - valueChanged(newValue: any): void; - unbind(): void; -} -export declare class TParamsCustomAttribute { - element: Element; - static inject(): { - new (): Element; - prototype: Element; - }[]; - static configureAliases(aliases: string[]): void; - service: any; - constructor(element: Element); - valueChanged(): void; -} -export declare class TValueConverter { - private service; - static inject(): (typeof I18N)[]; - constructor(service: I18N); - toView(value: any, options?: i18next.TOptions): string; -} -export declare function configure(frameworkConfig: FrameworkConfiguration, cb: (instance: I18N) => AureliaEnhancedI18Next): AureliaEnhancedI18Next; \ No newline at end of file diff --git a/dist/commonjs/aurelia-i18n.js b/dist/commonjs/aurelia-i18n.js deleted file mode 100644 index 7e576da9..00000000 --- a/dist/commonjs/aurelia-i18n.js +++ /dev/null @@ -1,1467 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var i18next = _interopDefault(require('i18next')); -var LogManager = require('aurelia-logging'); -var aureliaDependencyInjection = require('aurelia-dependency-injection'); -var aureliaTemplating = require('aurelia-templating'); -var aureliaMetadata = require('aurelia-metadata'); -var aureliaPal = require('aurelia-pal'); -var aureliaFramework = require('aurelia-framework'); -var aureliaTemplatingResources = require('aurelia-templating-resources'); -var aureliaEventAggregator = require('aurelia-event-aggregator'); -var aureliaBinding = require('aurelia-binding'); - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -var I18N_EA_SIGNAL = "i18n:locale:changed"; -var I18N = /** @class */ (function () { - function I18N(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = aureliaPal.PLATFORM.global.Intl; - } - I18N.inject = function () { return [aureliaEventAggregator.EventAggregator, aureliaTemplatingResources.BindingSignaler]; }; - I18N.prototype.setup = function (options) { - return __awaiter(this, void 0, void 0, function () { - var defaultOptions; - var _this = this; - return __generator(this, function (_a) { - defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise(function (resolve, reject) { - _this.i18next.init(options || defaultOptions, function (err) { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (_this.i18next.options.attributes instanceof String) { - _this.i18next.options.attributes = [_this.i18next.options.attributes]; - } - resolve(_this.i18next); - }); - }); - return [2 /*return*/, this.i18nextDeferred]; - }); - }); - }; - I18N.prototype.i18nextReady = function () { - return this.i18nextDeferred; - }; - I18N.prototype.setLocale = function (locale) { - var _this = this; - return new Promise(function (resolve, reject) { - var oldLocale = _this.getLocale(); - _this.i18next.changeLanguage(locale, function (err, tr) { - if (err) { - reject(err); - } - _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - _this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - }; - I18N.prototype.getLocale = function () { - return this.i18next.language; - }; - I18N.prototype.nf = function (options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - }; - I18N.prototype.uf = function (numberLike, locale) { - var nf = this.nf({}, locale || this.getLocale()); - var comparer = nf.format(10000 / 3); - var thousandSeparator = comparer[1]; - var decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - var result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - }; - I18N.prototype.df = function (options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - }; - I18N.prototype.tr = function (key, options) { - var fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - }; - I18N.prototype.registerGlobalVariable = function (key, value) { - this.globalVars[key] = value; - }; - I18N.prototype.unregisterGlobalVariable = function (key) { - delete this.globalVars[key]; - }; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - I18N.prototype.updateTranslations = function (el) { - if (!el || !el.querySelectorAll) { - return; - } - var i; - var l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - var attributes = this.i18next.options.attributes; - var selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - var nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - var keys = void 0; - var params = void 0; - // test every attribute and get the first one that has a value - for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - var pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - }; - I18N.prototype.updateValue = function (node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - var keys = value.toString().split(";"); - var i = keys.length; - while (i--) { - var key = keys[i]; - // remove the optional attribute - var re = /\[([a-z\-, ]*)\]/ig; - var m = void 0; - var attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - var attrs = attr.split(","); - var j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - var reservedNames = ["prepend", "append", "text", "html"]; - var i18nLogger = LogManager.getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn("Aurelia I18N reserved attribute name\n\n [" + reservedNames.join(", ") + "]\n\n Your custom element has a bindable named " + attr + " which is a reserved word.\n\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name."); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn("Couldn't find translation for key: " + key); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - var newChild = aureliaPal.DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - var prependParser = aureliaPal.DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - var appendParser = aureliaPal.DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - }; - return I18N; -}()); - -var TBindingBehavior = /** @class */ (function () { - function TBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - TBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - TBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "t", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - TBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - TBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("t") - ], TBindingBehavior); - return TBindingBehavior; -}()); - -// tslint:disable-next-line:only-arrow-functions -var isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; -}; -var LazyOptional = /** @class */ (function () { - function LazyOptional(key) { - this.key = key; - } - LazyOptional_1 = LazyOptional; - LazyOptional.of = function (key) { - return new LazyOptional_1(key); - }; - LazyOptional.prototype.get = function (container) { - var _this = this; - return function () { - if (container.hasResolver(_this.key, false)) { - return container.get(_this.key); - } - return null; - }; - }; - var LazyOptional_1; - LazyOptional = LazyOptional_1 = __decorate([ - aureliaDependencyInjection.resolver() - ], LazyOptional); - return LazyOptional; -}()); - -var TParamsCustomAttribute = /** @class */ (function () { - function TParamsCustomAttribute(element) { - this.element = element; - } - TParamsCustomAttribute_1 = TParamsCustomAttribute; - TParamsCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element]; - }; - TParamsCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - }; - TParamsCustomAttribute.prototype.valueChanged = function () { }; - var TParamsCustomAttribute_1; - TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t-params") - ], TParamsCustomAttribute); - return TParamsCustomAttribute; -}()); - -var TCustomAttribute = /** @class */ (function () { - function TCustomAttribute(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - TCustomAttribute_1 = TCustomAttribute; - TCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element, I18N, aureliaEventAggregator.EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - }; - TCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - }; - TCustomAttribute.prototype.bind = function () { - var _this = this; - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = function (newParams, oldParams) { - _this.paramsChanged(_this.value, newParams, oldParams); - }; - } - var p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () { - _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - }; - TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - }; - TCustomAttribute.prototype.valueChanged = function (newValue) { - var p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - }; - TCustomAttribute.prototype.unbind = function () { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - }; - var TCustomAttribute_1; - TCustomAttribute = TCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t") - ], TCustomAttribute); - return TCustomAttribute; -}()); - -var TValueConverter = /** @class */ (function () { - function TValueConverter(service) { - this.service = service; - } - TValueConverter.inject = function () { return [I18N]; }; - TValueConverter.prototype.toView = function (value, options) { - return this.service.tr(value, options); - }; - TValueConverter = __decorate([ - aureliaFramework.valueConverter("t") - ], TValueConverter); - return TValueConverter; -}()); - -var NfBindingBehavior = /** @class */ (function () { - function NfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - NfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - NfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "nf", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - NfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - NfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("nf") - ], NfBindingBehavior); - return NfBindingBehavior; -}()); - -var NfValueConverter = /** @class */ (function () { - function NfValueConverter(service) { - this.service = service; - } - NfValueConverter.inject = function () { return [I18N]; }; - NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - }; - NfValueConverter = __decorate([ - aureliaBinding.valueConverter("nf") - ], NfValueConverter); - return NfValueConverter; -}()); - -var DfBindingBehavior = /** @class */ (function () { - function DfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - DfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - DfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "df", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - DfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - DfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("df") - ], DfBindingBehavior); - return DfBindingBehavior; -}()); - -var DfValueConverter = /** @class */ (function () { - function DfValueConverter(service) { - this.service = service; - } - DfValueConverter.inject = function () { return [I18N]; }; - DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - var df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - }; - DfValueConverter = __decorate([ - aureliaBinding.valueConverter("df") - ], DfValueConverter); - return DfValueConverter; -}()); - -var RtBindingBehavior = /** @class */ (function () { - function RtBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - RtBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - RtBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "rt", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - RtBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - RtBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("rt") - ], RtBindingBehavior); - return RtBindingBehavior; -}()); - -var translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } -}; -// tslint:enable - -var RelativeTime = /** @class */ (function () { - function RelativeTime(service, ea) { - var _this = this; - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(function () { - _this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, function (locales) { - _this.setup(locales); - }); - } - RelativeTime.inject = function () { return [I18N, aureliaEventAggregator.EventAggregator]; }; - RelativeTime.prototype.setup = function (locales) { - var trans = translations; - var fallbackLng = this.service.i18next.fallbackLng; - var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - var key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - var index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - var baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - }; - RelativeTime.prototype.addTranslationResource = function (key, translation) { - var options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (var subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", (options.interpolation.prefix || "{{") + "count" + (options.interpolation.suffix || "}}")); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - }; - RelativeTime.prototype.getRelativeTime = function (time) { - var now = new Date(); - var diff = now.getTime() - time.getTime(); - var timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - }; - RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) { - var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - var abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - }; - return RelativeTime; -}()); - -var RtValueConverter = /** @class */ (function () { - function RtValueConverter(service) { - this.service = service; - } - RtValueConverter.inject = function () { return [RelativeTime]; }; - RtValueConverter.prototype.toView = function (value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - }; - RtValueConverter = __decorate([ - aureliaBinding.valueConverter("rt") - ], RtValueConverter); - return RtValueConverter; -}()); - -var Backend = /** @class */ (function () { - function Backend(services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - Backend.with = function (loader) { - this.loader = loader; - return this; - }; - Backend.prototype.init = function (services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - }; - Backend.prototype.readMulti = function (languages, namespaces, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - var url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - }; - Backend.prototype.read = function (language, namespace, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - }; - Backend.prototype.loadUrl = function (url, callback) { - return __awaiter(this, void 0, void 0, function () { - var response, ret, err, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, Backend.loader.loadText(url)]; - case 1: - response = _b.sent(); - ret = void 0; - err = void 0; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return [2 /*return*/, callback(err, false)]; - } - callback(null, ret); - return [3 /*break*/, 3]; - case 2: - _a = _b.sent(); - callback("failed loading " + url, false /* no retry */); - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - // tslint:disable-next-line:variable-name - Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) { - // not supported - }; - Backend.type = "backend"; - return Backend; -}()); - -function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - var errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - var instance = frameworkConfig.container.get(I18N); - var ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(function () { - var resources = frameworkConfig.container.get(aureliaTemplating.ViewResources); - var htmlBehaviorResource = resources.getAttribute("t"); - var htmlParamsResource = resources.getAttribute("t-params"); - var attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, "t"); }); - attributes.forEach(function (alias) { return resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params"); }); - }); - return ret; -} - -exports.configure = configure; -exports.DfValueConverter = DfValueConverter; -exports.DfBindingBehavior = DfBindingBehavior; -exports.NfValueConverter = NfValueConverter; -exports.NfBindingBehavior = NfBindingBehavior; -exports.RtValueConverter = RtValueConverter; -exports.RtBindingBehavior = RtBindingBehavior; -exports.TValueConverter = TValueConverter; -exports.TBindingBehavior = TBindingBehavior; -exports.TCustomAttribute = TCustomAttribute; -exports.TParamsCustomAttribute = TParamsCustomAttribute; -exports.I18N_EA_SIGNAL = I18N_EA_SIGNAL; -exports.I18N = I18N; -exports.RelativeTime = RelativeTime; -exports.Backend = Backend; diff --git a/dist/es2015/aurelia-i18n.js b/dist/es2015/aurelia-i18n.js deleted file mode 100644 index 8388e6b8..00000000 --- a/dist/es2015/aurelia-i18n.js +++ /dev/null @@ -1,1385 +0,0 @@ -import i18next from 'i18next'; -import { getLogger } from 'aurelia-logging'; -import { resolver } from 'aurelia-dependency-injection'; -import { customAttribute, HtmlBehaviorResource, ViewResources } from 'aurelia-templating'; -import { metadata } from 'aurelia-metadata'; -import { DOM, PLATFORM } from 'aurelia-pal'; -import { valueConverter } from 'aurelia-framework'; -import { BindingSignaler, SignalBindingBehavior } from 'aurelia-templating-resources'; -import { EventAggregator } from 'aurelia-event-aggregator'; -import { ValueConverter, bindingBehavior, valueConverter as valueConverter$1 } from 'aurelia-binding'; - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -const I18N_EA_SIGNAL = "i18n:locale:changed"; -class I18N { - constructor(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = PLATFORM.global.Intl; - } - static inject() { return [EventAggregator, BindingSignaler]; } - setup(options) { - return __awaiter(this, void 0, void 0, function* () { - const defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise((resolve, reject) => { - this.i18next.init(options || defaultOptions, (err) => { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (this.i18next.options.attributes instanceof String) { - this.i18next.options.attributes = [this.i18next.options.attributes]; - } - resolve(this.i18next); - }); - }); - return this.i18nextDeferred; - }); - } - i18nextReady() { - return this.i18nextDeferred; - } - setLocale(locale) { - return new Promise((resolve, reject) => { - const oldLocale = this.getLocale(); - this.i18next.changeLanguage(locale, (err, tr) => { - if (err) { - reject(err); - } - this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - } - getLocale() { - return this.i18next.language; - } - nf(options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - } - uf(numberLike, locale) { - const nf = this.nf({}, locale || this.getLocale()); - const comparer = nf.format(10000 / 3); - let thousandSeparator = comparer[1]; - const decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - const result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - } - df(options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - } - tr(key, options) { - let fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - } - registerGlobalVariable(key, value) { - this.globalVars[key] = value; - } - unregisterGlobalVariable(key) { - delete this.globalVars[key]; - } - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - updateTranslations(el) { - if (!el || !el.querySelectorAll) { - return; - } - let i; - let l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - const attributes = this.i18next.options.attributes; - let selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - const nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - const node = nodes[i]; - let keys; - let params; - // test every attribute and get the first one that has a value - for (let i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - const pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - } - updateValue(node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - const keys = value.toString().split(";"); - let i = keys.length; - while (i--) { - let key = keys[i]; - // remove the optional attribute - const re = /\[([a-z\-, ]*)\]/ig; - let m; - let attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - const attrs = attr.split(","); - let j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - const attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - const reservedNames = ["prepend", "append", "text", "html"]; - const i18nLogger = getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n - If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn(`Couldn't find translation for key: ${key}`); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - const newChild = DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - const prependParser = DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (let pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - const appendParser = DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - } -} - -let TBindingBehavior = class TBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "t", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -TBindingBehavior = __decorate([ - bindingBehavior("t") -], TBindingBehavior); - -var LazyOptional_1; -// tslint:disable-next-line:only-arrow-functions -const isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; -}; -let LazyOptional = LazyOptional_1 = class LazyOptional { - constructor(key) { - this.key = key; - } - static of(key) { - return new LazyOptional_1(key); - } - get(container) { - return () => { - if (container.hasResolver(this.key, false)) { - return container.get(this.key); - } - return null; - }; - } -}; -LazyOptional = LazyOptional_1 = __decorate([ - resolver() -], LazyOptional); - -var TParamsCustomAttribute_1; -let TParamsCustomAttribute = TParamsCustomAttribute_1 = class TParamsCustomAttribute { - constructor(element) { - this.element = element; - } - static inject() { - return [DOM.Element]; - } - static configureAliases(aliases) { - const r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - } - valueChanged() { } -}; -TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - customAttribute("t-params") -], TParamsCustomAttribute); - -var TCustomAttribute_1; -let TCustomAttribute = TCustomAttribute_1 = class TCustomAttribute { - constructor(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - static inject() { - return [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - } - static configureAliases(aliases) { - const r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - } - bind() { - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = (newParams, oldParams) => { - this.paramsChanged(this.value, newParams, oldParams); - }; - } - const p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, () => { - this.service.updateValue(this.element, this.value, this.params !== null ? this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - } - paramsChanged(newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - } - valueChanged(newValue) { - const p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - } - unbind() { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - } -}; -TCustomAttribute = TCustomAttribute_1 = __decorate([ - customAttribute("t") -], TCustomAttribute); - -let TValueConverter = class TValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, options) { - return this.service.tr(value, options); - } -}; -TValueConverter = __decorate([ - valueConverter("t") -], TValueConverter); - -let NfBindingBehavior = class NfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "nf", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -NfBindingBehavior = __decorate([ - bindingBehavior("nf") -], NfBindingBehavior); - -let NfValueConverter = class NfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - const nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - } -}; -NfValueConverter = __decorate([ - valueConverter$1("nf") -], NfValueConverter); - -let DfBindingBehavior = class DfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "df", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -DfBindingBehavior = __decorate([ - bindingBehavior("df") -], DfBindingBehavior); - -let DfValueConverter = class DfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - const df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - } -}; -DfValueConverter = __decorate([ - valueConverter$1("df") -], DfValueConverter); - -let RtBindingBehavior = class RtBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "rt", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -RtBindingBehavior = __decorate([ - bindingBehavior("rt") -], RtBindingBehavior); - -const translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } -}; -// tslint:enable - -class RelativeTime { - constructor(service, ea) { - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(() => { - this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, (locales) => { - this.setup(locales); - }); - } - static inject() { return [I18N, EventAggregator]; } - setup(locales) { - const trans = translations; - const fallbackLng = this.service.i18next.fallbackLng; - let alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - const key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - let index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - const baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - } - addTranslationResource(key, translation) { - const options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (const subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", `${options.interpolation.prefix || "{{"}count${options.interpolation.suffix || "}}"}`); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - } - getRelativeTime(time) { - const now = new Date(); - const diff = now.getTime() - time.getTime(); - let timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - } - getTimeDiffDescription(diff, unit, timeDivisor) { - const unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - const abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - } -} - -let RtValueConverter = class RtValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [RelativeTime]; } - toView(value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - } -}; -RtValueConverter = __decorate([ - valueConverter$1("rt") -], RtValueConverter); - -class Backend { - constructor(services, options = {}) { - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - static with(loader) { - this.loader = loader; - return this; - } - init(services, options = {}) { - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - } - readMulti(languages, namespaces, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - const url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - } - read(language, namespace, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - const url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - } - loadUrl(url, callback) { - return __awaiter(this, void 0, void 0, function* () { - try { - const response = yield Backend.loader.loadText(url); - let ret; - let err; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return callback(err, false); - } - callback(null, ret); - } - catch (_a) { - callback("failed loading " + url, false /* no retry */); - } - }); - } - // tslint:disable-next-line:variable-name - create(_languages, _namespace, _key, _fallbackValue) { - // not supported - } -} -Backend.type = "backend"; - -function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - const errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - const instance = frameworkConfig.container.get(I18N); - const ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(() => { - const resources = frameworkConfig.container.get(ViewResources); - const htmlBehaviorResource = resources.getAttribute("t"); - const htmlParamsResource = resources.getAttribute("t-params"); - let attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach((alias) => resources.registerAttribute(alias, htmlBehaviorResource, "t")); - attributes.forEach((alias) => resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params")); - }); - return ret; -} - -export { configure, DfValueConverter, DfBindingBehavior, NfValueConverter, NfBindingBehavior, RtValueConverter, RtBindingBehavior, TValueConverter, TBindingBehavior, TCustomAttribute, TParamsCustomAttribute, I18N_EA_SIGNAL, I18N, RelativeTime, Backend }; diff --git a/dist/es2017/aurelia-i18n.js b/dist/es2017/aurelia-i18n.js deleted file mode 100644 index 3ee12d85..00000000 --- a/dist/es2017/aurelia-i18n.js +++ /dev/null @@ -1,1372 +0,0 @@ -import i18next from 'i18next'; -import { getLogger } from 'aurelia-logging'; -import { resolver } from 'aurelia-dependency-injection'; -import { customAttribute, HtmlBehaviorResource, ViewResources } from 'aurelia-templating'; -import { metadata } from 'aurelia-metadata'; -import { DOM, PLATFORM } from 'aurelia-pal'; -import { valueConverter } from 'aurelia-framework'; -import { BindingSignaler, SignalBindingBehavior } from 'aurelia-templating-resources'; -import { EventAggregator } from 'aurelia-event-aggregator'; -import { ValueConverter, bindingBehavior, valueConverter as valueConverter$1 } from 'aurelia-binding'; - -const I18N_EA_SIGNAL = "i18n:locale:changed"; -class I18N { - constructor(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = PLATFORM.global.Intl; - } - static inject() { return [EventAggregator, BindingSignaler]; } - async setup(options) { - const defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise((resolve, reject) => { - this.i18next.init(options || defaultOptions, (err) => { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (this.i18next.options.attributes instanceof String) { - this.i18next.options.attributes = [this.i18next.options.attributes]; - } - resolve(this.i18next); - }); - }); - return this.i18nextDeferred; - } - i18nextReady() { - return this.i18nextDeferred; - } - setLocale(locale) { - return new Promise((resolve, reject) => { - const oldLocale = this.getLocale(); - this.i18next.changeLanguage(locale, (err, tr) => { - if (err) { - reject(err); - } - this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - } - getLocale() { - return this.i18next.language; - } - nf(options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - } - uf(numberLike, locale) { - const nf = this.nf({}, locale || this.getLocale()); - const comparer = nf.format(10000 / 3); - let thousandSeparator = comparer[1]; - const decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - const result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - } - df(options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - } - tr(key, options) { - let fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - } - registerGlobalVariable(key, value) { - this.globalVars[key] = value; - } - unregisterGlobalVariable(key) { - delete this.globalVars[key]; - } - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - updateTranslations(el) { - if (!el || !el.querySelectorAll) { - return; - } - let i; - let l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - const attributes = this.i18next.options.attributes; - let selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - const nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - const node = nodes[i]; - let keys; - let params; - // test every attribute and get the first one that has a value - for (let i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - const pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - } - updateValue(node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - const keys = value.toString().split(";"); - let i = keys.length; - while (i--) { - let key = keys[i]; - // remove the optional attribute - const re = /\[([a-z\-, ]*)\]/ig; - let m; - let attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - const attrs = attr.split(","); - let j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - const attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - const reservedNames = ["prepend", "append", "text", "html"]; - const i18nLogger = getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n - If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn(`Couldn't find translation for key: ${key}`); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - const newChild = DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - const prependParser = DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (let pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - const appendParser = DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - } -} - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -let TBindingBehavior = class TBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "t", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -TBindingBehavior = __decorate([ - bindingBehavior("t") -], TBindingBehavior); - -var LazyOptional_1; -// tslint:disable-next-line:only-arrow-functions -const isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; -}; -let LazyOptional = LazyOptional_1 = class LazyOptional { - constructor(key) { - this.key = key; - } - static of(key) { - return new LazyOptional_1(key); - } - get(container) { - return () => { - if (container.hasResolver(this.key, false)) { - return container.get(this.key); - } - return null; - }; - } -}; -LazyOptional = LazyOptional_1 = __decorate([ - resolver() -], LazyOptional); - -var TParamsCustomAttribute_1; -let TParamsCustomAttribute = TParamsCustomAttribute_1 = class TParamsCustomAttribute { - constructor(element) { - this.element = element; - } - static inject() { - return [DOM.Element]; - } - static configureAliases(aliases) { - const r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - } - valueChanged() { } -}; -TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - customAttribute("t-params") -], TParamsCustomAttribute); - -var TCustomAttribute_1; -let TCustomAttribute = TCustomAttribute_1 = class TCustomAttribute { - constructor(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - static inject() { - return [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - } - static configureAliases(aliases) { - const r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - } - bind() { - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = (newParams, oldParams) => { - this.paramsChanged(this.value, newParams, oldParams); - }; - } - const p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, () => { - this.service.updateValue(this.element, this.value, this.params !== null ? this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - } - paramsChanged(newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - } - valueChanged(newValue) { - const p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - } - unbind() { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - } -}; -TCustomAttribute = TCustomAttribute_1 = __decorate([ - customAttribute("t") -], TCustomAttribute); - -let TValueConverter = class TValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, options) { - return this.service.tr(value, options); - } -}; -TValueConverter = __decorate([ - valueConverter("t") -], TValueConverter); - -let NfBindingBehavior = class NfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "nf", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -NfBindingBehavior = __decorate([ - bindingBehavior("nf") -], NfBindingBehavior); - -let NfValueConverter = class NfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - const nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - } -}; -NfValueConverter = __decorate([ - valueConverter$1("nf") -], NfValueConverter); - -let DfBindingBehavior = class DfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "df", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -DfBindingBehavior = __decorate([ - bindingBehavior("df") -], DfBindingBehavior); - -let DfValueConverter = class DfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - const df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - } -}; -DfValueConverter = __decorate([ - valueConverter$1("df") -], DfValueConverter); - -let RtBindingBehavior = class RtBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "rt", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } -}; -RtBindingBehavior = __decorate([ - bindingBehavior("rt") -], RtBindingBehavior); - -const translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } -}; -// tslint:enable - -class RelativeTime { - constructor(service, ea) { - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(() => { - this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, (locales) => { - this.setup(locales); - }); - } - static inject() { return [I18N, EventAggregator]; } - setup(locales) { - const trans = translations; - const fallbackLng = this.service.i18next.fallbackLng; - let alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - const key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - let index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - const baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - } - addTranslationResource(key, translation) { - const options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (const subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", `${options.interpolation.prefix || "{{"}count${options.interpolation.suffix || "}}"}`); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - } - getRelativeTime(time) { - const now = new Date(); - const diff = now.getTime() - time.getTime(); - let timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - } - getTimeDiffDescription(diff, unit, timeDivisor) { - const unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - const abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - } -} - -let RtValueConverter = class RtValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [RelativeTime]; } - toView(value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - } -}; -RtValueConverter = __decorate([ - valueConverter$1("rt") -], RtValueConverter); - -class Backend { - constructor(services, options = {}) { - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - static with(loader) { - this.loader = loader; - return this; - } - init(services, options = {}) { - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - } - readMulti(languages, namespaces, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - const url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - } - read(language, namespace, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - const url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - } - async loadUrl(url, callback) { - try { - const response = await Backend.loader.loadText(url); - let ret; - let err; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return callback(err, false); - } - callback(null, ret); - } - catch (_a) { - callback("failed loading " + url, false /* no retry */); - } - } - // tslint:disable-next-line:variable-name - create(_languages, _namespace, _key, _fallbackValue) { - // not supported - } -} -Backend.type = "backend"; - -function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - const errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - const instance = frameworkConfig.container.get(I18N); - const ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(() => { - const resources = frameworkConfig.container.get(ViewResources); - const htmlBehaviorResource = resources.getAttribute("t"); - const htmlParamsResource = resources.getAttribute("t-params"); - let attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach((alias) => resources.registerAttribute(alias, htmlBehaviorResource, "t")); - attributes.forEach((alias) => resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params")); - }); - return ret; -} - -export { configure, DfValueConverter, DfBindingBehavior, NfValueConverter, NfBindingBehavior, RtValueConverter, RtBindingBehavior, TValueConverter, TBindingBehavior, TCustomAttribute, TParamsCustomAttribute, I18N_EA_SIGNAL, I18N, RelativeTime, Backend }; diff --git a/dist/native-modules/aurelia-i18n.js b/dist/native-modules/aurelia-i18n.js deleted file mode 100644 index 029a9311..00000000 --- a/dist/native-modules/aurelia-i18n.js +++ /dev/null @@ -1,1447 +0,0 @@ -import i18next from 'i18next'; -import { getLogger } from 'aurelia-logging'; -import { resolver } from 'aurelia-dependency-injection'; -import { customAttribute, HtmlBehaviorResource, ViewResources } from 'aurelia-templating'; -import { metadata } from 'aurelia-metadata'; -import { DOM, PLATFORM } from 'aurelia-pal'; -import { valueConverter } from 'aurelia-framework'; -import { BindingSignaler, SignalBindingBehavior } from 'aurelia-templating-resources'; -import { EventAggregator } from 'aurelia-event-aggregator'; -import { ValueConverter, bindingBehavior, valueConverter as valueConverter$1 } from 'aurelia-binding'; - -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -var I18N_EA_SIGNAL = "i18n:locale:changed"; -var I18N = /** @class */ (function () { - function I18N(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = PLATFORM.global.Intl; - } - I18N.inject = function () { return [EventAggregator, BindingSignaler]; }; - I18N.prototype.setup = function (options) { - return __awaiter(this, void 0, void 0, function () { - var defaultOptions; - var _this = this; - return __generator(this, function (_a) { - defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise(function (resolve, reject) { - _this.i18next.init(options || defaultOptions, function (err) { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (_this.i18next.options.attributes instanceof String) { - _this.i18next.options.attributes = [_this.i18next.options.attributes]; - } - resolve(_this.i18next); - }); - }); - return [2 /*return*/, this.i18nextDeferred]; - }); - }); - }; - I18N.prototype.i18nextReady = function () { - return this.i18nextDeferred; - }; - I18N.prototype.setLocale = function (locale) { - var _this = this; - return new Promise(function (resolve, reject) { - var oldLocale = _this.getLocale(); - _this.i18next.changeLanguage(locale, function (err, tr) { - if (err) { - reject(err); - } - _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - _this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - }; - I18N.prototype.getLocale = function () { - return this.i18next.language; - }; - I18N.prototype.nf = function (options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - }; - I18N.prototype.uf = function (numberLike, locale) { - var nf = this.nf({}, locale || this.getLocale()); - var comparer = nf.format(10000 / 3); - var thousandSeparator = comparer[1]; - var decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - var result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - }; - I18N.prototype.df = function (options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - }; - I18N.prototype.tr = function (key, options) { - var fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - }; - I18N.prototype.registerGlobalVariable = function (key, value) { - this.globalVars[key] = value; - }; - I18N.prototype.unregisterGlobalVariable = function (key) { - delete this.globalVars[key]; - }; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - I18N.prototype.updateTranslations = function (el) { - if (!el || !el.querySelectorAll) { - return; - } - var i; - var l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - var attributes = this.i18next.options.attributes; - var selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - var nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - var keys = void 0; - var params = void 0; - // test every attribute and get the first one that has a value - for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - var pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - }; - I18N.prototype.updateValue = function (node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - var keys = value.toString().split(";"); - var i = keys.length; - while (i--) { - var key = keys[i]; - // remove the optional attribute - var re = /\[([a-z\-, ]*)\]/ig; - var m = void 0; - var attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - var attrs = attr.split(","); - var j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - var reservedNames = ["prepend", "append", "text", "html"]; - var i18nLogger = getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn("Aurelia I18N reserved attribute name\n\n [" + reservedNames.join(", ") + "]\n\n Your custom element has a bindable named " + attr + " which is a reserved word.\n\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name."); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn("Couldn't find translation for key: " + key); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - var newChild = DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - var prependParser = DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - var appendParser = DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - }; - return I18N; -}()); - -var TBindingBehavior = /** @class */ (function () { - function TBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - TBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - TBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "t", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - TBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - TBindingBehavior = __decorate([ - bindingBehavior("t") - ], TBindingBehavior); - return TBindingBehavior; -}()); - -// tslint:disable-next-line:only-arrow-functions -var isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; -}; -var LazyOptional = /** @class */ (function () { - function LazyOptional(key) { - this.key = key; - } - LazyOptional_1 = LazyOptional; - LazyOptional.of = function (key) { - return new LazyOptional_1(key); - }; - LazyOptional.prototype.get = function (container) { - var _this = this; - return function () { - if (container.hasResolver(_this.key, false)) { - return container.get(_this.key); - } - return null; - }; - }; - var LazyOptional_1; - LazyOptional = LazyOptional_1 = __decorate([ - resolver() - ], LazyOptional); - return LazyOptional; -}()); - -var TParamsCustomAttribute = /** @class */ (function () { - function TParamsCustomAttribute(element) { - this.element = element; - } - TParamsCustomAttribute_1 = TParamsCustomAttribute; - TParamsCustomAttribute.inject = function () { - return [DOM.Element]; - }; - TParamsCustomAttribute.configureAliases = function (aliases) { - var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - }; - TParamsCustomAttribute.prototype.valueChanged = function () { }; - var TParamsCustomAttribute_1; - TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - customAttribute("t-params") - ], TParamsCustomAttribute); - return TParamsCustomAttribute; -}()); - -var TCustomAttribute = /** @class */ (function () { - function TCustomAttribute(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - TCustomAttribute_1 = TCustomAttribute; - TCustomAttribute.inject = function () { - return [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - }; - TCustomAttribute.configureAliases = function (aliases) { - var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - }; - TCustomAttribute.prototype.bind = function () { - var _this = this; - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = function (newParams, oldParams) { - _this.paramsChanged(_this.value, newParams, oldParams); - }; - } - var p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () { - _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - }; - TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - }; - TCustomAttribute.prototype.valueChanged = function (newValue) { - var p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - }; - TCustomAttribute.prototype.unbind = function () { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - }; - var TCustomAttribute_1; - TCustomAttribute = TCustomAttribute_1 = __decorate([ - customAttribute("t") - ], TCustomAttribute); - return TCustomAttribute; -}()); - -var TValueConverter = /** @class */ (function () { - function TValueConverter(service) { - this.service = service; - } - TValueConverter.inject = function () { return [I18N]; }; - TValueConverter.prototype.toView = function (value, options) { - return this.service.tr(value, options); - }; - TValueConverter = __decorate([ - valueConverter("t") - ], TValueConverter); - return TValueConverter; -}()); - -var NfBindingBehavior = /** @class */ (function () { - function NfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - NfBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - NfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "nf", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - NfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - NfBindingBehavior = __decorate([ - bindingBehavior("nf") - ], NfBindingBehavior); - return NfBindingBehavior; -}()); - -var NfValueConverter = /** @class */ (function () { - function NfValueConverter(service) { - this.service = service; - } - NfValueConverter.inject = function () { return [I18N]; }; - NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - }; - NfValueConverter = __decorate([ - valueConverter$1("nf") - ], NfValueConverter); - return NfValueConverter; -}()); - -var DfBindingBehavior = /** @class */ (function () { - function DfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - DfBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - DfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "df", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - DfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - DfBindingBehavior = __decorate([ - bindingBehavior("df") - ], DfBindingBehavior); - return DfBindingBehavior; -}()); - -var DfValueConverter = /** @class */ (function () { - function DfValueConverter(service) { - this.service = service; - } - DfValueConverter.inject = function () { return [I18N]; }; - DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - var df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - }; - DfValueConverter = __decorate([ - valueConverter$1("df") - ], DfValueConverter); - return DfValueConverter; -}()); - -var RtBindingBehavior = /** @class */ (function () { - function RtBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - RtBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - RtBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "rt", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - RtBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - RtBindingBehavior = __decorate([ - bindingBehavior("rt") - ], RtBindingBehavior); - return RtBindingBehavior; -}()); - -var translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } -}; -// tslint:enable - -var RelativeTime = /** @class */ (function () { - function RelativeTime(service, ea) { - var _this = this; - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(function () { - _this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, function (locales) { - _this.setup(locales); - }); - } - RelativeTime.inject = function () { return [I18N, EventAggregator]; }; - RelativeTime.prototype.setup = function (locales) { - var trans = translations; - var fallbackLng = this.service.i18next.fallbackLng; - var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - var key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - var index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - var baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - }; - RelativeTime.prototype.addTranslationResource = function (key, translation) { - var options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (var subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", (options.interpolation.prefix || "{{") + "count" + (options.interpolation.suffix || "}}")); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - }; - RelativeTime.prototype.getRelativeTime = function (time) { - var now = new Date(); - var diff = now.getTime() - time.getTime(); - var timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - }; - RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) { - var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - var abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - }; - return RelativeTime; -}()); - -var RtValueConverter = /** @class */ (function () { - function RtValueConverter(service) { - this.service = service; - } - RtValueConverter.inject = function () { return [RelativeTime]; }; - RtValueConverter.prototype.toView = function (value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - }; - RtValueConverter = __decorate([ - valueConverter$1("rt") - ], RtValueConverter); - return RtValueConverter; -}()); - -var Backend = /** @class */ (function () { - function Backend(services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - Backend.with = function (loader) { - this.loader = loader; - return this; - }; - Backend.prototype.init = function (services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - }; - Backend.prototype.readMulti = function (languages, namespaces, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - var url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - }; - Backend.prototype.read = function (language, namespace, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - }; - Backend.prototype.loadUrl = function (url, callback) { - return __awaiter(this, void 0, void 0, function () { - var response, ret, err, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, Backend.loader.loadText(url)]; - case 1: - response = _b.sent(); - ret = void 0; - err = void 0; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return [2 /*return*/, callback(err, false)]; - } - callback(null, ret); - return [3 /*break*/, 3]; - case 2: - _a = _b.sent(); - callback("failed loading " + url, false /* no retry */); - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - // tslint:disable-next-line:variable-name - Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) { - // not supported - }; - Backend.type = "backend"; - return Backend; -}()); - -function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - var errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - var instance = frameworkConfig.container.get(I18N); - var ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(function () { - var resources = frameworkConfig.container.get(ViewResources); - var htmlBehaviorResource = resources.getAttribute("t"); - var htmlParamsResource = resources.getAttribute("t-params"); - var attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, "t"); }); - attributes.forEach(function (alias) { return resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params"); }); - }); - return ret; -} - -export { configure, DfValueConverter, DfBindingBehavior, NfValueConverter, NfBindingBehavior, RtValueConverter, RtBindingBehavior, TValueConverter, TBindingBehavior, TCustomAttribute, TParamsCustomAttribute, I18N_EA_SIGNAL, I18N, RelativeTime, Backend }; diff --git a/dist/system/aurelia-i18n.js b/dist/system/aurelia-i18n.js deleted file mode 100644 index f2bfaa38..00000000 --- a/dist/system/aurelia-i18n.js +++ /dev/null @@ -1,1473 +0,0 @@ -System.register(['i18next', 'aurelia-logging', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-metadata', 'aurelia-pal', 'aurelia-framework', 'aurelia-templating-resources', 'aurelia-event-aggregator', 'aurelia-binding'], function (exports, module) { - 'use strict'; - var i18next, getLogger, resolver, customAttribute, HtmlBehaviorResource, ViewResources, metadata, DOM, PLATFORM, valueConverter, BindingSignaler, SignalBindingBehavior, EventAggregator, ValueConverter, bindingBehavior, valueConverter$1; - return { - setters: [function (module) { - i18next = module.default; - }, function (module) { - getLogger = module.getLogger; - }, function (module) { - resolver = module.resolver; - }, function (module) { - customAttribute = module.customAttribute; - HtmlBehaviorResource = module.HtmlBehaviorResource; - ViewResources = module.ViewResources; - }, function (module) { - metadata = module.metadata; - }, function (module) { - DOM = module.DOM; - PLATFORM = module.PLATFORM; - }, function (module) { - valueConverter = module.valueConverter; - }, function (module) { - BindingSignaler = module.BindingSignaler; - SignalBindingBehavior = module.SignalBindingBehavior; - }, function (module) { - EventAggregator = module.EventAggregator; - }, function (module) { - ValueConverter = module.ValueConverter; - bindingBehavior = module.bindingBehavior; - valueConverter$1 = module.valueConverter; - }], - execute: function () { - - exports('configure', configure); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - var I18N_EA_SIGNAL = exports('I18N_EA_SIGNAL', "i18n:locale:changed"); - var I18N = exports('I18N', /** @class */ (function () { - function I18N(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = PLATFORM.global.Intl; - } - I18N.inject = function () { return [EventAggregator, BindingSignaler]; }; - I18N.prototype.setup = function (options) { - return __awaiter(this, void 0, void 0, function () { - var defaultOptions; - var _this = this; - return __generator(this, function (_a) { - defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise(function (resolve, reject) { - _this.i18next.init(options || defaultOptions, function (err) { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (_this.i18next.options.attributes instanceof String) { - _this.i18next.options.attributes = [_this.i18next.options.attributes]; - } - resolve(_this.i18next); - }); - }); - return [2 /*return*/, this.i18nextDeferred]; - }); - }); - }; - I18N.prototype.i18nextReady = function () { - return this.i18nextDeferred; - }; - I18N.prototype.setLocale = function (locale) { - var _this = this; - return new Promise(function (resolve, reject) { - var oldLocale = _this.getLocale(); - _this.i18next.changeLanguage(locale, function (err, tr) { - if (err) { - reject(err); - } - _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - _this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - }; - I18N.prototype.getLocale = function () { - return this.i18next.language; - }; - I18N.prototype.nf = function (options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - }; - I18N.prototype.uf = function (numberLike, locale) { - var nf = this.nf({}, locale || this.getLocale()); - var comparer = nf.format(10000 / 3); - var thousandSeparator = comparer[1]; - var decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - var result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - }; - I18N.prototype.df = function (options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - }; - I18N.prototype.tr = function (key, options) { - var fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - }; - I18N.prototype.registerGlobalVariable = function (key, value) { - this.globalVars[key] = value; - }; - I18N.prototype.unregisterGlobalVariable = function (key) { - delete this.globalVars[key]; - }; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - I18N.prototype.updateTranslations = function (el) { - if (!el || !el.querySelectorAll) { - return; - } - var i; - var l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - var attributes = this.i18next.options.attributes; - var selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - var nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - var keys = void 0; - var params = void 0; - // test every attribute and get the first one that has a value - for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - var pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - }; - I18N.prototype.updateValue = function (node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - var keys = value.toString().split(";"); - var i = keys.length; - while (i--) { - var key = keys[i]; - // remove the optional attribute - var re = /\[([a-z\-, ]*)\]/ig; - var m = void 0; - var attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - var attrs = attr.split(","); - var j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - var reservedNames = ["prepend", "append", "text", "html"]; - var i18nLogger = getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn("Aurelia I18N reserved attribute name\n\n [" + reservedNames.join(", ") + "]\n\n Your custom element has a bindable named " + attr + " which is a reserved word.\n\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name."); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn("Couldn't find translation for key: " + key); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - var newChild = DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - var prependParser = DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - var appendParser = DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - }; - return I18N; - }())); - - var TBindingBehavior = exports('TBindingBehavior', /** @class */ (function () { - function TBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - TBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - TBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "t", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - TBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - TBindingBehavior = __decorate([ - bindingBehavior("t") - ], TBindingBehavior); - return TBindingBehavior; - }())); - - // tslint:disable-next-line:only-arrow-functions - var isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; - }; - var LazyOptional = /** @class */ (function () { - function LazyOptional(key) { - this.key = key; - } - LazyOptional_1 = LazyOptional; - LazyOptional.of = function (key) { - return new LazyOptional_1(key); - }; - LazyOptional.prototype.get = function (container) { - var _this = this; - return function () { - if (container.hasResolver(_this.key, false)) { - return container.get(_this.key); - } - return null; - }; - }; - var LazyOptional_1; - LazyOptional = LazyOptional_1 = __decorate([ - resolver() - ], LazyOptional); - return LazyOptional; - }()); - - var TParamsCustomAttribute = exports('TParamsCustomAttribute', /** @class */ (function () { - function TParamsCustomAttribute(element) { - this.element = element; - } - TParamsCustomAttribute_1 = TParamsCustomAttribute; - TParamsCustomAttribute.inject = function () { - return [DOM.Element]; - }; - TParamsCustomAttribute.configureAliases = function (aliases) { - var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - }; - TParamsCustomAttribute.prototype.valueChanged = function () { }; - var TParamsCustomAttribute_1; - TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - customAttribute("t-params") - ], TParamsCustomAttribute); - return TParamsCustomAttribute; - }())); - - var TCustomAttribute = exports('TCustomAttribute', /** @class */ (function () { - function TCustomAttribute(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - TCustomAttribute_1 = TCustomAttribute; - TCustomAttribute.inject = function () { - return [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - }; - TCustomAttribute.configureAliases = function (aliases) { - var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - }; - TCustomAttribute.prototype.bind = function () { - var _this = this; - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = function (newParams, oldParams) { - _this.paramsChanged(_this.value, newParams, oldParams); - }; - } - var p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () { - _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - }; - TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - }; - TCustomAttribute.prototype.valueChanged = function (newValue) { - var p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - }; - TCustomAttribute.prototype.unbind = function () { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - }; - var TCustomAttribute_1; - TCustomAttribute = TCustomAttribute_1 = __decorate([ - customAttribute("t") - ], TCustomAttribute); - return TCustomAttribute; - }())); - - var TValueConverter = exports('TValueConverter', /** @class */ (function () { - function TValueConverter(service) { - this.service = service; - } - TValueConverter.inject = function () { return [I18N]; }; - TValueConverter.prototype.toView = function (value, options) { - return this.service.tr(value, options); - }; - TValueConverter = __decorate([ - valueConverter("t") - ], TValueConverter); - return TValueConverter; - }())); - - var NfBindingBehavior = exports('NfBindingBehavior', /** @class */ (function () { - function NfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - NfBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - NfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "nf", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - NfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - NfBindingBehavior = __decorate([ - bindingBehavior("nf") - ], NfBindingBehavior); - return NfBindingBehavior; - }())); - - var NfValueConverter = exports('NfValueConverter', /** @class */ (function () { - function NfValueConverter(service) { - this.service = service; - } - NfValueConverter.inject = function () { return [I18N]; }; - NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - }; - NfValueConverter = __decorate([ - valueConverter$1("nf") - ], NfValueConverter); - return NfValueConverter; - }())); - - var DfBindingBehavior = exports('DfBindingBehavior', /** @class */ (function () { - function DfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - DfBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - DfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "df", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - DfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - DfBindingBehavior = __decorate([ - bindingBehavior("df") - ], DfBindingBehavior); - return DfBindingBehavior; - }())); - - var DfValueConverter = exports('DfValueConverter', /** @class */ (function () { - function DfValueConverter(service) { - this.service = service; - } - DfValueConverter.inject = function () { return [I18N]; }; - DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - var df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - }; - DfValueConverter = __decorate([ - valueConverter$1("df") - ], DfValueConverter); - return DfValueConverter; - }())); - - var RtBindingBehavior = exports('RtBindingBehavior', /** @class */ (function () { - function RtBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - RtBindingBehavior.inject = function () { return [SignalBindingBehavior]; }; - RtBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new ValueConverter(expression, "rt", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - RtBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - RtBindingBehavior = __decorate([ - bindingBehavior("rt") - ], RtBindingBehavior); - return RtBindingBehavior; - }())); - - var translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } - }; - // tslint:enable - - var RelativeTime = exports('RelativeTime', /** @class */ (function () { - function RelativeTime(service, ea) { - var _this = this; - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(function () { - _this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, function (locales) { - _this.setup(locales); - }); - } - RelativeTime.inject = function () { return [I18N, EventAggregator]; }; - RelativeTime.prototype.setup = function (locales) { - var trans = translations; - var fallbackLng = this.service.i18next.fallbackLng; - var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - var key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - var index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - var baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - }; - RelativeTime.prototype.addTranslationResource = function (key, translation) { - var options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (var subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", (options.interpolation.prefix || "{{") + "count" + (options.interpolation.suffix || "}}")); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - }; - RelativeTime.prototype.getRelativeTime = function (time) { - var now = new Date(); - var diff = now.getTime() - time.getTime(); - var timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - }; - RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) { - var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - var abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - }; - return RelativeTime; - }())); - - var RtValueConverter = exports('RtValueConverter', /** @class */ (function () { - function RtValueConverter(service) { - this.service = service; - } - RtValueConverter.inject = function () { return [RelativeTime]; }; - RtValueConverter.prototype.toView = function (value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - }; - RtValueConverter = __decorate([ - valueConverter$1("rt") - ], RtValueConverter); - return RtValueConverter; - }())); - - var Backend = exports('Backend', /** @class */ (function () { - function Backend(services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - Backend.with = function (loader) { - this.loader = loader; - return this; - }; - Backend.prototype.init = function (services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - }; - Backend.prototype.readMulti = function (languages, namespaces, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - var url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - }; - Backend.prototype.read = function (language, namespace, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - }; - Backend.prototype.loadUrl = function (url, callback) { - return __awaiter(this, void 0, void 0, function () { - var response, ret, err, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, Backend.loader.loadText(url)]; - case 1: - response = _b.sent(); - ret = void 0; - err = void 0; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return [2 /*return*/, callback(err, false)]; - } - callback(null, ret); - return [3 /*break*/, 3]; - case 2: - _a = _b.sent(); - callback("failed loading " + url, false /* no retry */); - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - // tslint:disable-next-line:variable-name - Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) { - // not supported - }; - Backend.type = "backend"; - return Backend; - }())); - - function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - var errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - var instance = frameworkConfig.container.get(I18N); - var ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(function () { - var resources = frameworkConfig.container.get(ViewResources); - var htmlBehaviorResource = resources.getAttribute("t"); - var htmlParamsResource = resources.getAttribute("t-params"); - var attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, "t"); }); - attributes.forEach(function (alias) { return resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params"); }); - }); - return ret; - } - - } - }; -}); diff --git a/dist/umd-es2015/aurelia-i18n.js b/dist/umd-es2015/aurelia-i18n.js deleted file mode 100644 index 2c104f91..00000000 --- a/dist/umd-es2015/aurelia-i18n.js +++ /dev/null @@ -1,1390 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('i18next'), require('aurelia-logging'), require('aurelia-dependency-injection'), require('aurelia-templating'), require('aurelia-metadata'), require('aurelia-pal'), require('aurelia-framework'), require('aurelia-templating-resources'), require('aurelia-event-aggregator'), require('aurelia-binding')) : - typeof define === 'function' && define.amd ? define(['exports', 'i18next', 'aurelia-logging', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-metadata', 'aurelia-pal', 'aurelia-framework', 'aurelia-templating-resources', 'aurelia-event-aggregator', 'aurelia-binding'], factory) : - (factory((global.au = global.au || {}, global.au.i18n = {}),global.i18next,global.au.LogManager,global.au,global.au,global.au,global.au,global.au,global.au,global.au,global.au)); -}(this, (function (exports,i18next,LogManager,aureliaDependencyInjection,aureliaTemplating,aureliaMetadata,aureliaPal,aureliaFramework,aureliaTemplatingResources,aureliaEventAggregator,aureliaBinding) { 'use strict'; - - i18next = i18next && i18next.hasOwnProperty('default') ? i18next['default'] : i18next; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - const I18N_EA_SIGNAL = "i18n:locale:changed"; - class I18N { - constructor(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = aureliaPal.PLATFORM.global.Intl; - } - static inject() { return [aureliaEventAggregator.EventAggregator, aureliaTemplatingResources.BindingSignaler]; } - setup(options) { - return __awaiter(this, void 0, void 0, function* () { - const defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise((resolve, reject) => { - this.i18next.init(options || defaultOptions, (err) => { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (this.i18next.options.attributes instanceof String) { - this.i18next.options.attributes = [this.i18next.options.attributes]; - } - resolve(this.i18next); - }); - }); - return this.i18nextDeferred; - }); - } - i18nextReady() { - return this.i18nextDeferred; - } - setLocale(locale) { - return new Promise((resolve, reject) => { - const oldLocale = this.getLocale(); - this.i18next.changeLanguage(locale, (err, tr) => { - if (err) { - reject(err); - } - this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - } - getLocale() { - return this.i18next.language; - } - nf(options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - } - uf(numberLike, locale) { - const nf = this.nf({}, locale || this.getLocale()); - const comparer = nf.format(10000 / 3); - let thousandSeparator = comparer[1]; - const decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - const result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - } - df(options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - } - tr(key, options) { - let fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - } - registerGlobalVariable(key, value) { - this.globalVars[key] = value; - } - unregisterGlobalVariable(key) { - delete this.globalVars[key]; - } - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - updateTranslations(el) { - if (!el || !el.querySelectorAll) { - return; - } - let i; - let l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - const attributes = this.i18next.options.attributes; - let selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - const nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - const node = nodes[i]; - let keys; - let params; - // test every attribute and get the first one that has a value - for (let i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - const pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - } - updateValue(node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - const keys = value.toString().split(";"); - let i = keys.length; - while (i--) { - let key = keys[i]; - // remove the optional attribute - const re = /\[([a-z\-, ]*)\]/ig; - let m; - let attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - const attrs = attr.split(","); - let j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - const attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - const reservedNames = ["prepend", "append", "text", "html"]; - const i18nLogger = LogManager.getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn(`Aurelia I18N reserved attribute name\n - [${reservedNames.join(", ")}]\n - Your custom element has a bindable named ${attr} which is a reserved word.\n - If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.`); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn(`Couldn't find translation for key: ${key}`); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - const newChild = aureliaPal.DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - const prependParser = aureliaPal.DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (let pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - const appendParser = aureliaPal.DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (let ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - } - } - - exports.TBindingBehavior = class TBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [aureliaTemplatingResources.SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "t", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } - }; - exports.TBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("t") - ], exports.TBindingBehavior); - - var LazyOptional_1; - // tslint:disable-next-line:only-arrow-functions - const isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; - }; - let LazyOptional = LazyOptional_1 = class LazyOptional { - constructor(key) { - this.key = key; - } - static of(key) { - return new LazyOptional_1(key); - } - get(container) { - return () => { - if (container.hasResolver(this.key, false)) { - return container.get(this.key); - } - return null; - }; - } - }; - LazyOptional = LazyOptional_1 = __decorate([ - aureliaDependencyInjection.resolver() - ], LazyOptional); - - var TParamsCustomAttribute_1; - exports.TParamsCustomAttribute = TParamsCustomAttribute_1 = class TParamsCustomAttribute { - constructor(element) { - this.element = element; - } - static inject() { - return [aureliaPal.DOM.Element]; - } - static configureAliases(aliases) { - const r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - } - valueChanged() { } - }; - exports.TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t-params") - ], exports.TParamsCustomAttribute); - - var TCustomAttribute_1; - exports.TCustomAttribute = TCustomAttribute_1 = class TCustomAttribute { - constructor(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - static inject() { - return [aureliaPal.DOM.Element, I18N, aureliaEventAggregator.EventAggregator, LazyOptional.of(exports.TParamsCustomAttribute)]; - } - static configureAliases(aliases) { - const r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - } - bind() { - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = (newParams, oldParams) => { - this.paramsChanged(this.value, newParams, oldParams); - }; - } - const p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, () => { - this.service.updateValue(this.element, this.value, this.params !== null ? this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - } - paramsChanged(newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - } - valueChanged(newValue) { - const p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - } - unbind() { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - } - }; - exports.TCustomAttribute = TCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t") - ], exports.TCustomAttribute); - - exports.TValueConverter = class TValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, options) { - return this.service.tr(value, options); - } - }; - exports.TValueConverter = __decorate([ - aureliaFramework.valueConverter("t") - ], exports.TValueConverter); - - exports.NfBindingBehavior = class NfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [aureliaTemplatingResources.SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "nf", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } - }; - exports.NfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("nf") - ], exports.NfBindingBehavior); - - exports.NfValueConverter = class NfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - const nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - } - }; - exports.NfValueConverter = __decorate([ - aureliaBinding.valueConverter("nf") - ], exports.NfValueConverter); - - exports.DfBindingBehavior = class DfBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [aureliaTemplatingResources.SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "df", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } - }; - exports.DfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("df") - ], exports.DfBindingBehavior); - - exports.DfValueConverter = class DfValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [I18N]; } - toView(value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - const df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - } - }; - exports.DfValueConverter = __decorate([ - aureliaBinding.valueConverter("df") - ], exports.DfValueConverter); - - exports.RtBindingBehavior = class RtBindingBehavior { - constructor(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - static inject() { return [aureliaTemplatingResources.SignalBindingBehavior]; } - bind(binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - const sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - const expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "rt", sourceExpression.args, [expression, ...sourceExpression.args]); - } - unbind(binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - } - }; - exports.RtBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("rt") - ], exports.RtBindingBehavior); - - const translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } - }; - // tslint:enable - - class RelativeTime { - constructor(service, ea) { - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(() => { - this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, (locales) => { - this.setup(locales); - }); - } - static inject() { return [I18N, aureliaEventAggregator.EventAggregator]; } - setup(locales) { - const trans = translations; - const fallbackLng = this.service.i18next.fallbackLng; - let alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - const key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - let index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - const baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - } - addTranslationResource(key, translation) { - const options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (const subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", `${options.interpolation.prefix || "{{"}count${options.interpolation.suffix || "}}"}`); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - } - getRelativeTime(time) { - const now = new Date(); - const diff = now.getTime() - time.getTime(); - let timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - } - getTimeDiffDescription(diff, unit, timeDivisor) { - const unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - const abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - } - } - - exports.RtValueConverter = class RtValueConverter { - constructor(service) { - this.service = service; - } - static inject() { return [RelativeTime]; } - toView(value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - } - }; - exports.RtValueConverter = __decorate([ - aureliaBinding.valueConverter("rt") - ], exports.RtValueConverter); - - class Backend { - constructor(services, options = {}) { - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - static with(loader) { - this.loader = loader; - return this; - } - init(services, options = {}) { - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - } - readMulti(languages, namespaces, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - const url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - } - read(language, namespace, callback) { - let loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - const url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - } - loadUrl(url, callback) { - return __awaiter(this, void 0, void 0, function* () { - try { - const response = yield Backend.loader.loadText(url); - let ret; - let err; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return callback(err, false); - } - callback(null, ret); - } - catch (_a) { - callback("failed loading " + url, false /* no retry */); - } - }); - } - // tslint:disable-next-line:variable-name - create(_languages, _namespace, _key, _fallbackValue) { - // not supported - } - } - Backend.type = "backend"; - - function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - const errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - const instance = frameworkConfig.container.get(I18N); - const ret = cb(instance); - frameworkConfig.globalResources([ - exports.TValueConverter, - exports.TBindingBehavior, - exports.TCustomAttribute, - exports.TParamsCustomAttribute, - exports.NfValueConverter, - exports.NfBindingBehavior, - exports.DfValueConverter, - exports.DfBindingBehavior, - exports.RtValueConverter, - exports.RtBindingBehavior - ]); - frameworkConfig.postTask(() => { - const resources = frameworkConfig.container.get(aureliaTemplating.ViewResources); - const htmlBehaviorResource = resources.getAttribute("t"); - const htmlParamsResource = resources.getAttribute("t-params"); - let attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach((alias) => resources.registerAttribute(alias, htmlBehaviorResource, "t")); - attributes.forEach((alias) => resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params")); - }); - return ret; - } - - exports.configure = configure; - exports.I18N_EA_SIGNAL = I18N_EA_SIGNAL; - exports.I18N = I18N; - exports.RelativeTime = RelativeTime; - exports.Backend = Backend; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/umd/aurelia-i18n.js b/dist/umd/aurelia-i18n.js deleted file mode 100644 index bacc9fc1..00000000 --- a/dist/umd/aurelia-i18n.js +++ /dev/null @@ -1,1462 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('i18next'), require('aurelia-logging'), require('aurelia-dependency-injection'), require('aurelia-templating'), require('aurelia-metadata'), require('aurelia-pal'), require('aurelia-framework'), require('aurelia-templating-resources'), require('aurelia-event-aggregator'), require('aurelia-binding')) : - typeof define === 'function' && define.amd ? define(['exports', 'i18next', 'aurelia-logging', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-metadata', 'aurelia-pal', 'aurelia-framework', 'aurelia-templating-resources', 'aurelia-event-aggregator', 'aurelia-binding'], factory) : - (factory((global.au = global.au || {}, global.au.i18n = {}),global.i18next,global.au.LogManager,global.au,global.au,global.au,global.au,global.au,global.au,global.au,global.au)); -}(this, (function (exports,i18next,LogManager,aureliaDependencyInjection,aureliaTemplating,aureliaMetadata,aureliaPal,aureliaFramework,aureliaTemplatingResources,aureliaEventAggregator,aureliaBinding) { 'use strict'; - - i18next = i18next && i18next.hasOwnProperty('default') ? i18next['default'] : i18next; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - var I18N_EA_SIGNAL = "i18n:locale:changed"; - var I18N = /** @class */ (function () { - function I18N(ea, signaler) { - this.ea = ea; - this.signaler = signaler; - this.globalVars = {}; - this.i18next = i18next; - this.Intl = aureliaPal.PLATFORM.global.Intl; - } - I18N.inject = function () { return [aureliaEventAggregator.EventAggregator, aureliaTemplatingResources.BindingSignaler]; }; - I18N.prototype.setup = function (options) { - return __awaiter(this, void 0, void 0, function () { - var defaultOptions; - var _this = this; - return __generator(this, function (_a) { - defaultOptions = { - skipTranslationOnMissingKey: false, - compatibilityJSON: "v1", - lng: "en", - attributes: ["t", "i18n"], - fallbackLng: "en", - debug: false - }; - this.i18nextDeferred = new Promise(function (resolve, reject) { - _this.i18next.init(options || defaultOptions, function (err) { - if (err && !Array.isArray(err)) { - reject(err); - } - // make sure attributes is an array in case a string was provided - if (_this.i18next.options.attributes instanceof String) { - _this.i18next.options.attributes = [_this.i18next.options.attributes]; - } - resolve(_this.i18next); - }); - }); - return [2 /*return*/, this.i18nextDeferred]; - }); - }); - }; - I18N.prototype.i18nextReady = function () { - return this.i18nextDeferred; - }; - I18N.prototype.setLocale = function (locale) { - var _this = this; - return new Promise(function (resolve, reject) { - var oldLocale = _this.getLocale(); - _this.i18next.changeLanguage(locale, function (err, tr) { - if (err) { - reject(err); - } - _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale }); - _this.signaler.signal("aurelia-translation-signal"); - resolve(tr); - }); - }); - }; - I18N.prototype.getLocale = function () { - return this.i18next.language; - }; - I18N.prototype.nf = function (options, locales) { - return new this.Intl.NumberFormat(locales || this.getLocale(), options || {}); - }; - I18N.prototype.uf = function (numberLike, locale) { - var nf = this.nf({}, locale || this.getLocale()); - var comparer = nf.format(10000 / 3); - var thousandSeparator = comparer[1]; - var decimalSeparator = comparer[5]; - if (thousandSeparator === ".") { - thousandSeparator = "\\."; - } - // remove all thousand seperators - var result = numberLike.replace(new RegExp(thousandSeparator, "g"), "") - // remove non-numeric signs except -> , . - .replace(/[^\d.,-]/g, "") - // replace original decimalSeparator with english one - .replace(decimalSeparator, "."); - // return real number - return Number(result); - }; - I18N.prototype.df = function (options, locales) { - return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); - }; - I18N.prototype.tr = function (key, options) { - var fullOptions = this.globalVars; - if (options !== undefined) { - fullOptions = Object.assign(Object.assign({}, this.globalVars), options); - } - return this.i18next.t(key, fullOptions); - }; - I18N.prototype.registerGlobalVariable = function (key, value) { - this.globalVars[key] = value; - }; - I18N.prototype.unregisterGlobalVariable = function (key) { - delete this.globalVars[key]; - }; - /** - * Scans an element for children that have a translation attribute and - * updates their innerHTML with the current translation values. - * - * If an image is encountered the translated value will be applied to the src attribute. - * - * @param el HTMLElement to search within - */ - I18N.prototype.updateTranslations = function (el) { - if (!el || !el.querySelectorAll) { - return; - } - var i; - var l; - // create a selector from the specified attributes to look for - // var selector = [].concat(this.i18next.options.attributes); - var attributes = this.i18next.options.attributes; - var selector = [].concat(attributes); - for (i = 0, l = selector.length; i < l; i++) { - selector[i] = "[" + selector[i] + "]"; - } - selector = selector.join(","); - // get the nodes - var nodes = el.querySelectorAll(selector); - for (i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - var keys = void 0; - var params = void 0; - // test every attribute and get the first one that has a value - for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) { - keys = node.getAttribute(attributes[i2]); - var pname = attributes[i2] + "-params"; - if (pname && node.au && node.au[pname]) { - params = node.au[pname].viewModel.value; - } - if (keys) { - break; - } - } - // skip if nothing was found - if (!keys) { - continue; - } - // split the keys into multiple keys separated by a ; - this.updateValue(node, keys, params); - } - }; - I18N.prototype.updateValue = function (node, value, params) { - if (value === null || value === undefined) { - value = ""; - } - var keys = value.toString().split(";"); - var i = keys.length; - while (i--) { - var key = keys[i]; - // remove the optional attribute - var re = /\[([a-z\-, ]*)\]/ig; - var m = void 0; - var attr = "text"; - // set default attribute to src if this is an image node - if (node.nodeName === "IMG") { - attr = "src"; - } - // check if a attribute was specified in the key - // tslint:disable-next-line:no-conditional-assignment - while ((m = re.exec(key)) !== null) { - if (m.index === re.lastIndex) { - re.lastIndex++; - } - if (m) { - key = key.replace(m[0], ""); - attr = m[1]; - } - } - var attrs = attr.split(","); - var j = attrs.length; - while (j--) { - attr = attrs[j].trim(); - if (!node._textContent) { - node._textContent = node.textContent; - } - if (!node._innerHTML) { - node._innerHTML = node.innerHTML; - } - // convert to camelCase - // tslint:disable-next-line:only-arrow-functions - var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); - var reservedNames = ["prepend", "append", "text", "html"]; - var i18nLogger = LogManager.getLogger("i18n"); - if (reservedNames.indexOf(attr) > -1 && - node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - i18nLogger.warn("Aurelia I18N reserved attribute name\n\n [" + reservedNames.join(", ") + "]\n\n Your custom element has a bindable named " + attr + " which is a reserved word.\n\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name."); - } - if (this.i18next.options.skipTranslationOnMissingKey && - this.tr(key, params) === key) { - i18nLogger.warn("Couldn't find translation for key: " + key); - return; - } - // handle various attributes - // anything other than text,prepend,append or html will be added as an attribute on the element. - switch (attr) { - case "text": - var newChild = aureliaPal.DOM.createTextNode(this.tr(key, params)); - if (node._newChild && node._newChild.parentNode === node) { - node.removeChild(node._newChild); - } - node._newChild = newChild; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(node._newChild); - break; - case "prepend": - var prependParser = aureliaPal.DOM.createElement("div"); - prependParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._prepended) { - node.removeChild(node.childNodes[ni]); - } - } - for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) { - prependParser.childNodes[pi]._prepended = true; - if (node.firstChild) { - node.insertBefore(prependParser.childNodes[pi], node.firstChild); - } - else { - node.appendChild(prependParser.childNodes[pi]); - } - } - break; - case "append": - var appendParser = aureliaPal.DOM.createElement("div"); - appendParser.innerHTML = this.tr(key, params); - for (var ni = node.childNodes.length - 1; ni >= 0; ni--) { - if (node.childNodes[ni]._appended) { - node.removeChild(node.childNodes[ni]); - } - } - while (appendParser.firstChild) { - appendParser.firstChild._appended = true; - node.appendChild(appendParser.firstChild); - } - break; - case "html": - node.innerHTML = this.tr(key, params); - break; - default: // normal html attribute - if (node.au && - node.au.controller && - node.au.controller.viewModel && - attrCC in node.au.controller.viewModel) { - node.au.controller.viewModel[attrCC] = this.tr(key, params); - } - else { - node.setAttribute(attr, this.tr(key, params)); - } - break; - } - } - } - }; - return I18N; - }()); - - var TBindingBehavior = /** @class */ (function () { - function TBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - TBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - TBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the TValueConverter. - // pass through any args to the binding behavior to the TValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "t", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - TBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - TBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("t") - ], TBindingBehavior); - return TBindingBehavior; - }()); - - // tslint:disable-next-line:only-arrow-functions - var isInteger = Number.isInteger || function (value) { - return typeof value === "number" && - isFinite(value) && - Math.floor(value) === value; - }; - var LazyOptional = /** @class */ (function () { - function LazyOptional(key) { - this.key = key; - } - LazyOptional_1 = LazyOptional; - LazyOptional.of = function (key) { - return new LazyOptional_1(key); - }; - LazyOptional.prototype.get = function (container) { - var _this = this; - return function () { - if (container.hasResolver(_this.key, false)) { - return container.get(_this.key); - } - return null; - }; - }; - var LazyOptional_1; - LazyOptional = LazyOptional_1 = __decorate([ - aureliaDependencyInjection.resolver() - ], LazyOptional); - return LazyOptional; - }()); - - var TParamsCustomAttribute = /** @class */ (function () { - function TParamsCustomAttribute(element) { - this.element = element; - } - TParamsCustomAttribute_1 = TParamsCustomAttribute; - TParamsCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element]; - }; - TParamsCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TParamsCustomAttribute_1); - r.aliases = aliases; - }; - TParamsCustomAttribute.prototype.valueChanged = function () { }; - var TParamsCustomAttribute_1; - TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t-params") - ], TParamsCustomAttribute); - return TParamsCustomAttribute; - }()); - - var TCustomAttribute = /** @class */ (function () { - function TCustomAttribute(element, service, ea, p) { - this.element = element; - this.service = service; - this.ea = ea; - this.lazyParams = p; - } - TCustomAttribute_1 = TCustomAttribute; - TCustomAttribute.inject = function () { - return [aureliaPal.DOM.Element, I18N, aureliaEventAggregator.EventAggregator, LazyOptional.of(TParamsCustomAttribute)]; - }; - TCustomAttribute.configureAliases = function (aliases) { - var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, aureliaTemplating.HtmlBehaviorResource, TCustomAttribute_1); - r.aliases = aliases; - }; - TCustomAttribute.prototype.bind = function () { - var _this = this; - this.params = this.lazyParams(); - if (this.params) { - this.params.valueChanged = function (newParams, oldParams) { - _this.paramsChanged(_this.value, newParams, oldParams); - }; - } - var p = this.params !== null ? this.params.value : undefined; - this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () { - _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined); - }); - this.service.updateValue(this.element, this.value, p); - }; - TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) { - this.service.updateValue(this.element, newValue, newParams); - }; - TCustomAttribute.prototype.valueChanged = function (newValue) { - var p = this.params !== null ? this.params.value : undefined; - this.service.updateValue(this.element, newValue, p); - }; - TCustomAttribute.prototype.unbind = function () { - // If unbind is called before timeout for subscription is triggered, subscription will be undefined - if (this.subscription) { - this.subscription.dispose(); - } - }; - var TCustomAttribute_1; - TCustomAttribute = TCustomAttribute_1 = __decorate([ - aureliaTemplating.customAttribute("t") - ], TCustomAttribute); - return TCustomAttribute; - }()); - - var TValueConverter = /** @class */ (function () { - function TValueConverter(service) { - this.service = service; - } - TValueConverter.inject = function () { return [I18N]; }; - TValueConverter.prototype.toView = function (value, options) { - return this.service.tr(value, options); - }; - TValueConverter = __decorate([ - aureliaFramework.valueConverter("t") - ], TValueConverter); - return TValueConverter; - }()); - - var NfBindingBehavior = /** @class */ (function () { - function NfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - NfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - NfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the NfValueConverter. - // pass through any args to the binding behavior to the NfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "nf", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - NfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - NfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("nf") - ], NfBindingBehavior); - return NfBindingBehavior; - }()); - - var NfValueConverter = /** @class */ (function () { - function NfValueConverter(service) { - this.service = service; - } - NfValueConverter.inject = function () { return [I18N]; }; - NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === "function")) { - return nfOrOptions.format(value); - } - var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale()); - return nf.format(value); - }; - NfValueConverter = __decorate([ - aureliaBinding.valueConverter("nf") - ], NfValueConverter); - return NfValueConverter; - }()); - - var DfBindingBehavior = /** @class */ (function () { - function DfBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - DfBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - DfBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal"); - // rewrite the expression to use the DfValueConverter. - // pass through any args to the binding behavior to the DfValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "df", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - DfBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - DfBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("df") - ], DfBindingBehavior); - return DfBindingBehavior; - }()); - - var DfValueConverter = /** @class */ (function () { - function DfValueConverter(service) { - this.service = service; - } - DfValueConverter.inject = function () { return [I18N]; }; - DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !isInteger(value)) { - value = new Date(value); - } - if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === "function")) { - return dfOrOptions.format(value); - } - var df = this.service.df(dfOrOptions, locale || this.service.getLocale()); - return df.format(value); - }; - DfValueConverter = __decorate([ - aureliaBinding.valueConverter("df") - ], DfValueConverter); - return DfValueConverter; - }()); - - var RtBindingBehavior = /** @class */ (function () { - function RtBindingBehavior(signalBindingBehavior) { - this.signalBindingBehavior = signalBindingBehavior; - } - RtBindingBehavior.inject = function () { return [aureliaTemplatingResources.SignalBindingBehavior]; }; - RtBindingBehavior.prototype.bind = function (binding, source) { - // bind the signal behavior - this.signalBindingBehavior.bind(binding, source, "aurelia-translation-signal", "aurelia-relativetime-signal"); - // rewrite the expression to use the RtValueConverter. - // pass through any args to the binding behavior to the RtValueConverter - var sourceExpression = binding.sourceExpression; - // do create the sourceExpression only once - if (sourceExpression.rewritten) { - return; - } - sourceExpression.rewritten = true; - var expression = sourceExpression.expression; - sourceExpression.expression = new aureliaBinding.ValueConverter(expression, "rt", sourceExpression.args, [expression].concat(sourceExpression.args)); - }; - RtBindingBehavior.prototype.unbind = function (binding, source) { - // unbind the signal behavior - this.signalBindingBehavior.unbind(binding, source); - }; - RtBindingBehavior = __decorate([ - aureliaBinding.bindingBehavior("rt") - ], RtBindingBehavior); - return RtBindingBehavior; - }()); - - var translations = { - ar: { - translation: { - now: 'الآن', - second_ago: 'قبل ثانية واحدة', - second_ago_plural: 'قبل __count__ ثانية', - second_in: 'خلال ثانية واحدة', - second_in_plural: 'خلال __count__ ثانية', - minute_ago: 'قبل دقيقة واحدة', - minute_ago_plural: 'قبل __count__ دقيقة', - minute_in: 'خلال دقيقة واحدة', - minute_in_plural: 'خلال __count__ دقيقة', - hour_ago: 'قبل ساعة واحدة', - hour_ago_plural: 'قبل __count__ ساعة', - hour_in: 'خلال ساعة واحدة', - hour_in_plural: 'خلال __count__ ساعة', - day_ago: 'قبل يوم واحد', - day_ago_plural: 'قبل __count__ يومًا', - day_in: 'خلال يوم واحد', - day_in_plural: 'خلال __count__ يومًا', - month_ago: 'قبل شهر واحد', - month_ago_plural: 'قبل __count__ شهرًا', - month_in: 'خلال شهر واحد', - month_in_plural: 'خلال __count__ شهرًا', - year_ago: 'قبل سنة واحدة', - year_ago_plural: 'قبل __count__ سنة', - year_in: 'خلال سنة واحدة', - year_in_plural: 'خلال __count__ سنة' - } - }, - da: { - translation: { - now: 'lige nu', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minut siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ dag siden', - day_ago_plural: 'for __count__ dage siden', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dage', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - de: { - translation: { - now: 'jetzt gerade', - second_ago: 'vor __count__ Sekunde', - second_ago_plural: 'vor __count__ Sekunden', - second_in: 'in __count__ Sekunde', - second_in_plural: 'in __count__ Sekunden', - minute_ago: 'vor __count__ Minute', - minute_ago_plural: 'vor __count__ Minuten', - minute_in: 'in __count__ Minute', - minute_in_plural: 'in __count__ Minuten', - hour_ago: 'vor __count__ Stunde', - hour_ago_plural: 'vor __count__ Stunden', - hour_in: 'in __count__ Stunde', - hour_in_plural: 'in __count__ Stunden', - day_ago: 'vor __count__ Tag', - day_ago_plural: 'vor __count__ Tagen', - day_in: 'in __count__ Tag', - day_in_plural: 'in __count__ Tagen', - month_ago: 'vor __count__ Monat', - month_ago_plural: 'vor __count__ Monaten', - month_in: 'in __count__ Monat', - month_in_plural: 'in __count__ Monaten', - year_ago: 'vor __count__ Jahr', - year_ago_plural: 'vor __count__ Jahren', - year_in: 'in __count__ Jahr', - year_in_plural: 'in __count__ Jahren' - } - }, - en: { - translation: { - now: 'just now', - second_ago: '__count__ second ago', - second_ago_plural: '__count__ seconds ago', - second_in: 'in __count__ second', - second_in_plural: 'in __count__ seconds', - minute_ago: '__count__ minute ago', - minute_ago_plural: '__count__ minutes ago', - minute_in: 'in __count__ minute', - minute_in_plural: 'in __count__ minutes', - hour_ago: '__count__ hour ago', - hour_ago_plural: '__count__ hours ago', - hour_in: 'in __count__ hour', - hour_in_plural: 'in __count__ hours', - day_ago: '__count__ day ago', - day_ago_plural: '__count__ days ago', - day_in: 'in __count__ day', - day_in_plural: 'in __count__ days', - month_ago: '__count__ month ago', - month_ago_plural: '__count__ months ago', - month_in: 'in __count__ month', - month_in_plural: 'in __count__ months', - year_ago: '__count__ year ago', - year_ago_plural: '__count__ years ago', - year_in: 'in __count__ year', - year_in_plural: 'in __count__ years' - } - }, - es: { - translation: { - now: 'ahora mismo', - second_ago: 'hace __count__ segundo', - second_ago_plural: 'hace __count__ segundos', - second_in: 'dentro de __count__ segundo', - second_in_plural: 'dentro de __count__ segundos', - minute_ago: 'hace __count__ minuto', - minute_ago_plural: 'hace __count__ minutos', - minute_in: 'dentro de __count__ minuto', - minute_in_plural: 'dentro de __count__ minutos', - hour_ago: 'hace __count__ hora', - hour_ago_plural: 'hace __count__ horas', - hour_in: 'dentro de __count__ hora', - hour_in_plural: 'dentro de __count__ horas', - day_ago: 'hace __count__ día', - day_ago_plural: 'hace __count__ días', - day_in: 'dentro de __count__ día', - day_in_plural: 'dentro de __count__ días', - month_ago: 'hace __count__ mes', - month_ago_plural: 'hace __count__ meses', - month_in: 'dentro de __count__ mes', - month_in_plural: 'dentro de __count__ meses', - year_ago: 'hace __count__ año', - year_ago_plural: 'hace __count__ años', - year_in: 'dentro de __count__ año', - year_in_plural: 'dentro de __count__ años' - } - }, - fi: { - translation: { - now: 'Nyt', - second_ago: '__count__ sekunti sitten', - second_ago_plural: '__count__ sekuntia sitten', - second_in: '__count__ sekunnin päästä', - second_in_plural: '__count__ sekunnin päästä', - minute_ago: '__count__ minuutti sitten', - minute_ago_plural: '__count__ minuuttia sitten', - minute_in: '__count__ minuutin päästä', - minute_in_plural: '__count__ minuutin päästä', - hour_ago: '__count__ tunti sitten', - hour_ago_plural: '__count__ tuntia sitten', - hour_in: '__count__ tunnin päästä', - hour_in_plural: '__count__ tunnin päästä', - day_ago: '__count__ päivä sitten', - day_ago_plural: '__count__ päivää sitten', - day_in: '__count__ päivän päästä', - day_in_plural: '__count__ päivän päästä', - month_ago: '__count__ kuukausi sitten', - month_ago_plural: '__count__ kuukautta sitten', - month_in: '__count__ kuukauden päästä', - month_in_plural: '__count__ kuukauden päästä', - year_ago: '__count__ vuosi sitten', - year_ago_plural: '__count__ vuotta sitten', - year_in: '__count__ vuoden päästä', - year_in_plural: '__count__ vuoden päästä' - } - }, - fr: { - translation: { - now: 'maintenant', - second_ago: 'il y a __count__ seconde', - second_ago_plural: 'il y a __count__ secondes', - second_in: 'dans __count__ seconde', - second_in_plural: 'dans __count__ secondes', - minute_ago: 'il y a __count__ minute', - minute_ago_plural: 'il y a __count__ minutes', - minute_in: 'dans __count__ minute', - minute_in_plural: 'dans __count__ minutes', - hour_ago: 'il y a __count__ heure', - hour_ago_plural: 'il y a __count__ heures', - hour_in: 'dans __count__ heure', - hour_in_plural: 'dans __count__ heures', - day_ago: 'il y a __count__ jour', - day_ago_plural: 'il y a __count__ jours', - day_in: 'dans __count__ jour', - day_in_plural: 'dans __count__ jours', - month_ago: 'il y a __count__ mois', - month_ago_plural: 'il y a __count__ mois', - month_in: 'dans __count__ mois', - month_in_plural: 'dans __count__ mois', - year_ago: 'il y a __count__ an', - year_ago_plural: 'il y a __count__ ans', - year_in: 'dans __count__ an', - year_in_plural: 'dans __count__ ans' - } - }, - it: { - translation: { - now: 'adesso', - second_ago: '__count__ secondo fa', - second_ago_plural: '__count__ secondi fa', - second_in: 'tra __count__ secondo', - second_in_plural: 'tra __count__ secondi', - minute_ago: '__count__ minuto fa', - minute_ago_plural: '__count__ minuti fa', - minute_in: 'tra __count__ minuto', - minute_in_plural: 'tra __count__ minuti', - hour_ago: '__count__ ora fa', - hour_ago_plural: '__count__ ore fa', - hour_in: 'tra __count__ ora', - hour_in_plural: 'tra __count__ ore', - day_ago: '__count__ giorno fa', - day_ago_plural: '__count__ giorni fa', - day_in: 'tra __count__ giorno', - day_in_plural: 'tra __count__ giorni', - month_ago: '__count__ mese fa', - month_ago_plural: '__count__ mesi fa', - month_in: 'tra __count__ mese', - month_in_plural: 'tra __count__ mesi', - year_ago: '__count__ anno fa', - year_ago_plural: '__count__ anni fa', - year_in: 'tra __count__ anno', - year_in_plural: 'tra __count__ anni' - } - }, - ja: { - translation: { - now: 'たった今', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分前', - minute_ago_plural: '__count__ 分前', - minute_in: '__count__ 分後', - minute_in_plural: '__count__ 分後', - hour_ago: '__count__ 時間前', - hour_ago_plural: '__count__ 時間前', - hour_in: '__count__ 時間後', - hour_in_plural: '__count__ 時間後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ か月前', - month_ago_plural: '__count__ か月前', - month_in: '__count__ か月後', - month_in_plural: '__count__ か月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - } - }, - lt: { - translation: { - now: 'šiuo metu', - second_ago: 'prieš __count__ sekundę', - second_ago_plural: 'prieš __count__ sekundes', - second_in: 'po __count__ sekundės', - second_in_plural: 'po __count__ sekundžių', - minute_ago: 'prieš __count__ minutę', - minute_ago_plural: 'prieš __count__ minutes', - minute_in: 'po __count__ minutės', - minute_in_plural: 'po __count__ minučių', - hour_ago: 'prieš __count__ valandą', - hour_ago_plural: 'prieš __count__ valandas', - hour_in: 'po __count__ valandos', - hour_in_plural: 'po __count__ valandų', - day_ago: 'prieš __count__ dieną', - day_ago_plural: 'prieš __count__ dienas', - day_in: 'po __count__ dienos', - day_in_plural: 'po __count__ dienų', - month_ago: 'prieš __count__ mėnesį', - month_ago_plural: 'prieš __count__ mėnesius', - month_in: 'po __count__ mėnesio', - month_in_plural: 'po __count__ mėnesių', - year_ago: 'prieš __count__ metus', - year_ago_plural: 'prieš __count__ metus', - year_in: 'po __count__ metų', - year_in_plural: 'po __count__ metų' - } - }, - nl: { - translation: { - now: 'zonet', - second_ago: '__count__ seconde geleden', - second_ago_plural: '__count__ seconden geleden', - second_in: 'over __count__ seconde', - second_in_plural: 'over __count__ seconden', - minute_ago: '__count__ minuut geleden', - minute_ago_plural: '__count__ minuten geleden', - minute_in: 'over __count__ minuut', - minute_in_plural: 'over __count__ minuten', - hour_ago: '__count__ uur geleden', - hour_ago_plural: '__count__ uur geleden', - hour_in: 'over __count__ uur', - hour_in_plural: 'over __count__ uur', - day_ago: '__count__ dag geleden', - day_ago_plural: '__count__ dagen geleden', - day_in: 'over __count__ dag', - day_in_plural: 'over __count__ dagen', - month_ago: '__count__ maand geleden', - month_ago_plural: '__count__ maanden geleden', - month_in: 'over __count__ maand', - month_in_plural: 'over __count__ maanden', - year_ago: '__count__ jaar geleden', - year_ago_plural: '__count__ jaar geleden', - year_in: 'over __count__ jaar', - year_in_plural: 'over __count__ jaar' - } - }, - nn: { - translation: { - now: 'akkurat no', - second_ago: 'for __count__ sekund sidan', - second_ago_plural: 'for __count__ sekund sidan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekund', - minute_ago: 'for __count__ minutt sidan', - minute_ago_plural: 'for __count__ minutt sidan', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutt', - hour_ago: 'for __count__ time sidan', - hour_ago_plural: 'for __count__ timar sidan', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timar', - day_ago: 'for __count__ døgn sidan', - day_ago_plural: 'for __count__ døgn sidan', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ månad sidan', - month_ago_plural: 'for __count__ månadar sidan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månadar', - year_ago: 'for __count__ år sidan', - year_ago_plural: 'for __count__ år sidan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - nb: { - translation: { - now: 'akkurat nå', - second_ago: 'for __count__ sekund siden', - second_ago_plural: 'for __count__ sekunder siden', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'for __count__ minutt siden', - minute_ago_plural: 'for __count__ minutter siden', - minute_in: 'om __count__ minutt', - minute_in_plural: 'om __count__ minutter', - hour_ago: 'for __count__ time siden', - hour_ago_plural: 'for __count__ timer siden', - hour_in: 'om __count__ time', - hour_in_plural: 'om __count__ timer', - day_ago: 'for __count__ døgn siden', - day_ago_plural: 'for __count__ døgn siden', - day_in: 'om __count__ døgn', - day_in_plural: 'om __count__ døgn', - month_ago: 'for __count__ måned siden', - month_ago_plural: 'for __count__ måneder siden', - month_in: 'om __count__ måned', - month_in_plural: 'om __count__ måneder', - year_ago: 'for __count__ år siden', - year_ago_plural: 'for __count__ år siden', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - pl: { - translation: { - now: 'teraz', - second_ago: '__count__ sekundę temu', - second_ago_plural: '__count__ sekundy temu', - second_in: 'za __count__ sekundę', - second_in_plural: 'za __count__ sekundy', - minute_ago: '__count__ minutę temu', - minute_ago_plural: '__count__ minuty temu', - minute_in: 'za __count__ minutę', - minute_in_plural: 'za __count__ minuty', - hour_ago: '__count__ godzinę temu', - hour_ago_plural: '__count__ godziny temu', - hour_in: 'za __count__ godzinę', - hour_in_plural: 'za __count__ godziny', - day_ago: '__count__ dzień temu', - day_ago_plural: '__count__ dni temu', - day_in: 'za __count__ dzień', - day_in_plural: 'za __count__ dni', - month_ago: '__count__ miesiąc temu', - month_ago_plural: '__count__ miesiące temu', - month_in: 'za __count__ miesiąc', - month_in_plural: 'za __count__ miesiące', - year_ago: '__count__ rok temu', - year_ago_plural: '__count__ lata temu', - year_in: 'za __count__ rok', - year_in_plural: 'za __count__ lata' - } - }, - pt: { - translation: { - now: 'neste exato momento', - second_ago: 'há __count__ segundo', - second_ago_plural: 'há __count__ segundos', - second_in: 'em __count__ segundo', - second_in_plural: 'em __count__ segundos', - minute_ago: 'há __count__ minuto', - minute_ago_plural: 'há __count__ minutos', - minute_in: 'em __count__ minuto', - minute_in_plural: 'em __count__ minutos', - hour_ago: 'há __count__ hora', - hour_ago_plural: 'há __count__ horas', - hour_in: 'em __count__ hora', - hour_in_plural: 'em __count__ horas', - day_ago: 'há __count__ dia', - day_ago_plural: 'há __count__ dias', - day_in: 'em __count__ dia', - day_in_plural: 'em __count__ dias', - month_ago: 'há __count__ mês', - month_ago_plural: 'há __count__ meses', - month_in: 'em __count__ mês', - month_in_plural: 'em __count__ meses', - year_ago: 'há __count__ ano', - year_ago_plural: 'há __count__ anos', - year_in: 'em __count__ ano', - year_in_plural: 'em __count__ anos' - } - }, - sv: { - translation: { - now: 'just nu', - second_ago: 'för __count__ sekund sedan', - second_ago_plural: 'för __count__ sekunder sedan', - second_in: 'om __count__ sekund', - second_in_plural: 'om __count__ sekunder', - minute_ago: 'för __count__ minut sedan', - minute_ago_plural: 'för __count__ minuter sedan', - minute_in: 'om __count__ minut', - minute_in_plural: 'om __count__ minuter', - hour_ago: 'för __count__ timme sedan', - hour_ago_plural: 'för __count__ timmar sedan', - hour_in: 'om __count__ timme', - hour_in_plural: 'om __count__ timmar', - day_ago: 'för __count__ dag sedan', - day_ago_plural: 'för __count__ dagar sedan', - day_in: 'om __count__ dag', - day_in_plural: 'om __count__ dagar', - month_ago: 'för __count__ månad sedan', - month_ago_plural: 'för __count__ månader sedan', - month_in: 'om __count__ månad', - month_in_plural: 'om __count__ månader', - year_ago: 'för __count__ år sedan', - year_ago_plural: 'för __count__ år sedan', - year_in: 'om __count__ år', - year_in_plural: 'om __count__ år' - } - }, - th: { - translation: { - now: 'เมื่อกี้', - second_ago: '__count__ วินาทีที่ผ่านมา', - second_ago_plural: '__count__ วินาทีที่ผ่านมา', - second_in: 'ในอีก __count__ วินาที', - second_in_plural: 'ในอีก __count__ วินาที', - minute_ago: '__count__ นาทีที่ผ่านมา', - minute_ago_plural: '__count__ นาทีที่ผ่านมา', - minute_in: 'ในอีก __count__ นาที', - minute_in_plural: 'ในอีก __count__ นาที', - hour_ago: '__count__ ชั่วโมงที่ผ่านมา', - hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา', - hour_in: 'ในอีก __count__ ชั่วโมง', - hour_in_plural: 'ในอีก __count__ ชั่วโมง', - day_ago: '__count__ วันที่ผ่านมา', - day_ago_plural: '__count__ วันที่ผ่านมา', - day_in: 'ในอีก __count__ วัน', - day_in_plural: 'ในอีก __count__ วัน', - month_ago: '__count__ เดือนที่ผ่านมา', - month_ago_plural: '__count__ เดือนที่ผ่านมา', - month_in: 'ในอีก __count__ เดือน', - month_in_plural: 'ในอีก __count__ เดือน', - year_ago: '__count__ ปีที่แล้ว', - year_ago_plural: '__count__ ปีที่แล้ว', - year_in: 'ในอีก __count__ ปี', - year_in_plural: 'ในอีก __count__ ปี' - } - }, - zh: { - translation: { - now: '刚才', - second_ago: '__count__秒钟前', - second_ago_plural: '__count__秒钟前', - second_in: '__count__秒钟后', - second_in_plural: '__count__秒钟后', - minute_ago: '__count__分钟前', - minute_ago_plural: '__count__分钟前', - minute_in: '__count__分钟后', - minute_in_plural: '__count__分钟后', - hour_ago: '__count__小时前', - hour_ago_plural: '__count__小时前', - hour_in: '__count__小时后', - hour_in_plural: '__count__小时后', - day_ago: '__count__天前', - day_ago_plural: '__count__天前', - day_in: '__count__天后', - day_in_plural: '__count__天后', - month_ago: '__count__个月前', - month_ago_plural: '__count__个月前', - month_in: '__count__个月后', - month_in_plural: '__count__个月后', - year_ago: '__count__年前', - year_ago_plural: '__count__年前', - year_in: '__count__年后', - year_in_plural: '__count__年后' - } - }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, - 'zh-HK': { - translation: { - now: '剛才', - second_ago: '__count__ 秒前', - second_ago_plural: '__count__ 秒前', - second_in: '__count__ 秒後', - second_in_plural: '__count__ 秒後', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘後', - minute_in_plural: '__count__ 分鐘後', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時後', - hour_in_plural: '__count__ 小時後', - day_ago: '__count__ 日前', - day_ago_plural: '__count__ 日前', - day_in: '__count__ 日後', - day_in_plural: '__count__ 日後', - month_ago: '__count__ 個月前', - month_ago_plural: '__count__ 個月前', - month_in: '__count__ 個月後', - month_in_plural: '__count__ 個月後', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年後', - year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } - } - } - }; - // tslint:enable - - var RelativeTime = /** @class */ (function () { - function RelativeTime(service, ea) { - var _this = this; - this.service = service; - this.ea = ea; - this.service.i18nextReady().then(function () { - _this.setup(); - }); - this.ea.subscribe(I18N_EA_SIGNAL, function (locales) { - _this.setup(locales); - }); - } - RelativeTime.inject = function () { return [I18N, aureliaEventAggregator.EventAggregator]; }; - RelativeTime.prototype.setup = function (locales) { - var trans = translations; - var fallbackLng = this.service.i18next.fallbackLng; - var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng; - if (Array.isArray(alternateFb) && alternateFb.length > 0) { - alternateFb = alternateFb[0]; - } - var key = ((locales && locales.newValue) - ? locales.newValue - : this.service.getLocale()) || alternateFb; - var index = 0; - // tslint:disable-next-line:no-conditional-assignment - if ((index = key.indexOf("-")) >= 0) { - var baseLocale = key.substring(0, index); - if (trans[baseLocale]) { - this.addTranslationResource(baseLocale, trans[baseLocale].translation); - } - } - if (trans[key]) { - this.addTranslationResource(key, trans[key].translation); - } - if (trans[fallbackLng]) { - this.addTranslationResource(key, trans[fallbackLng].translation); - } - }; - RelativeTime.prototype.addTranslationResource = function (key, translation) { - var options = this.service.i18next.options; - if (options.interpolation && (options.interpolation.prefix !== "__" || options.interpolation.suffix !== "__")) { - // tslint:disable-next-line:forin - for (var subkey in translation) { - translation[subkey] = translation[subkey] - .replace("__count__", (options.interpolation.prefix || "{{") + "count" + (options.interpolation.suffix || "}}")); - } - } - this.service.i18next.addResources(key, options.defaultNS || "translation", translation); - }; - RelativeTime.prototype.getRelativeTime = function (time) { - var now = new Date(); - var diff = now.getTime() - time.getTime(); - var timeDiff = this.getTimeDiffDescription(diff, "year", 31104000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "month", 2592000000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "day", 86400000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "hour", 3600000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "minute", 60000); - if (!timeDiff) { - timeDiff = this.getTimeDiffDescription(diff, "second", 1000); - if (!timeDiff) { - timeDiff = this.service.tr("now"); - } - } - } - } - } - } - return timeDiff; - }; - RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) { - var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10); - if (unitAmount > 0) { - return this.service.tr(unit, { count: unitAmount, context: "ago" }); - } - else if (unitAmount < 0) { - var abs = Math.abs(unitAmount); - return this.service.tr(unit, { count: abs, context: "in" }); - } - return null; - }; - return RelativeTime; - }()); - - var RtValueConverter = /** @class */ (function () { - function RtValueConverter(service) { - this.service = service; - } - RtValueConverter.inject = function () { return [RelativeTime]; }; - RtValueConverter.prototype.toView = function (value) { - if (value === null - || typeof value === "undefined" - || (typeof value === "string" && value.trim() === "")) { - return value; - } - if (typeof value === "string" && isNaN(value) && !Number.isInteger(value)) { - value = new Date(value); - } - return this.service.getRelativeTime(value); - }; - RtValueConverter = __decorate([ - aureliaBinding.valueConverter("rt") - ], RtValueConverter); - return RtValueConverter; - }()); - - var Backend = /** @class */ (function () { - function Backend(services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = options; - this.type = "backend"; - this.init(services, options); - } - Backend.with = function (loader) { - this.loader = loader; - return this; - }; - Backend.prototype.init = function (services, options) { - if (options === void 0) { options = {}; } - this.services = services; - this.options = Object.assign({}, { - loadPath: "/locales/{{lng}}/{{ns}}.json", - addPath: "locales/add/{{lng}}/{{ns}}", - allowMultiLoading: false, - parse: JSON.parse - }, options); - }; - Backend.prototype.readMulti = function (languages, namespaces, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath(languages, namespaces); - } - var url = this.services - .interpolator - .interpolate(loadPath, { lng: languages.join("+"), ns: namespaces.join("+") }); - this.loadUrl(url, callback); - }; - Backend.prototype.read = function (language, namespace, callback) { - var loadPath = this.options.loadPath; - if (typeof this.options.loadPath === "function") { - loadPath = this.options.loadPath([language], [namespace]); - } - var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); - this.loadUrl(url, callback); - }; - Backend.prototype.loadUrl = function (url, callback) { - return __awaiter(this, void 0, void 0, function () { - var response, ret, err, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _b.trys.push([0, 2, , 3]); - return [4 /*yield*/, Backend.loader.loadText(url)]; - case 1: - response = _b.sent(); - ret = void 0; - err = void 0; - try { - ret = (response instanceof Object) ? response : this.options.parse(response, url); - } - catch (e) { - err = "failed parsing " + url + " to json"; - } - if (err) { - return [2 /*return*/, callback(err, false)]; - } - callback(null, ret); - return [3 /*break*/, 3]; - case 2: - _a = _b.sent(); - callback("failed loading " + url, false /* no retry */); - return [3 /*break*/, 3]; - case 3: return [2 /*return*/]; - } - }); - }); - }; - // tslint:disable-next-line:variable-name - Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) { - // not supported - }; - Backend.type = "backend"; - return Backend; - }()); - - function configure(frameworkConfig, cb) { - if (typeof cb !== "function") { - var errorMsg = "You need to provide a callback method to properly configure the library"; - throw errorMsg; - } - var instance = frameworkConfig.container.get(I18N); - var ret = cb(instance); - frameworkConfig.globalResources([ - TValueConverter, - TBindingBehavior, - TCustomAttribute, - TParamsCustomAttribute, - NfValueConverter, - NfBindingBehavior, - DfValueConverter, - DfBindingBehavior, - RtValueConverter, - RtBindingBehavior - ]); - frameworkConfig.postTask(function () { - var resources = frameworkConfig.container.get(aureliaTemplating.ViewResources); - var htmlBehaviorResource = resources.getAttribute("t"); - var htmlParamsResource = resources.getAttribute("t-params"); - var attributes = instance.i18next.options.attributes; - // Register default attributes if none provided - if (!attributes) { - attributes = ["t", "i18n"]; - } - attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, "t"); }); - attributes.forEach(function (alias) { return resources.registerAttribute(alias + "-params", htmlParamsResource, "t-params"); }); - }); - return ret; - } - - exports.configure = configure; - exports.DfValueConverter = DfValueConverter; - exports.DfBindingBehavior = DfBindingBehavior; - exports.NfValueConverter = NfValueConverter; - exports.NfBindingBehavior = NfBindingBehavior; - exports.RtValueConverter = RtValueConverter; - exports.RtBindingBehavior = RtBindingBehavior; - exports.TValueConverter = TValueConverter; - exports.TBindingBehavior = TBindingBehavior; - exports.TCustomAttribute = TCustomAttribute; - exports.TParamsCustomAttribute = TParamsCustomAttribute; - exports.I18N_EA_SIGNAL = I18N_EA_SIGNAL; - exports.I18N = I18N; - exports.RelativeTime = RelativeTime; - exports.Backend = Backend; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/package.json b/package.json index 69aa4229..2a873c70 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "prebuild": "cross-env rimraf dist", "build": "cross-env TS_NODE_PROJECT=build/tsconfig.json ts-node build/build.ts", "build:dts": "dts-bundle-generator -o dist/aurelia-i18n.d.ts src/aurelia-i18n.ts --external-types --no-check", - "build:translations": "cross-env TS_NODE_PROJECT=build/tsconfig.json NODE_ICU_DATA=./node_modules/full-icu ts-node build/translation-generator/index.ts ./src/defaultTranslations/generated.ts", + "build:translations": "cross-env TS_NODE_PROJECT=build/tsconfig.json NODE_ICU_DATA=./node_modules/full-icu ts-node build/translation-generator/index.ts ./src/defaultTranslations/relative.time.generated.ts", "precommit": "npm run lint", "changelog": "cross-env conventional-changelog -p angular -i doc/CHANGELOG.md -s", "bump-version": "npm --no-git-tag-version version", From 76fa1824b6c18ab3187317a6bbfce881b62d301a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Andre=20Sundt?= Date: Wed, 2 Sep 2020 02:38:11 +0200 Subject: [PATCH 3/4] Support generating the now translation, update translations --- build/translation-generator/all-locales.ts | 375 ------------------ .../generate-translations.ts | 7 +- .../supported-locales.ts | 2 +- src/defaultTranslations/relative.time.ts | 61 +-- test/unit/relative.time.spec.ts | 4 +- 5 files changed, 24 insertions(+), 425 deletions(-) delete mode 100644 build/translation-generator/all-locales.ts diff --git a/build/translation-generator/all-locales.ts b/build/translation-generator/all-locales.ts deleted file mode 100644 index ebe244b9..00000000 --- a/build/translation-generator/all-locales.ts +++ /dev/null @@ -1,375 +0,0 @@ -// Complete list of the locales in the Unicode CLDR registry -const locales: string[] = [ - "af", - "af-NA", - "am", - "ar", - "ar-AE", - "ar-BH", - "ar-DJ", - "ar-DZ", - "ar-EG", - "ar-EH", - "ar-ER", - "ar-IL", - "ar-IQ", - "ar-JO", - "ar-KM", - "ar-KW", - "ar-LB", - "ar-LY", - "ar-MA", - "ar-MR", - "ar-OM", - "ar-PS", - "ar-QA", - "ar-SA", - "ar-SD", - "ar-SO", - "ar-SS", - "ar-SY", - "ar-TD", - "ar-TN", - "ar-YE", - "as", - "az", - "az-Latn", - "be", - "bg", - "bn", - "bn-IN", - "bs", - "bs-Latn", - "ca", - "ca-AD", - "ca-ES-VALENCIA", - "ca-FR", - "ca-IT", - "cs", - "cy", - "da", - "da-GL", - "de", - "de-AT", - "de-BE", - "de-CH", - "de-IT", - "de-LI", - "de-LU", - "el", - "el-CY", - "en", - "en-001", - "en-150", - "en-AE", - "en-AG", - "en-AI", - "en-AS", - "en-AT", - "en-AU", - "en-BB", - "en-BE", - "en-BI", - "en-BM", - "en-BS", - "en-BW", - "en-BZ", - "en-CA", - "en-CC", - "en-CH", - "en-CK", - "en-CM", - "en-CX", - "en-CY", - "en-DE", - "en-DG", - "en-DK", - "en-DM", - "en-ER", - "en-FI", - "en-FJ", - "en-FK", - "en-FM", - "en-GB", - "en-GD", - "en-GG", - "en-GH", - "en-GI", - "en-GM", - "en-GU", - "en-GY", - "en-HK", - "en-IE", - "en-IL", - "en-IM", - "en-IN", - "en-IO", - "en-JE", - "en-JM", - "en-KE", - "en-KI", - "en-KN", - "en-KY", - "en-LC", - "en-LR", - "en-LS", - "en-MG", - "en-MH", - "en-MO", - "en-MP", - "en-MS", - "en-MT", - "en-MU", - "en-MW", - "en-MY", - "en-NA", - "en-NF", - "en-NG", - "en-NL", - "en-NR", - "en-NU", - "en-NZ", - "en-PG", - "en-PH", - "en-PK", - "en-PN", - "en-PR", - "en-PW", - "en-RW", - "en-SB", - "en-SC", - "en-SD", - "en-SE", - "en-SG", - "en-SH", - "en-SI", - "en-SL", - "en-SS", - "en-SX", - "en-SZ", - "en-TC", - "en-TK", - "en-TO", - "en-TT", - "en-TV", - "en-TZ", - "en-UG", - "en-UM", - "en-US-POSIX", - "en-VC", - "en-VG", - "en-VI", - "en-VU", - "en-WS", - "en-ZA", - "en-ZM", - "en-ZW", - "es", - "es-419", - "es-AR", - "es-BO", - "es-BR", - "es-BZ", - "es-CL", - "es-CO", - "es-CR", - "es-CU", - "es-DO", - "es-EA", - "es-EC", - "es-GQ", - "es-GT", - "es-HN", - "es-IC", - "es-MX", - "es-NI", - "es-PA", - "es-PE", - "es-PH", - "es-PR", - "es-PY", - "es-SV", - "es-US", - "es-UY", - "es-VE", - "et", - "eu", - "fa", - "fa-AF", - "fi", - "fil", - "fr", - "fr-BE", - "fr-BF", - "fr-BI", - "fr-BJ", - "fr-BL", - "fr-CA", - "fr-CD", - "fr-CF", - "fr-CG", - "fr-CH", - "fr-CI", - "fr-CM", - "fr-DJ", - "fr-DZ", - "fr-GA", - "fr-GF", - "fr-GN", - "fr-GP", - "fr-GQ", - "fr-HT", - "fr-KM", - "fr-LU", - "fr-MA", - "fr-MC", - "fr-MF", - "fr-MG", - "fr-ML", - "fr-MQ", - "fr-MR", - "fr-MU", - "fr-NC", - "fr-NE", - "fr-PF", - "fr-PM", - "fr-RE", - "fr-RW", - "fr-SC", - "fr-SN", - "fr-SY", - "fr-TD", - "fr-TG", - "fr-TN", - "fr-VU", - "fr-WF", - "fr-YT", - "ga", - "ga-GB", - "gl", - "gu", - "he", - "hi", - "hr", - "hr-BA", - "hu", - "hy", - "id", - "is", - "it", - "it-CH", - "it-SM", - "it-VA", - "ja", - "jv", - "ka", - "kk", - "km", - "kn", - "ko", - "ko-KP", - "ky", - "lo", - "lt", - "lv", - "mk", - "ml", - "mn", - "mr", - "ms", - "ms-BN", - "ms-SG", - "my", - "nb", - "nb-SJ", - "ne", - "ne-IN", - "nl", - "nl-AW", - "nl-BE", - "nl-BQ", - "nl-CW", - "nl-SR", - "nl-SX", - "or", - "pa", - "pa-Guru", - "pl", - "ps", - "ps-PK", - "pt", - "pt-AO", - "pt-CH", - "pt-CV", - "pt-GQ", - "pt-GW", - "pt-LU", - "pt-MO", - "pt-MZ", - "pt-PT", - "pt-ST", - "pt-TL", - "ro", - "ro-MD", - "ru", - "ru-BY", - "ru-KG", - "ru-KZ", - "ru-MD", - "ru-UA", - "sd", - "si", - "sk", - "sl", - "so", - "so-DJ", - "so-ET", - "so-KE", - "sq", - "sq-MK", - "sq-XK", - "sr", - "sr-Cyrl", - "sr-Cyrl-BA", - "sr-Cyrl-ME", - "sr-Cyrl-XK", - "sr-Latn", - "sr-Latn-BA", - "sr-Latn-ME", - "sr-Latn-XK", - "sv", - "sv-AX", - "sv-FI", - "sw", - "sw-CD", - "sw-KE", - "sw-UG", - "ta", - "ta-LK", - "ta-MY", - "ta-SG", - "te", - "th", - "tk", - "tr", - "tr-CY", - "uk", - "ur", - "ur-IN", - "uz", - "uz-Latn", - "vi", - "yue", - "yue-Hant", - "zh", - "zh-Hans", - "zh-Hans-HK", - "zh-Hans-MO", - "zh-Hans-SG", - "zh-Hant", - "zh-Hant-HK", - "zh-Hant-MO", - "zu" -]; - -export = locales; diff --git a/build/translation-generator/generate-translations.ts b/build/translation-generator/generate-translations.ts index 62f2c725..ba154fbf 100644 --- a/build/translation-generator/generate-translations.ts +++ b/build/translation-generator/generate-translations.ts @@ -69,6 +69,7 @@ export interface TranslationTemplate extends Record { export type Translation = TranslationTemplate; const template: TranslationTemplate<[number, Intl.RelativeTimeUnit]> = { + now: [0, "second"], second_ago: [-1, "second"], second_ago_plural: [-53, "second"], second_in: [1, "second"], @@ -118,11 +119,13 @@ function buildCompleteTranslations(locales: string[], interpolationPrefix: strin for (const locale of locales) { const translation: Partial = {}; - const relTime = new Intl.RelativeTimeFormat(locale, { numeric: "always", style: "long" }); + const numericRelTime = new Intl.RelativeTimeFormat(locale, { numeric: "always", style: "long" }); + const autoNumericRelTime = new Intl.RelativeTimeFormat(locale, { numeric: "auto", style: "long" }); Object.keys(template).forEach(key => { const params = template[key]; - const parts = relTime.formatToParts(...params); + const rt = params[0] === 0 ? autoNumericRelTime : numericRelTime; + const parts = rt.formatToParts(...params); const val = parts.map(part => { if (!["literal", "integer"].includes(part.type)) { diff --git a/build/translation-generator/supported-locales.ts b/build/translation-generator/supported-locales.ts index 1580db69..581df6ac 100644 --- a/build/translation-generator/supported-locales.ts +++ b/build/translation-generator/supported-locales.ts @@ -1,6 +1,6 @@ // List of the locales supported in aurelia-i18n const locales: string[] = [ - "ar", "da", "de", "en", "es", "fi", "fr", "it", "ja", "lt", "nl", "nn", "nb", "pl", "pt", "sv", "th", "zh", "zh-CN", "zh-HK", "zh-TW" + "ar", "da", "de", "en", "es", "fi", "fr", "it", "ja", "lt", "nl", "nn", "nb", "pl", "pt", "sv", "th", "zh", "zh-CN", "zh-HK", "zh-Hans-HK" ]; export = locales; diff --git a/src/defaultTranslations/relative.time.ts b/src/defaultTranslations/relative.time.ts index 0b032f84..fb641ec8 100644 --- a/src/defaultTranslations/relative.time.ts +++ b/src/defaultTranslations/relative.time.ts @@ -35,7 +35,7 @@ export const translations: DefaultTranslations = { }, da: { translation: { - now: 'lige nu', + now: 'nu', second_ago: 'for __count__ sekund siden', second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', @@ -64,7 +64,7 @@ export const translations: DefaultTranslations = { }, de: { translation: { - now: 'jetzt gerade', + now: 'jetzt', second_ago: 'vor __count__ Sekunde', second_ago_plural: 'vor __count__ Sekunden', second_in: 'in __count__ Sekunde', @@ -93,7 +93,7 @@ export const translations: DefaultTranslations = { }, en: { translation: { - now: 'just now', + now: 'now', second_ago: '__count__ second ago', second_ago_plural: '__count__ seconds ago', second_in: 'in __count__ second', @@ -122,7 +122,7 @@ export const translations: DefaultTranslations = { }, es: { translation: { - now: 'ahora mismo', + now: 'ahora', second_ago: 'hace __count__ segundo', second_ago_plural: 'hace __count__ segundos', second_in: 'dentro de __count__ segundo', @@ -151,7 +151,7 @@ export const translations: DefaultTranslations = { }, fi: { translation: { - now: 'Nyt', + now: 'nyt', second_ago: '__count__ sekunti sitten', second_ago_plural: '__count__ sekuntia sitten', second_in: '__count__ sekunnin päästä', @@ -209,7 +209,7 @@ export const translations: DefaultTranslations = { }, it: { translation: { - now: 'adesso', + now: 'ora', second_ago: '__count__ secondo fa', second_ago_plural: '__count__ secondi fa', second_in: 'tra __count__ secondo', @@ -238,7 +238,7 @@ export const translations: DefaultTranslations = { }, ja: { translation: { - now: 'たった今', + now: '今', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', second_in: '__count__ 秒後', @@ -267,7 +267,7 @@ export const translations: DefaultTranslations = { }, lt: { translation: { - now: 'šiuo metu', + now: 'dabar', second_ago: 'prieš __count__ sekundę', second_ago_plural: 'prieš __count__ sekundes', second_in: 'po __count__ sekundės', @@ -296,7 +296,7 @@ export const translations: DefaultTranslations = { }, nl: { translation: { - now: 'zonet', + now: 'nu', second_ago: '__count__ seconde geleden', second_ago_plural: '__count__ seconden geleden', second_in: 'over __count__ seconde', @@ -325,7 +325,7 @@ export const translations: DefaultTranslations = { }, nn: { translation: { - now: 'akkurat no', + now: 'no', second_ago: 'for __count__ sekund sidan', second_ago_plural: 'for __count__ sekund sidan', second_in: 'om __count__ sekund', @@ -354,7 +354,7 @@ export const translations: DefaultTranslations = { }, nb: { translation: { - now: 'akkurat nå', + now: 'nå', second_ago: 'for __count__ sekund siden', second_ago_plural: 'for __count__ sekunder siden', second_in: 'om __count__ sekund', @@ -412,7 +412,7 @@ export const translations: DefaultTranslations = { }, pt: { translation: { - now: 'neste exato momento', + now: 'agora', second_ago: 'há __count__ segundo', second_ago_plural: 'há __count__ segundos', second_in: 'em __count__ segundo', @@ -441,7 +441,7 @@ export const translations: DefaultTranslations = { }, sv: { translation: { - now: 'just nu', + now: 'nu', second_ago: 'för __count__ sekund sedan', second_ago_plural: 'för __count__ sekunder sedan', second_in: 'om __count__ sekund', @@ -470,7 +470,7 @@ export const translations: DefaultTranslations = { }, th: { translation: { - now: 'เมื่อกี้', + now: 'ขณะนี้', second_ago: '__count__ วินาทีที่ผ่านมา', second_ago_plural: '__count__ วินาทีที่ผ่านมา', second_in: 'ในอีก __count__ วินาที', @@ -499,7 +499,7 @@ export const translations: DefaultTranslations = { }, zh: { translation: { - now: '刚才', + now: '现在', second_ago: '__count__秒钟前', second_ago_plural: '__count__秒钟前', second_in: '__count__秒钟后', @@ -526,38 +526,9 @@ export const translations: DefaultTranslations = { year_in_plural: '__count__年后' } }, - 'zh-CN': { - translation: { - now: '刚才', - second_ago: '__count__ 秒钟前', - second_ago_plural: '__count__ 秒钟前', - second_in: '__count__ 秒内', - second_in_plural: '__count__ 秒内', - minute_ago: '__count__ 分钟前', - minute_ago_plural: '__count__ 分钟前', - minute_in: '__count__ 分钟内', - minute_in_plural: '__count__ 分钟内', - hour_ago: '__count__ 小时前', - hour_ago_plural: '__count__ 小时前', - hour_in: '__count__ 小时内', - hour_in_plural: '__count__ 小时内', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天内', - day_in_plural: '__count__ 天内', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月内', - month_in_plural: '__count__ 月内', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年内', - year_in_plural: '__count__ 年内' - } - }, 'zh-HK': { translation: { - now: '剛才', + now: '現在', second_ago: '__count__ 秒前', second_ago_plural: '__count__ 秒前', second_in: '__count__ 秒後', diff --git a/test/unit/relative.time.spec.ts b/test/unit/relative.time.spec.ts index 20f9e845..4b551270 100644 --- a/test/unit/relative.time.spec.ts +++ b/test/unit/relative.time.spec.ts @@ -41,14 +41,14 @@ describe("testing relative time support", () => { const { sut } = await arrange({ lng: undefined, fallbackLng: "en" }); const expectedDate = new Date(); - expect(sut.getRelativeTime(expectedDate)).toBe("just now"); + expect(sut.getRelativeTime(expectedDate)).toBe("now"); }); it("should provide now unit", async () => { const { sut } = await arrange(); const expectedDate = new Date(); - expect(sut.getRelativeTime(expectedDate)).toBe("just now"); + expect(sut.getRelativeTime(expectedDate)).toBe("now"); }); describe("ago tests", () => { From 7b28a322dd159fb656b6f5c317620fa6a03a6416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Andre=20Sundt?= Date: Tue, 8 Sep 2020 09:54:59 +0200 Subject: [PATCH 4/4] Fixed misplaced 'zh-TW' in translation file. --- src/defaultTranslations/relative.time.ts | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/defaultTranslations/relative.time.ts b/src/defaultTranslations/relative.time.ts index fb641ec8..98d27b3a 100644 --- a/src/defaultTranslations/relative.time.ts +++ b/src/defaultTranslations/relative.time.ts @@ -553,35 +553,35 @@ export const translations: DefaultTranslations = { year_ago_plural: '__count__ 年前', year_in: '__count__ 年後', year_in_plural: '__count__ 年後' - }, - 'zh-TW': { - translation: { - now: '剛才', - second_ago: '__count__ 秒鐘前', - second_ago_plural: '__count__ 秒鐘前', - second_in: '__count__ 秒內', - second_in_plural: '__count__ 秒內', - minute_ago: '__count__ 分鐘前', - minute_ago_plural: '__count__ 分鐘前', - minute_in: '__count__ 分鐘內', - minute_in_plural: '__count__ 分鐘內', - hour_ago: '__count__ 小時前', - hour_ago_plural: '__count__ 小時前', - hour_in: '__count__ 小時內', - hour_in_plural: '__count__ 小時內', - day_ago: '__count__ 天前', - day_ago_plural: '__count__ 天前', - day_in: '__count__ 天內', - day_in_plural: '__count__ 天內', - month_ago: '__count__ 月前', - month_ago_plural: '__count__ 月前', - month_in: '__count__ 月內', - month_in_plural: '__count__ 月內', - year_ago: '__count__ 年前', - year_ago_plural: '__count__ 年前', - year_in: '__count__ 年內', - year_in_plural: '__count__ 年內' - } + } + }, + 'zh-TW': { + translation: { + now: '剛才', + second_ago: '__count__ 秒鐘前', + second_ago_plural: '__count__ 秒鐘前', + second_in: '__count__ 秒內', + second_in_plural: '__count__ 秒內', + minute_ago: '__count__ 分鐘前', + minute_ago_plural: '__count__ 分鐘前', + minute_in: '__count__ 分鐘內', + minute_in_plural: '__count__ 分鐘內', + hour_ago: '__count__ 小時前', + hour_ago_plural: '__count__ 小時前', + hour_in: '__count__ 小時內', + hour_in_plural: '__count__ 小時內', + day_ago: '__count__ 天前', + day_ago_plural: '__count__ 天前', + day_in: '__count__ 天內', + day_in_plural: '__count__ 天內', + month_ago: '__count__ 月前', + month_ago_plural: '__count__ 月前', + month_in: '__count__ 月內', + month_in_plural: '__count__ 月內', + year_ago: '__count__ 年前', + year_ago_plural: '__count__ 年前', + year_in: '__count__ 年內', + year_in_plural: '__count__ 年內' } } };