From 570f455eb3737313791520cefcfc887a03c09ff0 Mon Sep 17 00:00:00 2001 From: Arnaud Wach Date: Wed, 21 Jun 2023 11:07:49 +0200 Subject: [PATCH] #4068 - Ability to change interface language (i18n) - Telemetry HTML pages translation with properties files --- .../webanno/telemetry/TelemetryIntro.java | 51 +++++++++++++ .../telemetry/ui/TelemetryDetailsPanel.html | 30 +++++--- .../ui/TelemetryDetailsPanel_fr.html | 43 ----------- .../telemetry/ui/TelemetryFooterPanel_fr.html | 27 ------- .../telemetry/ui/TelemetrySettingsPage.html | 21 ++---- .../telemetry/ui/TelemetrySettingsPage.java | 8 +++ .../ui/TelemetrySettingsPage_fr.html | 71 ------------------- .../telemetry/wicket-package.properties | 28 ++++++++ .../telemetry/wicket-package_fr.properties | 29 ++++++++ 9 files changed, 141 insertions(+), 167 deletions(-) create mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryIntro.java delete mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel_fr.html delete mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryFooterPanel_fr.html delete mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage_fr.html create mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package.properties create mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package_fr.properties diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryIntro.java b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryIntro.java new file mode 100644 index 00000000000..a37ca8e552b --- /dev/null +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryIntro.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Technische Universität Darmstadt under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The Technische Universität Darmstadt + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.tudarmstadt.ukp.clarin.webanno.telemetry; + +import java.io.Serializable; + +import de.tudarmstadt.ukp.clarin.webanno.support.wicket.resource.Strings; + +public class TelemetryIntro + implements Serializable +{ + private final String productName; + private final String save; + + public TelemetryIntro() + { + this(Strings.getString("product.name"), Strings.getString("save")); + } + + public TelemetryIntro(String aProductName, String aSave) + { + super(); + productName = aProductName; + save = aSave; + } + + public String getProductName() + { + return productName; + } + + public String getSave() + { + return save; + } +} diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel.html b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel.html index 04ec5ba70ef..78e04411527 100644 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel.html +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel.html @@ -21,20 +21,28 @@
- + - - - - - + + + + + - - - - - + + + + +
Details + +
KeyValueDescription
+ + + + + +
diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel_fr.html b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel_fr.html deleted file mode 100644 index 6bbee353766..00000000000 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryDetailsPanel_fr.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - -
Détails
CléValeurDescription
-
-
- - diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryFooterPanel_fr.html b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryFooterPanel_fr.html deleted file mode 100644 index ec7b5c5702d..00000000000 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetryFooterPanel_fr.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.html b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.html index 6592cce5ef5..d328d2bf1e3 100644 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.html +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.html @@ -24,15 +24,7 @@
-

- In order to support the development of , it would - like to collect some data and send it home. Please review the settings below and - opt in or out of the respective data collections. Once you are done, use the - button on the right side to save your choices. If - there were any changes to the data collection process, this page will appear again - when an administrator logs in. You can always revise your choices by accessing this - page via the icon in the page footer. -

+

+
- The behavior of this data collector has changed. Please review the description - and settings. +
@@ -64,4 +55,4 @@
- + \ No newline at end of file diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.java b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.java index a6d834f0f13..4dd9025aca1 100644 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.java +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage.java @@ -30,6 +30,8 @@ import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.StringResourceModel; import org.apache.wicket.model.util.ListModel; import org.apache.wicket.spring.injection.annot.SpringBean; import org.wicketstuff.annotation.mount.MountPath; @@ -37,6 +39,7 @@ import de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxButton; import de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryDetail; +import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryIntro; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryService; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetrySupport; import de.tudarmstadt.ukp.clarin.webanno.telemetry.model.TelemetrySettings; @@ -97,6 +100,11 @@ protected void populateItem(ListItem aItem) form.add(new LambdaAjaxButton("save", this::actionSave).triggerAfterSubmit()); + Label intro = new Label("intro", + new StringResourceModel("introText", Model.of(new TelemetryIntro()))); + intro.setEscapeModelStrings(false); + form.add(intro); + add(form); } diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage_fr.html b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage_fr.html deleted file mode 100644 index b3ab82579b0..00000000000 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/ui/TelemetrySettingsPage_fr.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - -
-
- -
-
-

- Afin de soutenir le développement de - - , nous souhaiterions collecter quelques données et les envoyer chez nous. Veuillez consulter - les paramètres ci-dessous et accepter ou refuser les collectes de données correspondantes. - Une fois que vous aurez - terminé, cliquez sur le bouton - - sur le côté droit pour enregistrer vos choix. Si des modifications ont été apportées au - processus de collecte des données, cette page apparaîtra à nouveau lorsqu'un administrateur - se connectera. Vous pouvez toujours revoir vos choix en accédant à cette page par le biais - de l'icone dans le pied de page. -

-
-
- -
-
-
-
- -
- -
-
-
-
- Le comportement de ce collecteur de données a changé. Veuillez revoir la description - et les paramètres. -
-
-
-
-
- -
-
- - - diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package.properties b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package.properties new file mode 100644 index 00000000000..b547a84921b --- /dev/null +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package.properties @@ -0,0 +1,28 @@ +# Licensed to the Technische Universität Darmstadt under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The Technische Universität Darmstadt +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +details=Details +keyTitle=Key +valueTitle=Value +descriptionTitle=Description +introText=In order to support the development of ${productName}, it would \ + like to collect some data and send it home. Please review the settings below and \ + opt in or out of the respective data collections. Once you are done, use the \ + ${save} button on the right side to save your choices. If \ + there were any changes to the data collection process, this page will appear again \ + when an administrator logs in. You can always revise your choices by accessing this \ + page via the icon in the page footer. +toggleDetails=Toggle details... +changeAlert=The behavior of this data collector has changed. Please review the description and settings. \ No newline at end of file diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package_fr.properties b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package_fr.properties new file mode 100644 index 00000000000..bac150d075a --- /dev/null +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/wicket-package_fr.properties @@ -0,0 +1,29 @@ +# Licensed to the Technische Universität Darmstadt under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The Technische Universität Darmstadt +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +details=Détails +keyTitle=Clé +valueTitle=Valeur +descriptionTitle=Description +introText=Afin de soutenir le développement de ${productName}\ + , nous souhaiterions collecter quelques données et les envoyer chez nous. Veuillez consulter \ + les paramètres ci-dessous et accepter ou refuser les collectes de données correspondantes. \ + Une fois que vous aurez terminé, cliquez sur le bouton ${save} \ + sur le côté droit pour enregistrer vos choix. Si des modifications ont été apportées au \ + processus de collecte des données, cette page apparaîtra à nouveau lorsqu'un administrateur \ + se connectera. Vous pouvez toujours revoir vos choix en accédant à cette page par le biais \ + de l'icone dans le pied de page. +toggleDetails=Basculer vers les détails... +changeAlert=Le comportement de ce collecteur de données a changé. Veuillez revoir la description et les paramètres. \ No newline at end of file