diff --git a/Gruntfile.js b/Gruntfile.js index c08c6ba..d3935ec 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -62,8 +62,9 @@ module.exports = function(grunt) { 'app/controllers/controller.js', 'app/controllers/config.controller.js', 'app/directives/archetypeproperty.js', - 'app/resources/propertyeditor.js', - 'app/filters/locale.js' + 'app/directives/localize.js', + 'app/services/localization.js', + 'app/resources/propertyeditor.js' ], dest: '<%= dest %>/js/archetype.js' } @@ -107,9 +108,7 @@ module.exports = function(grunt) { {expand: true, cwd: 'app/', src: ['package.manifest'], dest: '<%= dest %>', flatten: true}, {expand: true, cwd: 'app/views/', src: ['archetype.html', 'archetype.config.html'], dest: '<%= dest %>/views', flatten: true}, {expand: true, cwd: 'app/config/', src: ['propertyEditors.views.js'], dest: '<%= dest %>/js', flatten: true}, - {expand: true, cwd: 'app/config/', src: ['en-gb.js'], dest: '<%= dest %>/js', flatten: true}, - {expand: true, cwd: 'app/config/', src: ['en-us.js'], dest: '<%= dest %>/js', flatten: true}, - {expand: true, cwd: 'app/config/', src: ['fr-fr.js'], dest: '<%= dest %>/js', flatten: true}, + {expand: true, cwd: 'app/langs/', src: ['**'], dest: '<%= dest %>/langs', flatten: true}, {expand: true, cwd: 'app/Umbraco/Umbraco.Archetype/bin/Debug/', src: ['Archetype.dll'], dest: '<%= dest %>/bin', flatten: true} ] }, diff --git a/app/config/fr-fr.js b/app/config/fr-fr.js deleted file mode 100644 index d0d563c..0000000 --- a/app/config/fr-fr.js +++ /dev/null @@ -1,34 +0,0 @@ -{ - "label": "fr Label", - "alias": "fr Alias", - "hideFieldsetControls": "fr Hide Fieldset Controls?", - "hideFieldsetControlsDescription": "fr Hides the fieldset add/remove/sort controls.", - "toggleAdvanced": "fr Toggle Advanced Options", - "toggleAdvancedDescription": "fr Show advanced options.", - "hidePropertyLabels": "fr Hide Property Labels?", - "hidePropertyLabelsDescription": "fr Hides the property labels.", - "maxFieldsets": "fr Max Fieldsets", - "maxFieldsetsDescription": "fr How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", - "enableMultipleFieldsets": "fr Enable Multiple Fieldsets?", - "enableMultipleFieldsetsDescription": "fr Allows multiple types of fieldsets within this archetype.", - "hideFieldsetToolbar": "fr Hide Fieldset Toolbar?", - "hideFieldsetToolbarDescription": "fr Hides the fieldset toolbar that appears when more than one fieldset model appears.", - "customWrapperClass": "fr Custom Wrapper Class", - "customWrapperClassDescription": "fr (Optional) Enter a custom CSS class that will be applied to the wrapper div.", - "cssFile": "fr CSS File", - "cssFileDescription": "fr Optional) Enter a path for a custom CSS file to be included on the page.", - "jsFile": "fr JS File", - "jsFileDescription": "fr (Optional) Enter a path for a custom JS file to be included on the page.", - "toggleDeveloperMode": "fr Toggle Developer Mode", - "toggleDeveloperModeDescription": "fr Turn on for developer options.", - "configModel": "fr Config Model", - "configModelDescription": "fr Be careful editing the text below, it controls the schema for this archetype.", - "helpText": "fr Help Text", - "defaultValue": "fr Default Value", - "dataType": "fr DataType", - "required": "fr Required", - "properties": "fr Properties", - "labelTemplate": "fr Label Template", - "select": "fr Select", - "icon": "fr Icon" -} diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 26c760b..9ad4d38 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -1,4 +1,4 @@ -angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService, dialogService, archetypePropertyEditorResource, userService) { +angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService, dialogService, archetypePropertyEditorResource) { //$scope.model.value = ""; //console.log($scope.model.value); @@ -10,7 +10,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio //ini the model $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; - $scope.locales = {} //ini the render model initConfigRenderModel(); @@ -20,32 +19,6 @@ 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) { - return user.locale; - }) - .then(function(langIso){ - archetypePropertyEditorResource.getLocale(langIso) - .then(function(locale){ - $scope.locales.locale = locale; - }); - }); - - $scope.getLocales = function(){ - if($scope.locales){ - - if(!$scope.locales.locale) - $scope.locales.locale = $scope.locales.defaultLocale; - - return $scope.locales; - } - } - //iconPicker $scope.selectIcon = function(fieldset){ var dialog = dialogService.iconPicker({ @@ -53,7 +26,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio fieldset.icon = data; } }); - } //config for the sorting diff --git a/app/directives/archetypeproperty.js b/app/directives/archetypeproperty.js index 60c21b9..8355696 100644 --- a/app/directives/archetypeproperty.js +++ b/app/directives/archetypeproperty.js @@ -1,4 +1,4 @@ -angular.module("umbraco").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper) { +angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper) { function getFieldsetByAlias(fieldsets, alias) { diff --git a/app/directives/localize.js b/app/directives/localize.js new file mode 100644 index 0000000..9eae6b6 --- /dev/null +++ b/app/directives/localize.js @@ -0,0 +1,21 @@ +angular.module("umbraco.directives").directive('archetypeLocalize', function (archetypeLocalizationService) { + var linker = function (scope, element, attrs){ + + var key = scope.key; + + archetypeLocalizationService.localize(key).then(function(value){ + if(value){ + element.html(value); + } + }); + } + + return { + restrict: "E", + rep1ace: true, + link: linker, + scope: { + key: '@' + } + } +}); \ No newline at end of file diff --git a/app/config/en-us.js b/app/langs/da-dk.js similarity index 100% rename from app/config/en-us.js rename to app/langs/da-dk.js diff --git a/app/langs/de-de.js b/app/langs/de-de.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/de-de.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/config/en-GB.js b/app/langs/en-gb.js similarity index 100% rename from app/config/en-GB.js rename to app/langs/en-gb.js diff --git a/app/langs/en-us.js b/app/langs/en-us.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/en-us.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/es-es.js b/app/langs/es-es.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/es-es.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/fr-fr.js b/app/langs/fr-fr.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/fr-fr.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/he-il.js b/app/langs/he-il.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/he-il.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/it-it.js b/app/langs/it-it.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/it-it.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/ja-jp.js b/app/langs/ja-jp.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/ja-jp.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/ko-kr.js b/app/langs/ko-kr.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/ko-kr.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/nb-no.js b/app/langs/nb-no.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/nb-no.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/nl-nl.js b/app/langs/nl-nl.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/nl-nl.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/pl-pl.js b/app/langs/pl-pl.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/pl-pl.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/pt-br.js b/app/langs/pt-br.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/pt-br.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/ru-ru.js b/app/langs/ru-ru.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/ru-ru.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/sv-se.js b/app/langs/sv-se.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/sv-se.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/langs/zh-cn.js b/app/langs/zh-cn.js new file mode 100644 index 0000000..7446d25 --- /dev/null +++ b/app/langs/zh-cn.js @@ -0,0 +1,34 @@ +{ + "label": "Label", + "alias": "Alias", + "hideFieldsetControls": "Hide Fieldset Controls?", + "hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.", + "toggleAdvanced": "Toggle Advanced Options", + "toggleAdvancedDescription": "Show advanced options.", + "hidePropertyLabels": "Hide Property Labels?", + "hidePropertyLabelsDescription": "Hides the property labels.", + "maxFieldsets": "Max Fieldsets", + "maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.", + "enableMultipleFieldsets": "Enable Multiple Fieldsets?", + "enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.", + "hideFieldsetToolbar": "Hide Fieldset Toolbar?", + "hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.", + "customWrapperClass": "Custom Wrapper Class", + "customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.", + "cssFile": "CSS File", + "cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.", + "jsFile": "JS File", + "jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.", + "toggleDeveloperMode": "Toggle Developer Mode", + "toggleDeveloperModeDescription": "Turn on for developer options.", + "configModel": "Config Model", + "configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.", + "helpText": "Help Text", + "defaultValue": "Default Value", + "dataType": "DataType", + "required": "Required", + "properties": "Properties", + "labelTemplate": "Label Template", + "select": "Select", + "icon": "Icon" +} diff --git a/app/resources/propertyeditor.js b/app/resources/propertyeditor.js index a55d7dc..b26d8bb 100644 --- a/app/resources/propertyeditor.js +++ b/app/resources/propertyeditor.js @@ -7,7 +7,7 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f ).then(function (data) { return data.map(function(d) { return { "id": d.id, "name": d.name } - }); + }); }); }, getDataType: function(id) { @@ -28,16 +28,6 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f return ""; }); - }, - getLocale: function(langIso) { - return umbRequestHelper.resourcePromise( - $http.get("/App_plugins/Archetype/js/" + langIso.toLowerCase() + ".js"), 'Failed to retrieve locale' - ); - }, - getDefaultLocale: function() { - return umbRequestHelper.resourcePromise( - $http.get("/App_plugins/Archetype/js/en-us.js"), 'Failed to retrieve default locale' - ); } - }; -}); + } +}); \ No newline at end of file diff --git a/app/services/localization.js b/app/services/localization.js new file mode 100644 index 0000000..1f4fc51 --- /dev/null +++ b/app/services/localization.js @@ -0,0 +1,42 @@ +angular.module('umbraco.services').factory('archetypeLocalizationService', function($http, $q, userService){ + var service = { + resourceFileLoaded: false, + dictionary: {}, + localize: function(key) { + var deferred = $q.defer(); + + if(service.resourceFileLoaded){ + var value = service._lookup(key); + deferred.resolve(value); + } + else{ + service.initLocalizedResources().then(function(dictionary){ + var value = service._lookup(key); + deferred.resolve(value); + }); + } + + return deferred.promise; + }, + _lookup: function(key){ + return service.dictionary[key]; + }, + initLocalizedResources:function () { + var deferred = $q.defer(); + userService.getCurrentUser().then(function(user){ + $http.get("/App_plugins/Archetype/langs/" + user.locale + ".js") + .then(function(response){ + service.resourceFileLoaded = true; + service.dictionary = response.data; + + return deferred.resolve(service.dictionary); + }, function(err){ + return deferred.reject("Lang file missing"); + }); + }); + return deferred.promise; + } + } + + return service; +}); \ No newline at end of file diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index d2b7bba..b7f3cc5 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -10,23 +10,23 @@
{{fieldset.label}}
- +
- +
- +
- - {{'select' | archetypeLocale:getLocales()}}… + + Select
- +
- +
- +
- +
- +
- +
- +
@@ -75,50 +75,50 @@
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +