Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 1b950311 by Tony Chemit at 2022-10-01T11:40:41+02:00 Decorator/I18n - Review date decoration and groupBy temporal value decoration - - - - - 204bf1eb by Tony Chemit at 2022-10-01T12:33:41+02:00 Decorator/I18n - Review WindAware decoration - - - - - 08ef6fae by Tony Chemit at 2022-10-01T12:45:46+02:00 Merge branch 'feature/issue_2437' into develop Normalisation des dates dans l'arbre de navigation - Closes #2437 - - - - - 18 changed files: - core/api/dto/src/main/java/fr/ird/observe/spi/validation/validators/ps/common/TripCheckRouteObsLogValues.java - core/api/dto/src/main/java/fr/ird/observe/spi/validation/validators/ps/observation/RouteCheckStartLogValue.java - core/persistence/java/target/extracted-sources/friend/models/Observe/persistence.model - model/src/main/models/Observe/dto/01-referential-common.model - model/src/main/models/Observe/dto/class/decorator.properties - model/src/main/models/Observe/dto/class/decoratorWithClassifier.properties - model/src/main/models/Observe/persistence/01-referential-common.model - toolkit/api/src/main/i18n/getters/java.getter - toolkit/api/src/main/i18n/translations/toolkit_en_GB.properties - toolkit/api/src/main/i18n/translations/toolkit_es_ES.properties - toolkit/api/src/main/i18n/translations/toolkit_fr_FR.properties - toolkit/api/src/main/java/fr/ird/observe/dto/WithStartEndDate.java - core/api/dto/src/main/java/fr/ird/observe/dto/referential/common/WindAware.java → toolkit/api/src/main/java/fr/ird/observe/dto/referential/WindAware.java - toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorDefinition.java - toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorDefinitionForSearch.java - toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorRenderer.java - toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DefaultDecoratorRenderer.java - toolkit/api/src/main/java/fr/ird/observe/spi/decoration/I18nDecoratorHelper.java Changes: ===================================== core/api/dto/src/main/java/fr/ird/observe/spi/validation/validators/ps/common/TripCheckRouteObsLogValues.java ===================================== @@ -31,6 +31,7 @@ import fr.ird.observe.spi.validation.validators.collection.CollectionValidationW import io.ultreia.java4all.i18n.I18n; import java.util.Collection; +import java.util.Locale; /** * Created on 11/03/2022. @@ -57,7 +58,7 @@ public class TripCheckRouteObsLogValues extends CollectionFieldValidationSupport @Override protected void addError(CollectionValidationWalkerContext<TripDto, RouteReference> context, Object object) { - setDefaultMessage(MESSAGE_KEY + String.format(MESSAGE_PARAMETERS, context.getCurrent().getStartLogValue(), I18nDecoratorHelper.getDateLabel(context.getCurrent().getDate()), context.getPrevious().getEndLogValue())); + setDefaultMessage(MESSAGE_KEY + String.format(MESSAGE_PARAMETERS, context.getCurrent().getStartLogValue(), I18nDecoratorHelper.getDateLabel(Locale.getDefault(), context.getCurrent().getDate()), context.getPrevious().getEndLogValue())); addFieldError(getFieldName(), object); } ===================================== core/api/dto/src/main/java/fr/ird/observe/spi/validation/validators/ps/observation/RouteCheckStartLogValue.java ===================================== @@ -32,6 +32,7 @@ import fr.ird.observe.spi.validation.validators.collection.CollectionValidationW import io.ultreia.java4all.i18n.I18n; import java.util.Collection; +import java.util.Locale; /** * Created on 09/03/2022. @@ -68,7 +69,7 @@ public class RouteCheckStartLogValue extends CollectionFieldValidationSupport<Tr @Override protected void addError(CollectionValidationWalkerContext<TripDto, RouteReference> context, Object object) { - setDefaultMessage(MESSAGE_KEY + String.format(MESSAGE_PARAMETERS, route.getStartLogValue(), context.getCurrent().getEndLogValue(), I18nDecoratorHelper.getDateLabel(context.getCurrent().getDate()))); + setDefaultMessage(MESSAGE_KEY + String.format(MESSAGE_PARAMETERS, route.getStartLogValue(), context.getCurrent().getEndLogValue(), I18nDecoratorHelper.getDateLabel(Locale.getDefault(), context.getCurrent().getDate()))); addFieldError(getFieldName(), object); } ===================================== core/persistence/java/target/extracted-sources/friend/models/Observe/persistence.model ===================================== @@ -205,7 +205,7 @@ referential.common.VesselType > referential.I18nReferentialEntity referential.common.WeightMeasureType > referential.I18nReferentialEntity -referential.common.Wind > referential.I18nReferentialEntity >> fr.ird.observe.dto.referential.common.WindAware +referential.common.Wind > referential.I18nReferentialEntity >> fr.ird.observe.dto.referential.WindAware minSpeed Integer maxSpeed Integer minSwellHeight Float ===================================== model/src/main/models/Observe/dto/01-referential-common.model ===================================== @@ -4,7 +4,7 @@ interface referential.WithFormula > WithStartEndDate interface referential.common.GearCharacteristicTypeAware > DtoAndReferenceAware -interface referential.common.WindAware > DtoAndReferenceAware +interface referential.WindAware > DtoAndReferenceAware interface referential.MinMaxWeightAware > DtoAndReferenceAware @@ -167,7 +167,7 @@ referential.common.VesselType > referential.I18nReferential referential.common.WeightMeasureType > referential.I18nReferential -referential.common.Wind > referential.I18nReferential >> referential.common.WindAware +referential.common.Wind > referential.I18nReferential >> referential.WindAware minSpeed Integer maxSpeed Integer minSwellHeight Float ===================================== model/src/main/models/Observe/dto/class/decorator.properties ===================================== @@ -100,14 +100,14 @@ presets.RemoteDataSourceConfiguration=${name} presets.ServerDataSourceConfiguration=${name} referential.common.FpaZone=${code}##${this::label} referential.common.Harbour=${this::label}##${code}##${locode} -referential.common.LengthLengthParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${validityRangeLabel}##${inputSizeMeasureType::labelOrUnknown}##${outputSizeMeasureType::labelOrUnknown} -referential.common.LengthWeightParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${validityRangeLabel}##${sizeMeasureType::labelOrUnknown} +referential.common.LengthLengthParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${inputSizeMeasureType::labelOrUnknown}##${outputSizeMeasureType::labelOrUnknown} +referential.common.LengthWeightParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${sizeMeasureType::labelOrUnknown} referential.common.Person=${lastName}##${firstName} referential.common.ShipOwner=${code}##${label} referential.common.Species=${faoCode}##${scientificLabel}##${this::label} referential.common.Vessel=${this::label}##${code} referential.common.VesselSizeCategory=${code}##${gaugeLabel}##${capacityLabel} -referential.common.Wind=${code}##${this::label}##${speedRange}##${swellHeight} +referential.common.Wind=${code}##${this::label}##${this::speedRange}##${this::swellHeight} referential.ll.observation.SensorBrand=${code}##${brandName} referential.ps.common.AcquisitionStatus=${code}##${this::label}##${_fieldEnabler::fieldEnabler} referential.ps.common.ObjectMaterial=${code::noCode}##${this::label} ===================================== model/src/main/models/Observe/dto/class/decoratorWithClassifier.properties ===================================== @@ -28,10 +28,10 @@ data.ps.logbook.ActivityStub=WithRoute|${date::date}##${time::niceTime}##${vesse data.ps.observation.Activity=WithRoute|${date::date}##${time::niceTime}##${vesselActivity::label} presets.RemoteDataSourceConfiguration=WithUrl|${name}##${url} presets.ServerDataSourceConfiguration=WithUrl|${name}##${url} -referential.common.FpaZone=Long|${code}##${this::label}##${validityRangeLabel} +referential.common.FpaZone=Long|${code}##${this::label}##${this::validityRangeLabel} referential.common.Harbour=Long|${this::label}##${code}##${locode} -referential.common.Vessel=Long|${this::label}##${code}##${vesselType::label}##$(observe.referential.common.Vessel.flagCountry) ${flagCountry::label}##$(observe.referential.common.Vessel.fleetCountry) ${fleetCountry::label}##${validityRangeLabel} +referential.common.Vessel=Long|${this::label}##${code}##${vesselType::label}##$(observe.referential.common.Vessel.flagCountry) ${flagCountry::label}##$(observe.referential.common.Vessel.fleetCountry) ${fleetCountry::label}##${this::validityRangeLabel} referential.ll.common.Program=Long|[LL] $(observe.Common.program) ${this::label} referential.ps.common.Program=Long|[PS] $(observe.Common.program) ${this::label} referential.ps.common.WeightCategory=Long|${code}##${species::speciesLabel}##${this::label} -referential.ps.localmarket.Packaging=Long|${code}##${this::label}##${harbour::label}##${batchComposition::label}##${batchWeightType::label}##${validityRangeLabel} +referential.ps.localmarket.Packaging=Long|${code}##${this::label}##${harbour::label}##${batchComposition::label}##${batchWeightType::label}##${this::validityRangeLabel} ===================================== model/src/main/models/Observe/persistence/01-referential-common.model ===================================== @@ -165,7 +165,7 @@ referential.common.VesselType > referential.I18nReferentialEntity referential.common.WeightMeasureType > referential.I18nReferentialEntity -referential.common.Wind > referential.I18nReferentialEntity >> fr.ird.observe.dto.referential.common.WindAware +referential.common.Wind > referential.I18nReferentialEntity >> fr.ird.observe.dto.referential.WindAware minSpeed Integer maxSpeed Integer minSwellHeight Float ===================================== toolkit/api/src/main/i18n/getters/java.getter ===================================== @@ -12,6 +12,7 @@ observe.Common.action.goto.tip observe.Common.action.save.tip observe.Common.dataGroupBy.count observe.Common.dataGroupBy.count.null +observe.Common.date.format observe.Common.navigation.config.DataGroupBy.mandatory observe.Common.navigation.config.DataGroupBy.optional observe.Common.navigation.config.groupByFlavor @@ -32,6 +33,8 @@ observe.Common.no.value observe.Common.nocode observe.Common.none observe.Common.size +observe.Common.time.format +observe.Common.timestamp.format observe.Common.type.data observe.Common.type.referential observe.Common.undefined ===================================== toolkit/api/src/main/i18n/translations/toolkit_en_GB.properties ===================================== @@ -10,6 +10,8 @@ observe.Common.action.goto.tip=Go to «%s» observe.Common.action.save.tip=Save modifications on data of type `%s` observe.Common.dataGroupBy.count=Usage count\: %d observe.Common.dataGroupBy.count.null=No usage found +observe.Common.date.format=%1$tY-%1$tm-%1$td +observe.Common.month.format=%1$tY-%1$tm observe.Common.navigation.config.DataGroupBy.mandatory=mandatory %s group by observe.Common.navigation.config.DataGroupBy.optional=optional %s group by observe.Common.navigation.config.DataGroupByOption.loadDisabledGroupBy=Show disabled groups @@ -46,6 +48,8 @@ observe.Common.no.value=No value observe.Common.nocode=Nocode observe.Common.none=None observe.Common.size=%d element(s) +observe.Common.time.format=%1$tH\:%1$tM +observe.Common.timestamp.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM observe.Common.type.data=Data observe.Common.type.referential=Referential observe.Common.undefined=Undefined ===================================== toolkit/api/src/main/i18n/translations/toolkit_es_ES.properties ===================================== @@ -10,6 +10,8 @@ observe.Common.action.goto.tip=Go to «%s» \#TODO observe.Common.action.save.tip=Guardar las modificaciones on data of type `%s` \#TODO observe.Common.dataGroupBy.count=Usage count\: %d observe.Common.dataGroupBy.count.null=No usage found +observe.Common.date.format=%1$tY-%1$tm-%1$td +observe.Common.month.format=%1$tY-%1$tm observe.Common.navigation.config.DataGroupBy.mandatory=mandatory %s group by observe.Common.navigation.config.DataGroupBy.optional=optional %s group by observe.Common.navigation.config.DataGroupByOption.loadDisabledGroupBy=Show disabled group by @@ -46,6 +48,8 @@ observe.Common.no.value=No value observe.Common.nocode=codigo ausente observe.Common.none=Ninguno observe.Common.size=%d element(s) \#TODO +observe.Common.time.format=%1$tH\:%1$tM +observe.Common.timestamp.format=%1$tY-%1$tm-%1$td %1$tH\:%1$tM observe.Common.type.data=Datos observe.Common.type.referential=Referential observe.Common.undefined=indeterminado ===================================== toolkit/api/src/main/i18n/translations/toolkit_fr_FR.properties ===================================== @@ -10,6 +10,8 @@ observe.Common.action.goto.tip=Accéder à «%s» observe.Common.action.save.tip=Sauver les modifications sur la donnée de type «%s» observe.Common.dataGroupBy.count=Nombre d'utilisation\: %d observe.Common.dataGroupBy.count.null=Non utilisé +observe.Common.date.format=%1$td/%1$tm/%1$tY +observe.Common.month.format=%1$tm/%1$tY observe.Common.navigation.config.DataGroupBy.mandatory=critère %s obligatoire observe.Common.navigation.config.DataGroupBy.optional=critère %s optionnel observe.Common.navigation.config.DataGroupByOption.loadDisabledGroupBy=Afficher les critères désactivés @@ -46,6 +48,8 @@ observe.Common.no.value=Valeur non définie observe.Common.nocode=code absent observe.Common.none=Aucun observe.Common.size=%d élément(s) +observe.Common.time.format=%1$tH\:%1$tM +observe.Common.timestamp.format=%1$td/%1$tm/%1$tY %1$tH\:%1$tM observe.Common.type.data=Donnée observe.Common.type.referential=Référentiel observe.Common.undefined=Non défini ===================================== toolkit/api/src/main/java/fr/ird/observe/dto/WithStartEndDate.java ===================================== @@ -27,6 +27,7 @@ import fr.ird.observe.spi.decoration.I18nDecoratorHelper; import java.util.Comparator; import java.util.Date; +import java.util.Locale; /** * Created by tchemit on 10/07/2018. @@ -45,12 +46,12 @@ public interface WithStartEndDate extends DtoAndReferenceAware { Date getEndDate(); - default String getValidityRangeLabel() { - return I18nDecoratorHelper.getValidityRangeLabel(getStartDate(), getEndDate()); + default String getValidityRangeLabel(Locale locale) { + return I18nDecoratorHelper.getValidityRangeLabel(locale, getStartDate(), getEndDate()); } - default String getStartEndDateLabel() { - return I18nDecoratorHelper.getStartEndDateLabel(getStartDate(), getEndDate()); + default String getStartEndDateLabel(Locale locale) { + return I18nDecoratorHelper.getStartEndDateLabel(locale, getStartDate(), getEndDate()); } default boolean acceptDate(Date date) { ===================================== core/api/dto/src/main/java/fr/ird/observe/dto/referential/common/WindAware.java → toolkit/api/src/main/java/fr/ird/observe/dto/referential/WindAware.java ===================================== @@ -1,8 +1,8 @@ -package fr.ird.observe.dto.referential.common; +package fr.ird.observe.dto.referential; /*- * #%L - * ObServe Core :: API :: Dto + * ObServe Toolkit :: API * %% * Copyright (C) 2008 - 2022 IRD, Ultreia.io * %% @@ -24,6 +24,8 @@ package fr.ird.observe.dto.referential.common; import fr.ird.observe.spi.decoration.I18nDecoratorHelper; +import java.util.Locale; + /** * Created on 18/07/2021. * @@ -40,11 +42,11 @@ public interface WindAware { Float getMinSwellHeight(); - default String getSpeedRange() { - return I18nDecoratorHelper.getSpeedRange(getMinSpeed(), getMaxSpeed()); + default String getSpeedRange(Locale locale) { + return I18nDecoratorHelper.getSpeedRange(locale, getMinSpeed(), getMaxSpeed()); } - default String getSwellHeight() { - return I18nDecoratorHelper.getSwellHeight(getMinSwellHeight(), getMaxSwellHeight()); + default String getSwellHeight(Locale locale) { + return I18nDecoratorHelper.getSwellHeight(locale, getMinSwellHeight(), getMaxSwellHeight()); } } ===================================== toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorDefinition.java ===================================== @@ -24,7 +24,6 @@ package fr.ird.observe.spi.decoration; import fr.ird.observe.dto.data.DataGroupBy; import io.ultreia.java4all.decoration.DecoratorDefinition; -import io.ultreia.java4all.i18n.I18n; import java.util.Locale; @@ -58,14 +57,9 @@ public class DataGroupByDecoratorDefinition<O extends DataGroupBy<?>> extends De ensureContextIndex(index); switch (index) { case 0: - return renderer.onNullValue("definitionLabel", locale, source.getDefinitionLabel(locale)); + return renderer.decorateDefinitionLabel(locale, source); case 1: - String filterText = source.getFilterText(); - if (source.isNull()) { - // the service just gave us the i18n key - filterText = I18n.l(locale, filterText); - } - return renderer.onNullValue("filterText", locale, filterText); + return renderer.decorateFilterText(locale, source); default: throw new IllegalStateException("No index with value: " + index); } ===================================== toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorDefinitionForSearch.java ===================================== @@ -60,12 +60,7 @@ public class DataGroupByDecoratorDefinitionForSearch<O extends DataGroupBy<?>> e ensureContextIndex(index); switch (index) { case 0: - String filterText = source.getFilterText(); - if (source.isNull()) { - // the service just gave us the i18n key - filterText = I18n.l(locale, filterText); - } - return renderer.onNullValue("filterText", locale, filterText); + return renderer.decorateFilterText(locale, source); case 1: return decorateCount(locale, source); default: ===================================== toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DataGroupByDecoratorRenderer.java ===================================== @@ -23,6 +23,12 @@ package fr.ird.observe.spi.decoration; */ import fr.ird.observe.dto.data.DataGroupBy; +import io.ultreia.java4all.i18n.I18n; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; /** * Created on 23/01/2022. @@ -36,4 +42,38 @@ public class DataGroupByDecoratorRenderer<O extends DataGroupBy<?>> extends Java super(type); } + public String decorateDefinitionLabel(Locale locale, O source) { + return onNullValue("definitionLabel", locale, source.getDefinitionLabel(locale)); + } + + public String decorateFilterText(Locale locale, O source) { + String filterText = source.getFilterText(); + if (source.isNull()) { + // the service just gave us the i18n key + filterText = I18n.l(locale, filterText); + } else { + if (source.definition().isTemporal()) { + // use correct locale to display the temporal value + filterText = translateDate(locale, source.getFilterValue()); + } + } + return onNullValue("filterText", locale, filterText); + } + + protected String translateDate(Locale locale, String value) { + if (Locale.FRANCE.equals(locale)) { + List<String> split = Arrays.asList(value.split("-")); + switch (split.size()) { + case 1: + return value; + case 2: + case 3: + Collections.reverse(split); + return String.join("/", split); + default: + throw new IllegalStateException("Can't manage here date: " + value); + } + } + return value; + } } ===================================== toolkit/api/src/main/java/fr/ird/observe/spi/decoration/DefaultDecoratorRenderer.java ===================================== @@ -24,6 +24,7 @@ package fr.ird.observe.spi.decoration; import fr.ird.observe.dto.WithStartEndDate; import fr.ird.observe.dto.referential.I18nReferentialHelper; +import fr.ird.observe.dto.referential.WindAware; import fr.ird.observe.dto.referential.WithI18n; import io.ultreia.java4all.decoration.DecoratorRenderer; import io.ultreia.java4all.i18n.I18n; @@ -69,6 +70,18 @@ public class DefaultDecoratorRenderer<O> extends DecoratorRenderer<O> { return source == null ? onNullValue(locale, null) : I18nReferentialHelper.getLabel(locale, source); } + public String validityRangeLabel(Locale locale, WithStartEndDate source) { + return source == null ? onNullValue(locale, null) : source.getValidityRangeLabel(locale); + } + + public String speedRange(Locale locale, WindAware source) { + return source == null ? onNullValue(locale, null) : source.getSpeedRange(locale); + } + + public String swellHeight(Locale locale, WindAware source) { + return source == null ? onNullValue(locale, null) : source.getSwellHeight(locale); + } + public String labelOrUnknown(Locale locale, WithI18n source) { return source == null ? onUnknownValue(locale, null) : I18nReferentialHelper.getLabel(locale, source); } @@ -84,7 +97,7 @@ public class DefaultDecoratorRenderer<O> extends DecoratorRenderer<O> { } public String date(Locale locale, Date time) { - return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getDateLabel(time); + return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getDateLabel(locale, time); } public String niceDate(Locale locale, Date time) { @@ -102,11 +115,11 @@ public class DefaultDecoratorRenderer<O> extends DecoratorRenderer<O> { } public String time(Locale locale, Date time) { - return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getTimeLabel(time); + return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getTimeLabel(locale, time); } public String timestamp(Locale locale, Date time) { - return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getTimestampLabel(time); + return time == null ? onNullValue(locale, null) : I18nDecoratorHelper.getTimestampLabel(locale, time); } protected boolean isDateOrTimestamp(String propertyName) { ===================================== toolkit/api/src/main/java/fr/ird/observe/spi/decoration/I18nDecoratorHelper.java ===================================== @@ -110,69 +110,70 @@ public abstract class I18nDecoratorHelper extends BeanPropertyI18nKeyProducerPro return i18nDecoratorHelper.getDefaultLabelsBuilder().getI18nPropertyKey(type, propertyName); } - public static String getValidityRangeLabel(Date startDate, Date endDate) { + public static String getValidityRangeLabel(Locale locale, Date startDate, Date endDate) { if (startDate == null && endDate == null) { return t("observe.Common.undefined"); } if (startDate != null && endDate != null) { StringBuilder result = new StringBuilder(); - I18nDecoratorHelper.getDateLabel(result, startDate); + I18nDecoratorHelper.getDateLabel(locale, result, startDate); result.append(" - "); - I18nDecoratorHelper.getDateLabel(result, endDate); + I18nDecoratorHelper.getDateLabel(locale, result, endDate); return result.toString(); } if (startDate != null) { StringBuilder result = new StringBuilder(" > "); - I18nDecoratorHelper.getDateLabel(result, startDate); + I18nDecoratorHelper.getDateLabel(locale, result, startDate); return result.toString(); } StringBuilder result = new StringBuilder(" < "); - I18nDecoratorHelper.getDateLabel(result, endDate); + I18nDecoratorHelper.getDateLabel(locale, result, endDate); return result.toString(); } - public static String getStartEndDateLabel(Date startDate, Date endDate) { + public static String getStartEndDateLabel(Locale locale, Date startDate, Date endDate) { StringBuilder result = new StringBuilder(); - I18nDecoratorHelper.getDateLabel(result, startDate, I18n.t("observe.WithStartEndDate.noStartDate")); + I18nDecoratorHelper.getDateLabel(locale, result, startDate, I18n.t("observe.WithStartEndDate.noStartDate")); result.append(" - "); - I18nDecoratorHelper.getDateLabel(result, endDate, I18n.t("observe.WithStartEndDate.noEndDate")); + I18nDecoratorHelper.getDateLabel(locale, result, endDate, I18n.t("observe.WithStartEndDate.noEndDate")); return result.toString(); } - public static void getDateLabel(StringBuilder result, Date date, String nullLabel) { + public static void getDateLabel(Locale locale, StringBuilder result, Date date, String nullLabel) { if (date == null) { result.append(nullLabel); } else { - getDateLabel(result, date); + getDateLabel(locale, result, date); } } - public static void getDateLabel(StringBuilder result, Date date) { - result.append(String.format("%1$td/%1$tm/%1$tY", date)); + public static void getDateLabel(Locale locale, StringBuilder result, Date date) { + result.append(getDateLabel(locale, date)); } - public static String getDateLabel(Date date) { - return String.format("%1$td/%1$tm/%1$tY", date); + public static String getDateLabel(Locale locale, Date date) { + return I18n.l(locale, "observe.Common.date.format", date); } - public static String getTimestampLabel(Date date) { - return String.format("%1$td/%1$tm/%1$tY %1$tH:%1$tM", date); + public static String getTimestampLabel(Locale locale, Date date) { + + return I18n.l(locale, "observe.Common.timestamp.format", date); } - public static String getTimeLabel(Date date) { - return String.format("%1$tH:%1$tM", date); + public static String getTimeLabel(Locale locale, Date date) { + return I18n.l(locale, "observe.Common.time.format", date); } - public static String getSpeedRange(Integer minValue, Integer maxValue) { + public static String getSpeedRange(Locale locale, Integer minValue, Integer maxValue) { String min = minValue == null ? "" : minValue + ""; String max = maxValue == null ? "" : maxValue + ""; - return I18n.t("observe.referential.common.Wind.speedRange") + String.format("[%-4s < %-4s]", min, max); + return I18n.l(locale, "observe.referential.common.Wind.speedRange") + String.format("[%-4s < %-4s]", min, max); } - public static String getSwellHeight(Float minValue, Float maxValue) { + public static String getSwellHeight(Locale locale, Float minValue, Float maxValue) { String min = minValue == null ? "" : minValue + ""; String max = maxValue == null ? "" : maxValue + ""; - return I18n.t("observe.referential.common.Wind.swellHeight") + String.format("[%-4s < %-4s]", min, max); + return I18n.l(locale, "observe.referential.common.Wind.swellHeight") + String.format("[%-4s < %-4s]", min, max); } public static String decorateCoordinate(Float latitude, Float longitude) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/117f7b7cf29f0c94506a0ba10... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/117f7b7cf29f0c94506a0ba10... You're receiving this email because of your account on gitlab.com.