Core: Get translation in specific language

Created on 15 Apr 2016  路  6Comments  路  Source: ngx-translate/core

How can i get single value of key in specific language (not in currently selected language) in template?

questiosupport

Most helpful comment

All 6 comments

You can use the service.
Try for example:
translate.getTranslation(lang).subscribe((translationObj) => { console.log(translationObj[key]); });

getTranslation also changes the current language

getTranslation also changes the current language

"use" does but not getTranslation. I faced the same issue and getTranslation did the trick for me

try this: https://www.npmjs.com/package/ngx-translate-in

{{'key' | translateIn: "fr" | async}}

This has the great disadvantage of fetching the entire language file in case case you retrieve languages per GET.

Was this page helpful?
0 / 5 - 0 ratings