Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
7f08796828
|
@ -5,17 +5,29 @@ export function config($translateProvider, $translatePartialLoaderProvider) {
|
|||
$translatePartialLoaderProvider.addPart('core');
|
||||
|
||||
let conf = {urlTemplate: '/static/locale/{part}/{lang}.json'};
|
||||
|
||||
let fallbackLang = 'es';
|
||||
let langs = ['en', 'es'];
|
||||
let localLangs = {
|
||||
let langAliases = {
|
||||
en_US: 'en',
|
||||
en_UK: 'en',
|
||||
es_ES: 'es',
|
||||
es_AR: 'es'
|
||||
};
|
||||
|
||||
$translateProvider
|
||||
.useSanitizeValueStrategy('escape')
|
||||
.useLoader('$translatePartialLoader', conf)
|
||||
.registerAvailableLanguageKeys(langs, localLangs)
|
||||
.determinePreferredLanguage();
|
||||
.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;
|
||||
});
|
||||
}
|
||||
module.config(config);
|
||||
|
|
|
@ -10,10 +10,15 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t
|
|||
load(moduleName, validations) {
|
||||
let loaded = this._loaded;
|
||||
|
||||
if (loaded[moduleName])
|
||||
if (loaded[moduleName] === true)
|
||||
return Promise.resolve(true);
|
||||
if (loaded[moduleName] instanceof Promise)
|
||||
return loaded[moduleName];
|
||||
if (loaded[moduleName] === false)
|
||||
return Promise.reject(
|
||||
new Error(`Module dependency loop detected: ${moduleName}`));
|
||||
|
||||
loaded[moduleName] = Promise.resolve(true);
|
||||
loaded[moduleName] = false;
|
||||
|
||||
let deps = splitingRegister.getDependencies(moduleName);
|
||||
let depPromises = [];
|
||||
|
@ -29,13 +34,18 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t
|
|||
|
||||
// FIXME: https://github.com/angular-translate/angular-translate/pull/1674
|
||||
$translatePartialLoader.addPart(moduleName);
|
||||
promises.push($translate.refresh());
|
||||
promises.push(new Promise(resolve => {
|
||||
$translate.refresh().then(
|
||||
() => resolve(),
|
||||
() => resolve()
|
||||
);
|
||||
}));
|
||||
|
||||
if (validations)
|
||||
promises.push(new Promise(resolve => {
|
||||
$http.get(`/${moduleName}/validations`).then(
|
||||
json => this.onValidationsReady(json, resolve),
|
||||
json => resolve()
|
||||
() => resolve()
|
||||
);
|
||||
}));
|
||||
|
||||
|
@ -45,7 +55,7 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t
|
|||
|
||||
Promise.all(promises)
|
||||
.then(() => {
|
||||
this._loaded[moduleName] = true;
|
||||
loaded[moduleName] = true;
|
||||
resolve($ocLazyLoad.load({name: moduleName}));
|
||||
})
|
||||
.catch(reject);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
"db": {
|
||||
"name": "db",
|
||||
"connector": "memory"
|
||||
},
|
||||
"vn": {
|
||||
"name": "mysql",
|
||||
"connector": "mysql",
|
||||
"database": "vn",
|
||||
"debug": false,
|
||||
|
@ -16,7 +14,6 @@
|
|||
"acquireTimeout": 20000
|
||||
},
|
||||
"salix": {
|
||||
"name": "mysql",
|
||||
"connector": "mysql",
|
||||
"database": "salix",
|
||||
"debug": false,
|
||||
|
@ -28,7 +25,6 @@
|
|||
"acquireTimeout": 20000
|
||||
},
|
||||
"account": {
|
||||
"name": "mysql",
|
||||
"connector": "mysql",
|
||||
"database": "account",
|
||||
"debug": false,
|
||||
|
|
Loading…
Reference in New Issue