When using an angular translator to localize my Angular application, the backup language does not try if the preferred language (via the static file loader) does not load or does not exist for any reason.
$translateProvider.useStaticFilesLoader({ prefix: 'locale-', suffix: '.json' }); $translateProvider .preferredLanguage('ja') .fallbackLanguage('en');
Available plnkr: http://plnkr.co/edit/tHrBeY0Ur0rhp0xNuWpA?p=preview
If there is an empty locale-ja.json file, then the backup is loading correctly. This, as indicated, may be a library error. Has anyone found a workaround?
FallbackLanguge - , . , registerAvailableLanguageKeys:
.registerAvailableLanguageKeys(['en, da'], { 'en_US': 'en', 'en_UK': 'en', 'da_DK': 'da', '*': 'en' })
"en" . , .
, - $translateProvider.use(). :
$translateProvider.use()
$translateProvider .preferredLanguage('ja') .use('ja') .fallbackLanguage('en');
Source: https://habr.com/ru/post/1535158/More articles:Chrome DevTools: SASS source file not saved to disk - cssError flake8 E901 - pythonAngular js - get url request parameters when url has # hash - javascriptHow can I return a zip file from my Java back end using JAX-RS? - javaIs the new feature specific to each socket in Socket.IO? - javascriptiOS - Преобразование UIImage в память vImage - iosThe Gcc link is Undefined, but the library contains the corresponding symbol - c ++Why is my Ajax not working? - javascriptLaravel: method BadMethodCallException [find] does not exist - phpStandalone and online map with open street map. - androidAll Articles