Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit e8d128d

Browse files
committed
Fixed bug with the localization
The localized labels are loaded in async, so they may replace the "name" property. We only want to use the localized labels if the initial default value is being used.
1 parent 2bdf2be commit e8d128d

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Js/doctypegrideditor.controllers.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212

1313
function ($scope, $rootScope, $timeout, $routeParams, editorState, assetsService, dtgeResources, umbRequestHelper, localizationService) {
1414

15-
$scope.title = "Click to insert item";
16-
$scope.selectContentTypeLabel = "Choose a content type";
17-
var overlayTitle = "Edit item";
15+
const defaultTitle = "Click to insert item",
16+
defaultSelectContentTypeLabel = "Choose a Content Type",
17+
defaultOverlayTitle = "Edit tem";
18+
19+
$scope.title = defaultTitle;
20+
$scope.selectContentTypeLabel = defaultSelectContentTypeLabel;
21+
22+
var overlayTitle = defaultOverlayTitle;
1823
$scope.icon = "icon-item-arrangement";
1924
$scope.overlay = {};
2025
$scope.overlay.show = false;
@@ -24,9 +29,9 @@
2429

2530
// localize strings
2631
localizationService.localizeMany(["docTypeGridEditor_insertItem", "docTypeGridEditor_editItem", "docTypeGridEditor_selectContentType"]).then(function (data) {
27-
$scope.title = data[0];
28-
overlayTitle = data[1];
29-
$scope.selectContentTypeLabel = data[2];
32+
if ($scope.title === defaultTitle) $scope.title = data[0];
33+
if (overlayTitle === defaultOverlayTitle) overlayTitle = data[1];
34+
if ($scope.selectContentTypeLabel === defaultSelectContentTypeLabel) $scope.selectContentTypeLabel = data[2];
3035
});
3136

3237
$scope.setValue = function (data, callback) {

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Lang/da-DK.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
3-
<language alias="da" intName="Danish" localName="dansk" lcid="6" culture="da-DK">
2+
<language alias="da" intName="Danish" localName="Dansk" lcid="1030" culture="da-DK">
43
<area alias="docTypeGridEditor">
54
<key alias="selectContentType">Vælg en indholdstype</key>
65
<key alias="editItem">Rediger indhold</key>

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Lang/en-GB.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
3-
<language alias="en" intName="English" localName="english" lcid="6" culture="en-GB">
2+
<language alias="en_gb" intName="English (United Kingdom)" localName="English (United Kingdom)" lcid="2057" culture="en-GB">
43
<area alias="docTypeGridEditor">
5-
<key alias="selectContentType">Select a content type</key>
4+
<key alias="selectContentType">Select a Content Type</key>
65
<key alias="editItem">Edit item</key>
76
<key alias="insertItem">Click to insert item</key>
87
</area>

src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Lang/en-US.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
3-
<language alias="en" intName="English" localName="english" lcid="6" culture="en-US">
2+
<language alias="en_us" intName="English (United States)" localName="English (United States)" lcid="1033" culture="en-US">
43
<area alias="docTypeGridEditor">
5-
<key alias="selectContentType">Select a content type</key>
4+
<key alias="selectContentType">Select a Content Type</key>
65
<key alias="editItem">Edit item</key>
76
<key alias="insertItem">Click to insert item</key>
87
</area>

0 commit comments

Comments
 (0)