You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/12/14 10:58:28 UTC

[isis] branch master updated: ISIS-2918: fixes prev. commit - was using wrong sub-locales

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 5055524  ISIS-2918: fixes prev. commit - was using wrong sub-locales
5055524 is described below

commit 5055524158feec159ac258e27afffafe1b9ec512
Author: andi-huber <ah...@apache.org>
AuthorDate: Tue Dec 14 11:58:21 2021 +0100

    ISIS-2918: fixes prev. commit - was using wrong sub-locales
---
 .../applib/value/semantics/ValueSemanticsAbstract.java    | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/value/semantics/ValueSemanticsAbstract.java b/api/applib/src/main/java/org/apache/isis/applib/value/semantics/ValueSemanticsAbstract.java
index 4fdba94..112e836 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/value/semantics/ValueSemanticsAbstract.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/value/semantics/ValueSemanticsAbstract.java
@@ -99,7 +99,7 @@ implements
      * @param context - nullable in support of JUnit testing
      * @return {@link Locale} from given context or else system's default
      */
-    protected UserLocale getLocale(final @Nullable ValueSemanticsProvider.Context context) {
+    protected UserLocale getUserLocale(final @Nullable ValueSemanticsProvider.Context context) {
         return Optional.ofNullable(context)
         .map(ValueSemanticsProvider.Context::getInteractionContext)
         .map(InteractionContext::getLocale)
@@ -116,9 +116,8 @@ implements
      * this is typically overruled later by implementations of
      * {@link #configureDecimalFormat(org.apache.isis.applib.adapters.ValueSemanticsProvider.Context, DecimalFormat) configureDecimalFormat}
      */
-    @SuppressWarnings("javadoc")
-    protected DecimalFormat getNumberFormat(final @Nullable ValueSemanticsProvider.Context context) {
-        val format = (DecimalFormat)NumberFormat.getNumberInstance(getLocale(context).getNumberFormatLocale());
+   protected DecimalFormat getNumberFormat(final @Nullable ValueSemanticsProvider.Context context) {
+        val format = (DecimalFormat)NumberFormat.getNumberInstance(getUserLocale(context).getNumberFormatLocale());
         // prime w/ 16 (64 bit IEEE 754 double has 15 decimal digits of precision)
         format.setMaximumFractionDigits(16);
         return format;
@@ -199,13 +198,13 @@ implements
         switch (temporalCharacteristic) {
         case DATE_TIME:
             return DateTimeFormatter.ofLocalizedDateTime(dateFormatStyle, timeFormatStyle)
-                    .withLocale(getLocale(context).getNumberFormatLocale());
+                    .withLocale(getUserLocale(context).getTimeFormatLocale());
         case DATE_ONLY:
             return DateTimeFormatter.ofLocalizedDate(dateFormatStyle)
-                    .withLocale(getLocale(context).getNumberFormatLocale());
+                    .withLocale(getUserLocale(context).getTimeFormatLocale());
         case TIME_ONLY:
             return DateTimeFormatter.ofLocalizedTime(timeFormatStyle)
-                    .withLocale(getLocale(context).getNumberFormatLocale());
+                    .withLocale(getUserLocale(context).getTimeFormatLocale());
         default:
             throw _Exceptions.unmatchedCase(temporalCharacteristic);
         }
@@ -223,7 +222,7 @@ implements
                 temporalCharacteristic, offsetCharacteristic, datePattern, timePattern, zonePattern)
                 .parseLenient()
                 .parseCaseInsensitive()
-                .toFormatter(getLocale(context).getNumberFormatLocale());
+                .toFormatter(getUserLocale(context).getTimeFormatLocale());
     }
 
     protected DateTimeFormatterBuilder getEditingFormatAsBuilder(