@rxap/ngx-localize 19.1.0-dev.7 → 19.1.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/compodoc/changelog.html +5 -0
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +24 -24
- package/docs/html/classes/I18nService.html +3 -3
- package/docs/html/classes/LanguageSelectorService.html +4 -4
- package/docs/html/functions/LanguageInterceptor.html +2 -2
- package/docs/html/functions/loadI18nBootstrapHook.html +2 -2
- package/docs/html/functions/loadLanguages.html +2 -2
- package/docs/html/functions/xliffToJson.html +2 -2
- package/docs/html/index.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/I18nService.md +5 -5
- package/docs/markdown/classes/LanguageSelectorService.md +7 -7
- package/docs/markdown/functions/LanguageInterceptor.md +2 -2
- package/docs/markdown/functions/loadI18nBootstrapHook.md +2 -2
- package/docs/markdown/functions/loadLanguages.md +2 -2
- package/docs/markdown/functions/xliffToJson.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/wiki/Class.I18nService.md +4 -4
- package/docs/wiki/Class.LanguageSelectorService.md +6 -6
- package/docs/wiki/Function.LanguageInterceptor.md +1 -1
- package/docs/wiki/Function.loadI18nBootstrapHook.md +1 -1
- package/docs/wiki/Function.loadLanguages.md +1 -1
- package/docs/wiki/Function.xliffToJson.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-ngx-localize.mjs +0 -1
- package/fesm2022/rxap-ngx-localize.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **LanguageInterceptor**(`request`, `next`): `Observable`\<`HttpEvent`\<`unknown`\>\>
|
|
6
6
|
|
|
7
|
-
Defined in: [language-interceptor.ts:15](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [language-interceptor.ts:15](https://gitlab.com/rxap/packages/-/blob/8c64f6f26a2c8d3b4b24af1e31b0f4274abc83fb/packages/angular/localize/src/lib/language-interceptor.ts#L15)
|
|
8
8
|
|
|
9
9
|
Intercepts an HTTP request to include a localized 'Accept-Language' header, if available.
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **loadI18nBootstrapHook**(`options`): `Promise`\<`void`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [load-i18n-bootstrap-hook.ts:13](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [load-i18n-bootstrap-hook.ts:13](https://gitlab.com/rxap/packages/-/blob/8c64f6f26a2c8d3b4b24af1e31b0f4274abc83fb/packages/angular/localize/src/lib/load-i18n-bootstrap-hook.ts#L13)
|
|
8
8
|
|
|
9
9
|
Loads internationalization (i18n) bootstrap settings for the application.
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **loadLanguages**(`loadModule`, `locale`?, `preferredLanguages`?, `fallback`?): `Promise`\<`string`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [load-languages.ts:129](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [load-languages.ts:129](https://gitlab.com/rxap/packages/-/blob/8c64f6f26a2c8d3b4b24af1e31b0f4274abc83fb/packages/angular/localize/src/lib/load-languages.ts#L129)
|
|
8
8
|
|
|
9
9
|
Loads language translations and sets the locale for the application.
|
|
10
10
|
This function fetches the translations based on the specified locale, preferred languages,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **xliffToJson**(`translations`): `Promise`\<`any`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [xliff-to-json.ts:10](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [xliff-to-json.ts:10](https://gitlab.com/rxap/packages/-/blob/8c64f6f26a2c8d3b4b24af1e31b0f4274abc83fb/packages/angular/localize/src/lib/xliff-to-json.ts#L10)
|
|
8
8
|
|
|
9
9
|
Converts an XLIFF translation string into a JSON object with translation keys and their corresponding values.
|
|
10
10
|
|
package/docs/wiki/globals.md
CHANGED
|
@@ -245,7 +245,6 @@ async function loadLanguages(loadModule = defaultLoadModule, locale = localStora
|
|
|
245
245
|
// Fetch XLIFF translation file and transform to JSON format (JSON translations can be used directly)
|
|
246
246
|
const response = await fetchTranslations(locale, preferredLanguages, fallback);
|
|
247
247
|
if (response) {
|
|
248
|
-
console.log('json', response.json);
|
|
249
248
|
// Initialize translation
|
|
250
249
|
loadTranslations(response.json);
|
|
251
250
|
locale = response.locale;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-ngx-localize.mjs","sources":["../../../../../packages/angular/localize/src/lib/i18n.service.ts","../../../../../packages/angular/localize/src/lib/language-interceptor.ts","../../../../../packages/angular/localize/src/lib/language-selector.service.ts","../../../../../packages/angular/localize/src/lib/xliff-to-json.ts","../../../../../packages/angular/localize/src/lib/load-languages.ts","../../../../../packages/angular/localize/src/lib/load-i18n-bootstrap-hook.ts","../../../../../packages/angular/localize/src/index.ts","../../../../../packages/angular/localize/src/rxap-ngx-localize.ts"],"sourcesContent":["import {\n inject,\n Injectable,\n isDevMode,\n LOCALE_ID,\n signal,\n Signal,\n} from '@angular/core';\nimport { UserSettingsLanguageService } from '@rxap/ngx-user';\n\n/**\n * @deprecated removed\n */\n@Injectable({ providedIn: 'root' })\nexport class I18nService {\n\n private readonly localId: string = inject(LOCALE_ID);\n private readonly userSettingsLanguageService = inject(UserSettingsLanguageService);\n\n public readonly currentLanguage: Signal<string> = signal(this.localId.replace(/-[A-Z]+$/, ''));\n\n public async setLanguage(language: string) {\n await this.userSettingsLanguageService.setLanguage(language);\n if (!isDevMode()) {\n this.redirect(language);\n }\n if (typeof (this.currentLanguage as any)['set'] === 'function') {\n (this.currentLanguage as any).set(language);\n }\n }\n\n public redirect(next: string, current: string = this.currentLanguage()) {\n if (current === next) {\n console.warn('[I18nService] redirect not required - language unchanged');\n return;\n }\n const redirectUrl =\n location.origin +\n location.pathname.replace(new RegExp(`^/${ current }`), `/${ next }`) +\n location.search;\n console.log('[I18nService] redirect to: ' + redirectUrl);\n location.replace(redirectUrl);\n }\n\n}\n","import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';\nimport {\n inject,\n LOCALE_ID,\n} from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * Intercepts an HTTP request to include a localized 'Accept-Language' header, if available.\n *\n * @param {HttpRequest<unknown>} request - The HTTP request to be intercepted and optionally modified.\n * @param {HttpHandlerFn} next - The next handler in the HTTP request pipeline.\n * @return {Observable<HttpEvent<unknown>>} An observable of the HTTP response event.\n */\nexport function LanguageInterceptor(\n request: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n\n const localId = inject(LOCALE_ID, { optional: true });\n\n if (localId) {\n request = request.clone({\n headers: request.headers.set('Accept-Language', localId),\n });\n }\n\n return next(request);\n\n}\n","import {\n computed,\n inject,\n Injectable,\n Signal,\n signal,\n} from '@angular/core';\nimport {\n ConfigService,\n LanguagesConfig,\n} from '@rxap/config';\n\n/**\n * A service that manages language selection and configuration for the application.\n * Provides functionality to retrieve available languages, default language,\n * selected language, and dynamically change the application's language settings.\n */\n@Injectable({ providedIn: 'root' })\nexport class LanguageSelectorService {\n private readonly config = inject(ConfigService);\n\n public readonly languages: Signal<LanguagesConfig> = signal(this.config.get<LanguagesConfig>('i18n.languages', {}));\n public readonly defaultLanguage: Signal<string> = signal(this.config.get('i18n.defaultLanguage', Object.keys(this.languages())[0] ?? 'en'));\n public readonly selectedLanguage = signal(localStorage.getItem(\"locale\") ?? this.defaultLanguage());\n\n public readonly hasLanguages = computed(() => Object.keys(this.languages()).length > 1);\n\n /**\n * Sets the application language to the specified value if it exists in the list of supported languages.\n * Optionally reloads the page if the `reload` parameter is set to `true`.\n *\n * @param {string} language - The language code to set as the active language.\n * @param {boolean} [reload=false] - A flag indicating whether to reload the page after updating the language.\n * @return {Promise<void>} A promise that resolves once the language has been set and optional reload is completed.\n */\n public async setLanguage(language: string, reload = false) {\n if (language !== this.selectedLanguage()) {\n if (Object.keys(this.languages()).includes(language)) {\n localStorage.setItem(\"locale\", language);\n if (reload) {\n location.reload();\n }\n }\n }\n }\n\n}\n","// @ts-expect-error type definition do not exists\nimport { xliff2js } from 'xliff/esm';\n\n/**\n * Converts an XLIFF translation string into a JSON object with translation keys and their corresponding values.\n *\n * @param {string} translations - A string in XLIFF format containing translations to be parsed and transformed.\n * @return {Promise<Object>} A promise that resolves to an object where keys are translation identifiers and values are the corresponding translations in plain text or templated string format.\n */\nexport async function xliffToJson(translations: string) {\n const parserResult = await xliff2js(translations);\n const xliffContent = parserResult.resources[\"ngi18n\"];\n\n return Object.keys(xliffContent).reduce((result: any, current) => {\n const translation = xliffContent[current].target;\n if (typeof translation === \"string\") {\n result[current] = translation;\n } else if (Array.isArray(translation)) {\n result[current] = translation\n .map((entry) =>\n typeof entry === \"string\" ? entry : `{{${entry.Standalone.id}}}`,\n )\n .join(\"\");\n } else if (typeof translation === \"object\" && 'Standalone' in translation && translation.Standalone.id !== '') {\n result[current] = `{{${translation.Standalone.id}}}`;\n } else {\n console.warn(`Could not parse XLIFF: (${current}) ${ JSON.stringify(xliffContent[current]) }`);\n return result;\n }\n result[current] = result[current].replace(\"{{\", \"{$\").replace(\"}}\", \"}\");\n return result;\n }, {});\n}\n","import { registerLocaleData } from '@angular/common';\nimport { loadTranslations } from '@angular/localize';\nimport { xliffToJson } from './xliff-to-json';\n\nfunction isTranslationXml(xml: string): boolean {\n return !!xml && typeof xml === 'string' && xml.startsWith('<?xml') && xml.includes('<xliff');\n}\n\n/**\n * Fetches the translation file for the specified locale in XLIFF format.\n *\n * @param {string} locale - The locale identifier for which the translation file should be fetched.\n * @return {Promise<string | null>} A promise that resolves to the XLIFF translation file as a string\n * if successfully fetched and valid, or null if the file is invalid or could not be fetched.\n */\nasync function fetchTranslation(locale: string): Promise<string | null> {\n\n let xml: string;\n try {\n xml = await fetch(`/i18n/${ locale }.xlf`).then((r) => r.text());\n if (!isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for locale ${ locale }`);\n return null;\n }\n return xml;\n } catch (e: any) {\n console.warn(`Could not download XLIFF file for locale ${ locale }: ${ e.message }`);\n }\n\n return null;\n\n}\n\n/**\n * Fetches translations for a specified locale, attempts to use preferred languages or a fallback if necessary.\n * The function retrieves and parses translation data from XLIFF files.\n *\n * @param {string} locale - The primary locale for which to fetch translations.\n * @param {string[]} preferredLanguages - An array of preferred fallback locales to try if the primary locale fails.\n * @param {string} fallback - The fallback locale to be used if both the primary and preferred locales fail.\n * @return {Promise<{ json: any, locale: string } | null>} A promise resolving to an object containing the parsed translation data (json) and the effective locale, or null if loading fails.\n */\nasync function fetchTranslations(locale: string, preferredLanguages: string[], fallback: string): Promise<{ json: any, locale: string } | null> {\n let xml: string | null = null;\n let currentLocale: string | undefined = locale;\n do {\n xml = await fetchTranslation(currentLocale);\n if (!xml) {\n currentLocale = preferredLanguages.shift();\n }\n } while (!xml && currentLocale);\n\n if (!xml) {\n console.error(`Could not download XLIFF file for locale ${ locale } load fallback`);\n try {\n xml = await fetch(`/i18n/${ fallback }.xlf`).then((r) => r.text());\n currentLocale = locale;\n if (xml && !isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for fallback locale ${ fallback }`);\n }\n } catch (e: any) {\n console.warn(`Could not download XLIFF file for fallback locale ${ fallback }: ${ e.message }`);\n }\n }\n\n if (!xml) {\n console.error(`Could not download XLIFF file for locale ${ locale } or preferred ${preferredLanguages.join(', ')} or fallback ${ fallback }`);\n return null;\n }\n\n if (!isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for fallback locale ${ currentLocale }`);\n }\n\n let json: any;\n try {\n json = await xliffToJson(xml);\n } catch (e: any) {\n console.error(`Could not parse XLIFF file for locale ${ locale }: ${ e.message }`);\n return null;\n }\n\n return { json, locale: currentLocale ?? locale };\n\n}\n\n/**\n * Loads the locale data module for the specified locale and registers it.\n *\n * @param {string} locale - The locale identifier for which the module needs to be loaded.\n * @return {Promise<void>} A promise that resolves when the module is successfully loaded and registered, or logs an error if loading fails.\n */\nasync function defaultLoadModule(locale: string) {\n\n try {\n // Load required locale module (needs to be adjusted for different locales)\n let module: { default: any } | null = null;\n switch (locale) {\n\n case 'en':\n module = await import('@angular/common/locales/en');\n break;\n\n case 'de':\n module = await import('@angular/common/locales/de');\n break;\n\n }\n if (module) {\n registerLocaleData(module.default);\n }\n } catch (e: any) {\n console.error(`Could not load locale module for locale ${ locale }: ${ e.message }`);\n }\n\n}\n\n/**\n * Loads language translations and sets the locale for the application.\n * This function fetches the translations based on the specified locale, preferred languages,\n * and a fallback, then initializes the translations and optionally loads additional modules.\n *\n * @param {function} loadModule - A function to load additional modules for the specified locale. Defaults to `defaultLoadModule`.\n * @param {string} [locale] - The primary locale to be used. Defaults to the stored locale, browser language, or 'en'.\n * @param {string[]} [preferredLanguages] - A list of preferred languages to use, derived from the browser or input. Defaults to the browser's preferred languages.\n * @param {string} [fallback] - The fallback key for translation files. Defaults to 'messages'.\n * @return {Promise<string>} The resolved locale, as a string.\n */\nexport async function loadLanguages(\n loadModule: (locale: string) => Promise<void> = defaultLoadModule,\n locale: string = localStorage.getItem(\"locale\") || navigator.language.split('-')[0] || 'en',\n preferredLanguages = navigator.languages?.map((l) => l.split('-')[0]) ?? [],\n fallback = 'messages'\n) {\n // Fetch XLIFF translation file and transform to JSON format (JSON translations can be used directly)\n const response = await fetchTranslations(locale, preferredLanguages, fallback);\n\n if (response) {\n console.log('json', response.json);\n // Initialize translation\n loadTranslations(response.json);\n locale = response.locale;\n $localize.locale = locale;\n localStorage.setItem(\"locale\", locale);\n await loadModule(locale);\n }\n\n return locale;\n}\n","import {\n ApplicationConfig,\n LOCALE_ID,\n} from '@angular/core';\nimport { loadLanguages } from './load-languages';\n\n/**\n * Loads internationalization (i18n) bootstrap settings for the application.\n *\n * @param {Partial<ApplicationConfig>} options - The application configuration options.\n * @return {Promise<void>} A promise that resolves when the i18n bootstrap process completes.\n */\nexport async function loadI18nBootstrapHook(options: Partial<ApplicationConfig>): Promise<void> {\n\n try {\n const locale = await loadLanguages();\n console.debug('locale', locale);\n options.providers ??= [];\n options.providers.push({\n provide: LOCALE_ID,\n useValue: locale\n });\n } catch (e: any) {\n console.error(`Failed to load language translations: ${e.message}`);\n }\n\n}\n","// region \nexport * from './lib/i18n.service';\nexport * from './lib/language-interceptor';\nexport * from './lib/language-selector.service';\nexport * from './lib/load-i18n-bootstrap-hook';\nexport * from './lib/load-languages';\nexport * from './lib/xliff-to-json';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAUA;;AAEG;MAEU,WAAW,CAAA;AADxB,IAAA,WAAA,GAAA;AAGmB,QAAA,IAAA,CAAA,OAAO,GAAW,MAAM,CAAC,SAAS,CAAC;AACnC,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElE,QAAA,IAAA,CAAA,eAAe,GAAmB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAyB/F;IAvBQ,MAAM,WAAW,CAAC,QAAgB,EAAA;QACvC,MAAM,IAAI,CAAC,2BAA2B,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC5D,QAAA,IAAI,CAAC,SAAS,EAAE,EAAE;AAChB,YAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;;QAEzB,IAAI,OAAQ,IAAI,CAAC,eAAuB,CAAC,KAAK,CAAC,KAAK,UAAU,EAAE;AAC7D,YAAA,IAAI,CAAC,eAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC;;;AAIxC,IAAA,QAAQ,CAAC,IAAY,EAAE,UAAkB,IAAI,CAAC,eAAe,EAAE,EAAA;AAC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,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;;AAElC,QAAA,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC/B,QAAA,MAAM,GAAG,QAAQ,CAAC,MAAM;AACxB,QAAA,SAAS,CAAC,MAAM,GAAG,MAAM;AACzB,QAAA,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AACtC,QAAA,MAAM,UAAU,CAAC,MAAM,CAAC;;AAG1B,IAAA,OAAO,MAAM;AACf;;AC9IA;;;;;AAKG;AACI,eAAe,qBAAqB,CAAC,OAAmC,EAAA;AAE7E,IAAA,IAAI;AACF,QAAA,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE;AACpC,QAAA,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;AAC/B,QAAA,OAAO,CAAC,SAAS,KAAK,EAAE;AACxB,QAAA,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;AACrB,YAAA,OAAO,EAAE,SAAS;AAClB,YAAA,QAAQ,EAAE;AACX,SAAA,CAAC;;IACF,OAAO,CAAM,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,CAAA,sCAAA,EAAyC,CAAC,CAAC,OAAO,CAAE,CAAA,CAAC;;AAGvE;;AC1BA;AAOA;;ACPA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rxap-ngx-localize.mjs","sources":["../../../../../packages/angular/localize/src/lib/i18n.service.ts","../../../../../packages/angular/localize/src/lib/language-interceptor.ts","../../../../../packages/angular/localize/src/lib/language-selector.service.ts","../../../../../packages/angular/localize/src/lib/xliff-to-json.ts","../../../../../packages/angular/localize/src/lib/load-languages.ts","../../../../../packages/angular/localize/src/lib/load-i18n-bootstrap-hook.ts","../../../../../packages/angular/localize/src/index.ts","../../../../../packages/angular/localize/src/rxap-ngx-localize.ts"],"sourcesContent":["import {\n inject,\n Injectable,\n isDevMode,\n LOCALE_ID,\n signal,\n Signal,\n} from '@angular/core';\nimport { UserSettingsLanguageService } from '@rxap/ngx-user';\n\n/**\n * @deprecated removed\n */\n@Injectable({ providedIn: 'root' })\nexport class I18nService {\n\n private readonly localId: string = inject(LOCALE_ID);\n private readonly userSettingsLanguageService = inject(UserSettingsLanguageService);\n\n public readonly currentLanguage: Signal<string> = signal(this.localId.replace(/-[A-Z]+$/, ''));\n\n public async setLanguage(language: string) {\n await this.userSettingsLanguageService.setLanguage(language);\n if (!isDevMode()) {\n this.redirect(language);\n }\n if (typeof (this.currentLanguage as any)['set'] === 'function') {\n (this.currentLanguage as any).set(language);\n }\n }\n\n public redirect(next: string, current: string = this.currentLanguage()) {\n if (current === next) {\n console.warn('[I18nService] redirect not required - language unchanged');\n return;\n }\n const redirectUrl =\n location.origin +\n location.pathname.replace(new RegExp(`^/${ current }`), `/${ next }`) +\n location.search;\n console.log('[I18nService] redirect to: ' + redirectUrl);\n location.replace(redirectUrl);\n }\n\n}\n","import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';\nimport {\n inject,\n LOCALE_ID,\n} from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * Intercepts an HTTP request to include a localized 'Accept-Language' header, if available.\n *\n * @param {HttpRequest<unknown>} request - The HTTP request to be intercepted and optionally modified.\n * @param {HttpHandlerFn} next - The next handler in the HTTP request pipeline.\n * @return {Observable<HttpEvent<unknown>>} An observable of the HTTP response event.\n */\nexport function LanguageInterceptor(\n request: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n\n const localId = inject(LOCALE_ID, { optional: true });\n\n if (localId) {\n request = request.clone({\n headers: request.headers.set('Accept-Language', localId),\n });\n }\n\n return next(request);\n\n}\n","import {\n computed,\n inject,\n Injectable,\n Signal,\n signal,\n} from '@angular/core';\nimport {\n ConfigService,\n LanguagesConfig,\n} from '@rxap/config';\n\n/**\n * A service that manages language selection and configuration for the application.\n * Provides functionality to retrieve available languages, default language,\n * selected language, and dynamically change the application's language settings.\n */\n@Injectable({ providedIn: 'root' })\nexport class LanguageSelectorService {\n private readonly config = inject(ConfigService);\n\n public readonly languages: Signal<LanguagesConfig> = signal(this.config.get<LanguagesConfig>('i18n.languages', {}));\n public readonly defaultLanguage: Signal<string> = signal(this.config.get('i18n.defaultLanguage', Object.keys(this.languages())[0] ?? 'en'));\n public readonly selectedLanguage = signal(localStorage.getItem(\"locale\") ?? this.defaultLanguage());\n\n public readonly hasLanguages = computed(() => Object.keys(this.languages()).length > 1);\n\n /**\n * Sets the application language to the specified value if it exists in the list of supported languages.\n * Optionally reloads the page if the `reload` parameter is set to `true`.\n *\n * @param {string} language - The language code to set as the active language.\n * @param {boolean} [reload=false] - A flag indicating whether to reload the page after updating the language.\n * @return {Promise<void>} A promise that resolves once the language has been set and optional reload is completed.\n */\n public async setLanguage(language: string, reload = false) {\n if (language !== this.selectedLanguage()) {\n if (Object.keys(this.languages()).includes(language)) {\n localStorage.setItem(\"locale\", language);\n if (reload) {\n location.reload();\n }\n }\n }\n }\n\n}\n","// @ts-expect-error type definition do not exists\nimport { xliff2js } from 'xliff/esm';\n\n/**\n * Converts an XLIFF translation string into a JSON object with translation keys and their corresponding values.\n *\n * @param {string} translations - A string in XLIFF format containing translations to be parsed and transformed.\n * @return {Promise<Object>} A promise that resolves to an object where keys are translation identifiers and values are the corresponding translations in plain text or templated string format.\n */\nexport async function xliffToJson(translations: string) {\n const parserResult = await xliff2js(translations);\n const xliffContent = parserResult.resources[\"ngi18n\"];\n\n return Object.keys(xliffContent).reduce((result: any, current) => {\n const translation = xliffContent[current].target;\n if (typeof translation === \"string\") {\n result[current] = translation;\n } else if (Array.isArray(translation)) {\n result[current] = translation\n .map((entry) =>\n typeof entry === \"string\" ? entry : `{{${entry.Standalone.id}}}`,\n )\n .join(\"\");\n } else if (typeof translation === \"object\" && 'Standalone' in translation && translation.Standalone.id !== '') {\n result[current] = `{{${translation.Standalone.id}}}`;\n } else {\n console.warn(`Could not parse XLIFF: (${current}) ${ JSON.stringify(xliffContent[current]) }`);\n return result;\n }\n result[current] = result[current].replace(\"{{\", \"{$\").replace(\"}}\", \"}\");\n return result;\n }, {});\n}\n","import { registerLocaleData } from '@angular/common';\nimport { loadTranslations } from '@angular/localize';\nimport { xliffToJson } from './xliff-to-json';\n\nfunction isTranslationXml(xml: string): boolean {\n return !!xml && typeof xml === 'string' && xml.startsWith('<?xml') && xml.includes('<xliff');\n}\n\n/**\n * Fetches the translation file for the specified locale in XLIFF format.\n *\n * @param {string} locale - The locale identifier for which the translation file should be fetched.\n * @return {Promise<string | null>} A promise that resolves to the XLIFF translation file as a string\n * if successfully fetched and valid, or null if the file is invalid or could not be fetched.\n */\nasync function fetchTranslation(locale: string): Promise<string | null> {\n\n let xml: string;\n try {\n xml = await fetch(`/i18n/${ locale }.xlf`).then((r) => r.text());\n if (!isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for locale ${ locale }`);\n return null;\n }\n return xml;\n } catch (e: any) {\n console.warn(`Could not download XLIFF file for locale ${ locale }: ${ e.message }`);\n }\n\n return null;\n\n}\n\n/**\n * Fetches translations for a specified locale, attempts to use preferred languages or a fallback if necessary.\n * The function retrieves and parses translation data from XLIFF files.\n *\n * @param {string} locale - The primary locale for which to fetch translations.\n * @param {string[]} preferredLanguages - An array of preferred fallback locales to try if the primary locale fails.\n * @param {string} fallback - The fallback locale to be used if both the primary and preferred locales fail.\n * @return {Promise<{ json: any, locale: string } | null>} A promise resolving to an object containing the parsed translation data (json) and the effective locale, or null if loading fails.\n */\nasync function fetchTranslations(locale: string, preferredLanguages: string[], fallback: string): Promise<{ json: any, locale: string } | null> {\n let xml: string | null = null;\n let currentLocale: string | undefined = locale;\n do {\n xml = await fetchTranslation(currentLocale);\n if (!xml) {\n currentLocale = preferredLanguages.shift();\n }\n } while (!xml && currentLocale);\n\n if (!xml) {\n console.error(`Could not download XLIFF file for locale ${ locale } load fallback`);\n try {\n xml = await fetch(`/i18n/${ fallback }.xlf`).then((r) => r.text());\n currentLocale = locale;\n if (xml && !isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for fallback locale ${ fallback }`);\n }\n } catch (e: any) {\n console.warn(`Could not download XLIFF file for fallback locale ${ fallback }: ${ e.message }`);\n }\n }\n\n if (!xml) {\n console.error(`Could not download XLIFF file for locale ${ locale } or preferred ${preferredLanguages.join(', ')} or fallback ${ fallback }`);\n return null;\n }\n\n if (!isTranslationXml(xml)) {\n console.error(`Invalid XLIFF file for fallback locale ${ currentLocale }`);\n }\n\n let json: any;\n try {\n json = await xliffToJson(xml);\n } catch (e: any) {\n console.error(`Could not parse XLIFF file for locale ${ locale }: ${ e.message }`);\n return null;\n }\n\n return { json, locale: currentLocale ?? locale };\n\n}\n\n/**\n * Loads the locale data module for the specified locale and registers it.\n *\n * @param {string} locale - The locale identifier for which the module needs to be loaded.\n * @return {Promise<void>} A promise that resolves when the module is successfully loaded and registered, or logs an error if loading fails.\n */\nasync function defaultLoadModule(locale: string) {\n\n try {\n // Load required locale module (needs to be adjusted for different locales)\n let module: { default: any } | null = null;\n switch (locale) {\n\n case 'en':\n module = await import('@angular/common/locales/en');\n break;\n\n case 'de':\n module = await import('@angular/common/locales/de');\n break;\n\n }\n if (module) {\n registerLocaleData(module.default);\n }\n } catch (e: any) {\n console.error(`Could not load locale module for locale ${ locale }: ${ e.message }`);\n }\n\n}\n\n/**\n * Loads language translations and sets the locale for the application.\n * This function fetches the translations based on the specified locale, preferred languages,\n * and a fallback, then initializes the translations and optionally loads additional modules.\n *\n * @param {function} loadModule - A function to load additional modules for the specified locale. Defaults to `defaultLoadModule`.\n * @param {string} [locale] - The primary locale to be used. Defaults to the stored locale, browser language, or 'en'.\n * @param {string[]} [preferredLanguages] - A list of preferred languages to use, derived from the browser or input. Defaults to the browser's preferred languages.\n * @param {string} [fallback] - The fallback key for translation files. Defaults to 'messages'.\n * @return {Promise<string>} The resolved locale, as a string.\n */\nexport async function loadLanguages(\n loadModule: (locale: string) => Promise<void> = defaultLoadModule,\n locale: string = localStorage.getItem(\"locale\") || navigator.language.split('-')[0] || 'en',\n preferredLanguages = navigator.languages?.map((l) => l.split('-')[0]) ?? [],\n fallback = 'messages'\n) {\n // Fetch XLIFF translation file and transform to JSON format (JSON translations can be used directly)\n const response = await fetchTranslations(locale, preferredLanguages, fallback);\n\n if (response) {\n // Initialize translation\n loadTranslations(response.json);\n locale = response.locale;\n $localize.locale = locale;\n localStorage.setItem(\"locale\", locale);\n await loadModule(locale);\n }\n\n return locale;\n}\n","import {\n ApplicationConfig,\n LOCALE_ID,\n} from '@angular/core';\nimport { loadLanguages } from './load-languages';\n\n/**\n * Loads internationalization (i18n) bootstrap settings for the application.\n *\n * @param {Partial<ApplicationConfig>} options - The application configuration options.\n * @return {Promise<void>} A promise that resolves when the i18n bootstrap process completes.\n */\nexport async function loadI18nBootstrapHook(options: Partial<ApplicationConfig>): Promise<void> {\n\n try {\n const locale = await loadLanguages();\n console.debug('locale', locale);\n options.providers ??= [];\n options.providers.push({\n provide: LOCALE_ID,\n useValue: locale\n });\n } catch (e: any) {\n console.error(`Failed to load language translations: ${e.message}`);\n }\n\n}\n","// region \nexport * from './lib/i18n.service';\nexport * from './lib/language-interceptor';\nexport * from './lib/language-selector.service';\nexport * from './lib/load-i18n-bootstrap-hook';\nexport * from './lib/load-languages';\nexport * from './lib/xliff-to-json';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAUA;;AAEG;MAEU,WAAW,CAAA;AADxB,IAAA,WAAA,GAAA;AAGmB,QAAA,IAAA,CAAA,OAAO,GAAW,MAAM,CAAC,SAAS,CAAC;AACnC,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElE,QAAA,IAAA,CAAA,eAAe,GAAmB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAyB/F;IAvBQ,MAAM,WAAW,CAAC,QAAgB,EA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.
|
|
2
|
+
"version": "19.1.0-dev.8",
|
|
3
3
|
"name": "@rxap/ngx-localize",
|
|
4
4
|
"description": "This package provides internationalization (i18n) support for Angular applications, including services for language management, an HTTP interceptor for setting the `Accept-Language` header, and a language selector component. It allows you to set and manage the current language of your application, redirect users based on their language preference, and configure available languages. The package also includes an init generator to handle peer dependencies.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
},
|
|
129
129
|
"schematics": "./generators.json",
|
|
130
130
|
"sideEffects": false,
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "8c64f6f26a2c8d3b4b24af1e31b0f4274abc83fb",
|
|
132
132
|
"module": "fesm2022/rxap-ngx-localize.mjs",
|
|
133
133
|
"typings": "index.d.ts",
|
|
134
134
|
"exports": {
|