import * as vendors from 'vendor'; let deps = []; Object.keys(vendors).forEach(vendor => { let name = vendors[vendor].name; if (name) deps.push(name); }); const ngModule = vendors.ng.module('vnCore', deps); export default ngModule; config.$inject = ['$translateProvider', '$translatePartialLoaderProvider']; export function config($translateProvider, $translatePartialLoaderProvider) { $translatePartialLoaderProvider.addPart('core'); let conf = {urlTemplate: '/static/locale/{part}/{lang}.json'}; let fallbackLang = 'es'; let langs = ['en', 'es']; let langAliases = { en_US: 'en', en_UK: 'en', es_ES: 'es', es_AR: 'es' }; $translateProvider .useSanitizeValueStrategy('escape') .useLoader('$translatePartialLoader', conf) .registerAvailableLanguageKeys(langs, langAliases) // FIXME: Circular dependency due to vnInterceptor // .fallbackLanguage(fallbackLang) .determinePreferredLanguage(() => { let locale = $translateProvider.resolveClientLocale(); if (langs.indexOf(locale) !== -1) return locale; if (langAliases[locale]) return langAliases[locale]; return fallbackLang; }); } ngModule.config(config);