From e45b9afde1835ef6acc8ce6e8216541b3572bbf2 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Sun, 25 Jun 2023 16:52:00 +0200 Subject: [PATCH] #4068 - Ability to change interface language - Remove TelemetryStrings class again - Use proper nested properties syntax --- .../webanno/telemetry/TelemetryStrings.java | 51 ------------------- .../matomo/MatomoTelemetryTraitsEditor.java | 8 ++- .../telemetry/ui/TelemetrySettingsPage.java | 7 +-- .../telemetry/wicket-package.properties | 10 ++-- .../telemetry/wicket-package_fr.properties | 10 ++-- 5 files changed, 15 insertions(+), 71 deletions(-) delete mode 100644 inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryStrings.java diff --git a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryStrings.java b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryStrings.java deleted file mode 100644 index 1df95e0b667..00000000000 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/TelemetryStrings.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 TelemetryStrings - implements Serializable -{ - private final String productName; - private final String save; - - public TelemetryStrings() - { - this(Strings.getString("product.name"), Strings.getString("save")); - } - - public TelemetryStrings(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/matomo/MatomoTelemetryTraitsEditor.java b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/matomo/MatomoTelemetryTraitsEditor.java index 2840ab3c493..f6e4951e8b8 100644 --- a/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/matomo/MatomoTelemetryTraitsEditor.java +++ b/inception/inception-telemetry/src/main/java/de/tudarmstadt/ukp/clarin/webanno/telemetry/matomo/MatomoTelemetryTraitsEditor.java @@ -25,11 +25,10 @@ import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.model.ResourceModel; import org.apache.wicket.spring.injection.annot.SpringBean; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryService; -import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryStrings; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetrySupport; import de.tudarmstadt.ukp.clarin.webanno.telemetry.model.TelemetrySettings; @@ -72,14 +71,13 @@ protected void onSubmit() form.add(new ToggleBox("enabled")); - TelemetryStrings telemetryStrings = new TelemetryStrings(); Label firstParagraph = new Label("firstParagraph", - new StringResourceModel("traitsEditorFirstParagraph", Model.of(telemetryStrings))); + new ResourceModel("traitsEditorFirstParagraph")); firstParagraph.setEscapeModelStrings(false); form.add(firstParagraph); Label thirdParagraph = new Label("thirdParagraph", - new StringResourceModel("traitsEditorThirdParagraph", Model.of(telemetryStrings))); + new ResourceModel("traitsEditorThirdParagraph")); thirdParagraph.setEscapeModelStrings(false); form.add(thirdParagraph); 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 f86f769f808..0c5b4b3018e 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,8 +30,7 @@ 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.ResourceModel; import org.apache.wicket.model.util.ListModel; import org.apache.wicket.spring.injection.annot.SpringBean; import org.wicketstuff.annotation.mount.MountPath; @@ -40,7 +39,6 @@ import de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryDetail; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryService; -import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetryStrings; import de.tudarmstadt.ukp.clarin.webanno.telemetry.TelemetrySupport; import de.tudarmstadt.ukp.clarin.webanno.telemetry.model.TelemetrySettings; import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ApplicationPageBase; @@ -100,8 +98,7 @@ protected void populateItem(ListItem aItem) form.add(new LambdaAjaxButton("save", this::actionSave).triggerAfterSubmit()); - Label introText = new Label("intro", - new StringResourceModel("settingsIntro", Model.of(new TelemetryStrings()))); + Label introText = new Label("intro", new ResourceModel("settingsIntro")); introText.setEscapeModelStrings(false); form.add(introText); 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 index 36a356e8f37..17519c0cdab 100644 --- 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 @@ -17,18 +17,18 @@ details=Details keyTitle=Key valueTitle=Value descriptionTitle=Description -settingsIntro=In order to support the development of ${productName}, it would like to collect some \ +settingsIntro=In order to support the development of #(product.name), 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 \ + 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. -traitsEditorFirstParagraph=This usage data collector helps the developer team of ${productName} \ +traitsEditorFirstParagraph=This usage data collector helps the developer team of #(product.name) \ discover the number of installations and the size of the user base. These are important \ indicators for the success of the product and are e.g. included in reports to funders. Please \ - support the future development of ${productName} by submitting these anonymous usage \ + support the future development of #(product.name) by submitting these anonymous usage \ statistics to the developers at UKP Lab, Technische Universität Darmstadt, Germany. traitsEditorSecondParagraph=When enabled, the anonymous usage statistics are sent to our server \ every time the application is started and immediately when turning the collection on here. Also, \ @@ -36,6 +36,6 @@ traitsEditorSecondParagraph=When enabled, the anonymous usage statistics are sen traitsEditorThirdParagraph=NOTE: This collector does not collect any data from users \ (e.g. annotators) logging into the system. It does, however, collect the number of enabled \ user accounts in the server since that is important for assessing the size of the user base for \ - a multi-user capable system such as ${productName} + a multi-user capable system such as #(product.name). traitsEditorFourthParagraph=Use the Toggle details... button above to see in full detail \ which data we collect and why. \ 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 index d37050cf6d8..c40fcc117c2 100644 --- 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 @@ -17,10 +17,10 @@ details=D keyTitle=Clé valueTitle=Valeur descriptionTitle=Description -settingsIntro=Afin de soutenir le développement de ${productName}\ +settingsIntro=Afin de soutenir le développement de #(product.name)\ , 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} \ + 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 \ @@ -28,9 +28,9 @@ settingsIntro=Afin de soutenir le d 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. traitsEditorFirstParagraph=Ce collecteur de données d'utilisation aide l'équipe de développeurs de \ - ${productName} à découvrir le nombre d'installations et la taille de la base d'utilisateurs. Il \ + #(product.name) à découvrir le nombre d'installations et la taille de la base d'utilisateurs. Il \ s'agit d'indicateurs importants pour le succès du produit, qui sont par exemple inclus dans les \ - rapports destinés aux financeurs. Soutenez le développement futur de ${productName} \ + rapports destinés aux financeurs. Soutenez le développement futur de #(product.name) \ en soumettant ces statistiques d'utilisation anonymes aux développeurs à l'adresse \ suivante: Laboratoire UKP, Université Technique de Darmstadt, Allemagne. traitsEditorSecondParagraph=Lorsqu'elles sont activées, les statistiques d'utilisation anonymes \ @@ -40,6 +40,6 @@ traitsEditorSecondParagraph=Lorsqu'elles sont activ traitsEditorThirdParagraph=REMARQUE: Ce collecteur ne recueille pas de données sur \ les utilisateurs (par exemple, les annotateurs) qui se connectent au système. Il collecte \ cependant le nombre de comptes d'utilisateurs activés dans le serveur, car cela est important \ - pour évaluer la taille de la base d'utilisateurs pour un système multi-utilisateurs tel que ${productName}. + pour évaluer la taille de la base d'utilisateurs pour un système multi-utilisateurs tel que #(product.name). traitsEditorFourthParagraph=Utilisez le bouton Basculer les détails... ci-dessus pour voir \ en détail quelles données nous collectons et pourquoi. \ No newline at end of file