From 13dabe341d7528ed17496a3d51077996d1b1ed61 Mon Sep 17 00:00:00 2001 From: Olivier Maury <Olivier.Maury@inrae.fr> Date: Thu, 4 Jul 2024 17:45:44 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Changer=20le=20r=C3=A9sum=C3=A9=20du=20nomb?= =?UTF-8?q?re=20d'indicateurs.=20fixes=20#99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../www/client/i18n/AppMessages.java | 22 +++++++------------ .../www/client/view/LeftPanelView.java | 8 +++---- .../www/client/i18n/AppMessages_fr.properties | 14 +++++------- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/pom.xml b/pom.xml index db892d6..6df9331 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>fr.agrometinfo</groupId> <artifactId>www</artifactId> - <version>2.0.0-alpha-5</version> + <version>2.0.0-SNAPSHOT</version> <packaging>pom</packaging> <name>AgroMetInfo web app</name> <description>Website for AgroMetInfo in Jakarta EE 10 and GWT.</description> diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppMessages.java b/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppMessages.java index 5a9a2db..6698380 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppMessages.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppMessages.java @@ -69,22 +69,16 @@ public interface AppMessages extends Messages { String failureStatusCode(int statusCode); /** - * @param nb nb + * @param nbOfIndicators nb of indicators + * @param nbOfPeriods nb of periods * @return translation */ - @DefaultMessage("{0} periods.") - @AlternateMessage({"=0", "No period.", // - "=1", "1 period."}) - String nbOfIndicatorPeriods(@PluralCount int nb); - - /** - * @param nb nb - * @return translation - */ - @DefaultMessage("{0} indicators.") - @AlternateMessage({"=0", "No indicator.", // - "=1", "1 indicator."}) - String nbOfIndicators(@PluralCount int nb); + @DefaultMessage("{0} indicators in {1} periods.") + @AlternateMessage({"=0|=0", "No indicator.", // + "=1|=1", "1 indicator in {1} period.", // + "other|=1", "{0} indicators in {1} period.", // + }) + String nbOfIndicatorsAndPeriods(@PluralCount int nbOfIndicators, @PluralCount int nbOfPeriods); /** * @param name diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/view/LeftPanelView.java b/www-client/src/main/java/fr/agrometinfo/www/client/view/LeftPanelView.java index 7918406..0396711 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/view/LeftPanelView.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/view/LeftPanelView.java @@ -7,7 +7,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; -import java.util.StringJoiner; import org.dominokit.domino.ui.forms.Select; import org.dominokit.domino.ui.forms.SwitchButton; @@ -273,10 +272,9 @@ public final class LeftPanelView extends AbstractBaseView<LeftPanelPresenter> im GWT.log("LeftPanelView.setPeriods() : " + list); this.periods = list; // summary - final StringJoiner sj = new StringJoiner(" "); - sj.add(MSGS.nbOfIndicatorPeriods(list.size())); - sj.add(MSGS.nbOfIndicators(list.stream().mapToInt(c -> c.getIndicators().size()).sum())); - summary.textContent(sj.toString()); + final int nbOfPeriods = list.size(); + final int nbOfIndicators = list.stream().mapToInt(c -> c.getIndicators().size()).sum(); + summary.textContent(MSGS.nbOfIndicatorsAndPeriods(nbOfIndicators, nbOfPeriods)); if (this.periods.isEmpty()) { return; diff --git a/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppMessages_fr.properties b/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppMessages_fr.properties index 365a836..832e17e 100644 --- a/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppMessages_fr.properties +++ b/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppMessages_fr.properties @@ -6,14 +6,12 @@ comparedValue = Écart moyen de la valeur de l’indicateur {0} ({1}) en {2} sur computedOn = Calcul du {0,date,long} failureResponse = La communication avec le serveur a échoué\u00A0: {0} failureStatusCode = Code d’état HTTP : {0} -nbOfIndicatorPeriods[\=0] = Aucune période. -nbOfIndicatorPeriods[\=1] = Une période. -nbOfIndicatorPeriods[one] = Une période. -nbOfIndicatorPeriods = {0} périodes. -nbOfIndicators[\=0] = Aucun indicateur. -nbOfIndicators[\=1] = Un indicateur. -nbOfIndicators[one] = Un indicateur. -nbOfIndicators = {0} indicateurs. +nbOfIndicatorsAndPeriods[\=0|\=0] = Aucun indicateur. +nbOfIndicatorsAndPeriods[\=1|\=1] = Un indicateur dans une période. +nbOfIndicatorsAndPeriods[one|one] = Un indicateur dans une période. +nbOfIndicatorsAndPeriods[other|\=1] = {0} indicateurs dans une période. +nbOfIndicatorsAndPeriods[other|one] = {0} indicateurs dans une période. +nbOfIndicatorsAndPeriods = {0} indicateurs dans {1} périodes. pra = Petite région agricole «\u00A0{0}\u00A0» region = Région «\u00A0{0}\u00A0» tooltipLabel = {0}\u00A0: {1}\u00A0{2} -- GitLab From 541d9c3f212b2782328edb7d741bd9a14199703f Mon Sep 17 00:00:00 2001 From: Olivier Maury <Olivier.Maury@inrae.fr> Date: Thu, 4 Jul 2024 17:47:55 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Changer=20le=20r=C3=A9sum=C3=A9=20du=20nomb?= =?UTF-8?q?re=20d'indicateurs.=20fixes=20#99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www-client/pom.xml | 2 +- www-server/pom.xml | 2 +- www-shared/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/www-client/pom.xml b/www-client/pom.xml index 4d7ca3b..f937fee 100644 --- a/www-client/pom.xml +++ b/www-client/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>fr.agrometinfo</groupId> <artifactId>www</artifactId> - <version>2.0.0-alpha-5</version> + <version>2.0.0-SNAPSHOT</version> </parent> <artifactId>www-client</artifactId> diff --git a/www-server/pom.xml b/www-server/pom.xml index 760f34a..cefd7be 100644 --- a/www-server/pom.xml +++ b/www-server/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>fr.agrometinfo</groupId> <artifactId>www</artifactId> - <version>2.0.0-alpha-5</version> + <version>2.0.0-SNAPSHOT</version> </parent> <artifactId>www-server</artifactId> diff --git a/www-shared/pom.xml b/www-shared/pom.xml index 33cbf1b..205c0f1 100644 --- a/www-shared/pom.xml +++ b/www-shared/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>fr.agrometinfo</groupId> <artifactId>www</artifactId> - <version>2.0.0-alpha-5</version> + <version>2.0.0-SNAPSHOT</version> </parent> <artifactId>www-shared</artifactId> -- GitLab