Translation
Default Translation Files
Importing and Injecting AXTranslationService
product-details.component.ts
Using translate
pipe
product-details.page.html
Setting the Active Language
setActiveLang
to change the active language:product-details.component.ts
Getting the Active and Default Languages
getActiveLang()
: Returns the currently active language (e.g., "fa", "en").getDefaultLang()
: Returns the default language configured for the application.product-details.component.ts
Observing Language Changes
langChanges$
observable to be notified of language changes:product-details.component.ts
Customizing and Extending Translations (with Scopes)
src/assets/i18n/ └── ${lang}/ └── ${scope}.json
product.json
files demonstrating interpolation:src/assets/i18n/en/product.json
src/assets/i18n/fa/product.json
${lang}
(e.g., en
, fa
) for the language code and ${scope}
(e.g., common
, products
). product-details.page.html
Translating in Component Code
product-details.component.ts