Skip to content

Commit b770396

Browse files
authored
Fix Winter.Translate default locale detection in the menu item editor (#55)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Fixes #56
1 parent b9655e1 commit b770396

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

formwidgets/menuitems/assets/js/menu-items-editor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
$titleField.val(title)
9696

9797
// Support for Winter.Translate
98-
var defaultLocale = $('[data-control="multilingual"]').data('default-locale')
98+
var defaultLocale = $('[data-default-locale]', self.$popupContainer).data('default-locale')
9999
if (defaultLocale) {
100100
$('[name="RLTranslate['+defaultLocale+'][title]"]', self.$popupContainer).val(title)
101101
}
@@ -190,7 +190,7 @@
190190
}
191191
}
192192

193-
var defaultLocale = $('[data-control="multilingual"]').data('default-locale')
193+
var defaultLocale = $('[data-default-locale]', $popupContainer).data('default-locale')
194194
$.each(properties, function(property, val) {
195195
if (property == 'viewBag') {
196196
$.each(val, function(vbProperty, vbVal) {
@@ -258,7 +258,7 @@
258258
var $input = $('[name="'+property+'"]', $popupContainer).not('[type=hidden]')
259259
setPropertyOnElement($input, val)
260260
// If the Winter.Translate default locale data locker fields are available make sure that they are properly populated
261-
var $defaultLocaleField = $('[name="RLTranslate['+defaultLocale+']['+property+']"]', self.$popupContainer)
261+
var $defaultLocaleField = $('[name="RLTranslate['+defaultLocale+']['+property+']"]', $popupContainer)
262262
if ($defaultLocaleField) {
263263
$defaultLocaleField.val($input.val());
264264
}
@@ -416,7 +416,7 @@
416416
$(this).val($localeField.val())
417417
});
418418

419-
var defaultLocale = $('[data-control="multilingual"]').data('default-locale')
419+
var defaultLocale = $('[data-default-locale]', self.$popupContainer).data('default-locale')
420420

421421
$.each(propertyNames, function() {
422422
var propertyName = this,

0 commit comments

Comments
 (0)