From 5fa3b66a439d857d5caf9dbd63f8cd313eb1a448 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 2 Dec 2023 17:18:50 +0100 Subject: [PATCH] translate site sections --- static/js/mainMenu.js | 4 ++-- static/js/sectionButtons.js | 5 ++++- static/js/sectionSelect.js | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 98e8f143c..2efc217f4 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -1830,8 +1830,8 @@ pandora.ui.mainMenu = function() { function getViewMenu() { return { id: 'viewMenu', title: Ox._('View'), items: [ { id: 'section', title: Ox._('Section'), items: [ - { group: 'viewsection', min: 1, max: 1, items: pandora.site.sections.map(function(section) { - section = Ox.extend({}, section) + { group: 'viewsection', min: 1, max: 1, items: Ox.clone(pandora.site.sections, true).map(function(section) { + section.title = Ox._(section.title); section.checked = section.id == ui.section; return section; }) } diff --git a/static/js/sectionButtons.js b/static/js/sectionButtons.js index 79d1a1fa9..55d2cf6d5 100644 --- a/static/js/sectionButtons.js +++ b/static/js/sectionButtons.js @@ -2,7 +2,10 @@ pandora.ui.sectionButtons = function(section) { var that = Ox.ButtonGroup({ - buttons: pandora.site.sections, + buttons: Ox.clone(pandora.site.sections, true).map(function(section) { + section.title = Ox._(section.title); + return section; + }), id: 'sectionButtons', selectable: true, value: section || pandora.user.ui.section diff --git a/static/js/sectionSelect.js b/static/js/sectionSelect.js index 1abdf8256..9becbd651 100644 --- a/static/js/sectionSelect.js +++ b/static/js/sectionSelect.js @@ -4,7 +4,10 @@ pandora.ui.sectionSelect = function(section) { // fixme: duplicated var that = Ox.Select({ id: 'sectionSelect', - items: pandora.site.sections, + items: Ox.clone(pandora.site.sections, true).map(function(section) { + section.title = Ox._(section.title); + return section; + }), value: section || pandora.user.ui.section }).css({ float: 'left',