diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 16eddac..3c70095 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -10,6 +10,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio //ini the model $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; + $scope.locales = {} //ini the render model initConfigRenderModel(); @@ -19,6 +20,10 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio $scope.availableDataTypes = data; }); + archetypePropertyEditorResource.getDefaultLocale().then(function(defaultLocale){ + $scope.locales.defaultLocale = defaultLocale; + }); + //load the localization info userService.getCurrentUser() .then(function (user) { @@ -30,15 +35,17 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio .then(function(locale){ archetypePropertyEditorResource.getDefaultLocale(locale) .then(function(defaultLocale) { - $scope.locales = {} $scope.locales.locale = locale; - $scope.locales.defaultLocale = defaultLocale; }); }); }); $scope.getLocales = function(){ if($scope.locales){ + + if(!$scope.locales.locale) + $scope.locales.locale = $scope.locales.defaultLocale; + return $scope.locales; } } diff --git a/app/filters/locale.js b/app/filters/locale.js index 7149096..721e839 100644 --- a/app/filters/locale.js +++ b/app/filters/locale.js @@ -4,6 +4,12 @@ angular.module('umbraco.filters').filter("archetypeLocale", function(){ if(!locales) return key; + if(!locales.defaultLocale) + return key; + + if(!locales.locale) + return key; + return locales.locale[key] || locales.defaultLocale[key] || key; } }) \ No newline at end of file