Skip to content

Commit

Permalink
Fix locale switching.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Oct 6, 2023
1 parent 14b7ed5 commit 783c124
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import JgwcPlugin, { JGWC }
from "../../page-resource/jgwc-vue-components/jgwc-components.js";
import { provideApi, getApi }
from "../../page-resource/aash-vue-components/lib/aash-vue-components.js";
import l10nBundles from "./LogViewer-l10nBundles.ftl.js";

window.orgJGrapesOsgiConletLogViewer = {};

Expand All @@ -39,13 +40,15 @@ window.orgJGrapesOsgiConletLogViewer.initView = function(content) {
setup() {
const conletId = content.closest("[data-conlet-id]")
.dataset["conletId"];
const ctrlL18n = (key) =>
JGConsole.localize(l10nBundles, JGWC.lang(), key);
const controller = reactive(new JGConsole.TableController([
["time", '${_("timestamp")}'],
["logLevel", '${_("level")}'],
["message", '${_("message")}'],
["bundle", '${_("bundle")}'],
["service", '${_("service")}'],
["exception", '${_("exception")}'],
["time", ctrlL18n],
["logLevel", ctrlL18n],
["message", ctrlL18n],
["bundle", ctrlL18n],
["service", ctrlL18n],
["exception", ctrlL18n],
], {
sortKey: "sequence",
sortOrder: "down"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Ad Hoc Polling Application
* Copyright (C) 2018 Michael N. Lipp
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/

'use strict';

const l10nBundles = new Map();
let entries = null;
// <#list supportedLanguages() as l>
entries = new Map();
l10nBundles.set('${l.locale.toLanguageTag()}', entries);
// <#list l.l10nBundle.keys as key>
entries.set('${key}', '${l.l10nBundle.getString(key)}')
// </#list>
// </#list>

export default l10nBundles;
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

conletName = Log

timestamp = Timestamp
level = Level
time = Timestamp
logLevel = Level
message = Message
service = Service
bundle = Bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ conletName = Meldungsprotokoll
auto = automatisch
bundle = Paket
exception = Ausnahme
level = Stufe
logLevel = Stufe
message = Meldung
timestamp = Zeitstempel
time = Zeitstempel
service = Dienst
severityAtLeast = Mindeststufe
Update = Aktualisierung

0 comments on commit 783c124

Please sign in to comment.