Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect polish FULL_STANDALONE months name #55

Open
whosho opened this issue Sep 5, 2016 · 8 comments
Open

Incorrect polish FULL_STANDALONE months name #55

whosho opened this issue Sep 5, 2016 · 8 comments

Comments

@whosho
Copy link

whosho commented Sep 5, 2016

In case of polish locale("pl", "PL"), the library returns incorrect translations.

Example:

Locale locale = PartnerManager.getInstance().getConfig().market.locale;
return Month.of(month).getDisplayName(TextStyle.FULL_STANDALONE, locale);

returns stycznia (genitive) - should be Styczeń (nominative, standalone)

The correct translations are:
jan) stycznia -> Styczeń
feb) lutego -> Luty
mar) marca - > Marzec
apr) kwietnia -> Kwiecień
may) maja -> Maj
jun) czerwca -> Czerwiec
jul) lipca -> Lipiec
aug) sierpnia -> Sierpień
sep) września -> Wrzesień
oct) października -> Październik
nov) listopada -> Listopad
dec) grudnia -> Grudzień

@jodastephen
Copy link
Member

ThreeTen-Backport gets the data for "standalone" months from the JDK, and that data is not available for JDKs before v9 if I remember correctly.

@laalto
Copy link

laalto commented Oct 4, 2016

Similar problems with Finnish locale. Standalone nominative month names end with "-kuu" and when inflected in partitive for non-standalone cases it becomes "-kuuta".

Examples:

    Locale locale = new Locale("fi", "FI");

    System.out.println(Month.of(10).getDisplayName(TextStyle.FULL_STANDALONE, locale));
    // prints "lokakuuta", expected "lokakuu"

    DateTimeFormatter fmt = DateTimeFormatter.ofPattern("LLLL").withLocale(locale);
    System.out.println(fmt.format(Month.of(10)));
    // prints "lokakuuta", expected "lokakuu"

This gets even hairier when long localized dates are used, adding the "-ta" inflection suffix twice:

    DateTimeFormatter fmt2 = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).withLocale(locale);
    System.out.println(fmt2.format(LocalDate.parse("2016-10-01")));
    // prints "1. lokakuutata 2016", expected "1. lokakuuta 2016"

@EugeneAzhogin
Copy link

Similar problems with Russian locale.

@sergiandreplace
Copy link

Same is going on with Catalan. I've made these simple tests: https://gist.github.com/sergiandreplace/29f995cd7a135484fa36ba05b6d0795e

And the two last ones are failing, as LLLL is not returning Standalone months. In fact, I've checked the value of months for standalone format and they return non-standalone one.

I'm not sure where is it taking from as I'm running it on an Android project. Being a unit tests is probably using the local jdk 8. Tested with android version of java.time libraries and it works.

@sschaap
Copy link
Contributor

sschaap commented Aug 26, 2019

I'm not sure where is it taking from as I'm running it on an Android project.

It uses the platform implementation of the DateTimeTextProvider SPI, see my comment here: #92 (comment)

@sergiandreplace
Copy link

@sschaap
After looking at your very well documented answer (kudos, excelently explained) and looking to the CLDR32 (used by Android 9), it looks like the STANDALONE variant is correctly defined.

It is correctly returned with the appropiate TextFormat constants:

  • "de setembre" for non-standalone and "setembre" for standalone.

But, using a format pattern with LLLL in DateTimeFormatter does not retrieve the standalone one.

Using the old DateSimpleFormatter in Android:

SimpleDateFormat("LLLL", Locale("ca")).format(Date()) returns "setembre" (standalone form).
SimpleDateFormat("MMMM", Locale("ca")).format(Date()) returns "de setembre" (non-standalone).

Who is deciding to use not-standalone months for LLLL here? ThreeTenBP, Android or some other piece of software? Is this the expected behaviour?

P.D.: ironically, in the java documentation the use of LLLL vs MMMM in catalan is set as an example for the SimpleDateFormat, but the DateTimeFormatter documentation has no mention about the difference between M and L.

Thanks in advance

@sergiandreplace
Copy link

Sorry, right now I've just re-read the second comment: #55 (comment)

So it looks like the problem is that android still uses Java 8, isn' it?

@sergiandreplace
Copy link

I've finally came up with this solution: https://github.com/sergiandreplace/androiddatetimetextprovider

If anybody wants to try with another language....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants