translate
are synchronous and will only work if your translation is already loaded.selectTranslateObject
@shaharkazaz Thanks for the reply. I've tried selectTranslateObject as you suggested and I get the same error message. To be clear, the en.json file is in a directory within the feature module:
https://files.gitter.im/5d5555fcd73408ce4fc87fc0/qquh/image.png
and I have a loader function in the feature module:
export const loader = ['en', 'es'].reduce((acc, lang) => {
acc[lang] = () => import(`./_i18n/${lang}.json`);
return acc;
}, {});
The template markup sees the translations but I can't get it to show up in the component logic.
Hello, I'm using the TranslocoService
in a pipe and I would like to access a lazy loaded scope when I do :
this.transloco.translate('key', {}, 'scopeName')
I've got Missing translation for scopeName.key
. I tried to provide the TRANSLOCO_SCOPE in the module in which the pipe is declared, but it didn't help. Anyone has an idea how to fix that ?
translate
) you need to make sure the translations are loaded.take(1)
?
LanguageFallbackStrategy
in my app to try a set of fallback languages, e.g. fr-CA / fr / en. I think it works for a translation file fails to load.hi everyone, i hava. a problem, i can't get the translation in the scope 'countries'
the default language is 'it' so should get countries/it.json right?
i use nx
i tried also with inject theproviders: [
{
provide: TRANSLOCO_SCOPE,
useValue: 'countries',
},
],
inside the component and use the translate method but don't work 😕
getTranslation
uses an http request and not just import the files and return them as :import de from '@assets/i18n/de.json'
import en from '@assets/i18n/en.json'
export class TranslocoHttpLoader implements TranslocoLoader {
constructor() {}
getTranslation(lang: string): Observable<Translation> {
return lang === 'de' ? of(de) : of(en)
}
}
getScopeAndLangFromFullPath.js
filePath: /home/agent/_work/4/s/apps/frontend/src/assets/i18n/ar.json
translationPath: /home/agent/_work/4/s/apps/frontend/src/assets/i18n
Hello. I'm having trouble loading lang files in a nested component hosted in lazy module. For some reason it only loads on the second time the component is initialized. Repo here... https://github.com/vdiaz1130/transloco-nx
Appreciate the help.
if (isLocaleFormat(val)) {
return val;
}