I am using ngx-translate module to swtich from english to my native language texts in my Angular application, like this
<h4>{{"USER_ROLE_MODAL.USERS.ERROR_1" | translate}}</h4>
where
USER_ROLE_MODAL.USERS.ERROR_1
is the property in json containing the error string.
I was wondering if it's possible to change those texts (maybe by reading from a different json) if a different script is launched or a different property is passed in the startup script.
if you are having trouble reading my question, i am sorry english is not my native language, just ask me i'll do my best to explain myself better
This is a very basic function of
ngx-translate
.When a correct loader (I assume you use JSON http loader based on your question) is configured, you can simply call
TranslateService.use(lang)
. To change the language.Code sample from the docs: