I am trying to add Arabic language. I have configured package correctly but some labels are translated some are not
Yamesh1994 opened this issue · comments
Here is my app initializer and App Factory
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, environment.apiUrl + 'localizations/json/', '.json');
}
export function appInitializerFactory(translate: TranslateService, injector: Injector, http: HttpClient, authService: LmsAuthService) {
return () => new Promise((resolve: any) => {
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
locationInitialized.then(() => {
http.get(environment.apiUrl + 'get-default-lang')
.subscribe(responseData => {
const langToSet = responseData.code;
translate.setDefaultLang('en-US');
if (authService.getToken().length > 10) {
http.get<any>(environment.apiUrl + 'user').subscribe((data: any) => {
translate.use(data.data.language).subscribe(() => {
console.info(`Successfully initializedd '${data.data.language}' language.'`);
localStorage.setItem('language', data.data.language);
})
}, err => {
// console.log(err);
console.error(`Problem with '${langToSet}' language initialization.'`);
}, () => {
resolve(null);
});
}
else {
translate.use(langToSet).subscribe(() => {
console.info(`Successfully initialized '${langToSet}' language.'`);
localStorage.setItem('language', responseData.code);
}, err => {
// console.log(err);
console.error(`Problem with '${langToSet}' language initialization.'`);
}, () => {
resolve(null);
});
}
},
err => {
console.error('API error:', err);
resolve(null);
});
});
});
}
My translation are from Server side
Here is screen shot some label are in Arabic some are in English but translation for all are in both lan are available from server