Internationalization loader and helpers for the for-angular package.
Classes
- I18nLoader
Fetches and merges translation resources, supporting versioned suffixes and recursive merging.
- I18nParser
Extends TranslateParser to support string formatting with parameters.
Methods
# static I18nLoaderFactory(http) → {TranslateLoader}
Configures and returns an I18nLoader instance with the specified HTTP client and translation resources.
Factory function for creating an instance of I18nLoader.
Parameters:
| Name | Type | Description |
|---|---|---|
http |
HttpClient
|
The HTTP client used to fetch translation resources. |
- An instance of I18nLoader configured with the provided HTTP client and resources.
TranslateLoader
# static getLocaleContext(clazz, suffixopt) → {string}
Resolves the locale context by extracting the class name or using the provided suffix.
Retrieves the locale context for a given class, object, or string.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
clazz |
FunctionLike
|
object
|
string
|
The class, object, or string to derive the locale context from. |
|
suffix |
string
|
<optional> |
An optional suffix to append to the locale context. |
- The resolved locale context string.
string
# static provideI18n(configopt, resourcesopt, versionedSuffixopt) → {Array}
Configures the translation service with a fallback language, default language, custom parser, and loader.
Provides the internationalization (i18n) configuration for the application.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
config |
RootTranslateServiceConfig
|
<optional> |
{fallbackLang: 'en', lang: 'en'} | The configuration for the translation service, including fallback and default languages. |
resources |
I18nResourceConfigType
|
<optional> |
[] | The translation resources to be used by the loader. |
versionedSuffix |
boolean
|
<optional> |
false | Whether to append a versioned suffix to resource URLs. |
- An array of providers for the translation service and loader.
Array
# static provideI18nLoader(resourcesopt, versionedSuffixopt) → {object}
Configures the translation resources and versioned suffix for the I18nLoader.
Provides the I18nLoader configuration.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
resources |
I18nResourceConfigType
|
<optional> |
[] | The translation resources to be used by the loader. |
versionedSuffix |
boolean
|
<optional> |
false | Whether to append a versioned suffix to resource URLs. |
- The configuration object for the I18nLoader.
object