Bug 63927

Summary: Inconsistent mapping of Norwegian locales for date formats
Product: POI Reporter: JDM <demurcia>
Component: SS CommonAssignee: POI Developers List <dev>
Status: NEEDINFO ---    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description JDM 2019-11-15 07:55:58 UTC
In class org.apache.poi.ss.util.DateFormatConverter, the locale mapping is defined as:
result.put( "nn", "[$-0814]" ); 
result.put( "no", "[$-0414]" ); 
result.put( "no_no", "[$-0814]" ); 

I suppose that 0414 is Bokmål and 0814 is Nynorsk. If I am correct, a Norwegian user uses Nynorsk if located in Norway and Bokmål if located elsewhere. 

Should all locales starting with the "no" prefix be mapped to Bokmål ?
Comment 1 Andreas Beeker 2019-12-08 00:13:26 UTC
So according https://www.science.co.il/language/Locale-codes.php, the assumption about the mapping seems correct.

What puzzles me is, that ISO 639-1 language code for Bokmål is "nb", which is not in the list.

And according https://www.oracle.com/technetwork/java/javase/java8locales-2095355.html, this should be "nb-NO". Also have look at the notes.

So I would ignore the no-NO-x-lvariant-NY variant and change it to the following:
"no","no_no","nb","nb_no" -> 0414
"nn","nn_no" -> 0814

Correct?

As a side note, we are using a hashmap here ... and add/overwrite multiple entries with the same key - this is anyway wrong :(
Comment 2 Andreas Beeker 2019-12-08 00:23:22 UTC
I found a better reference for the locale -> windows code translation:
https://ss64.com/locale.html
Comment 3 Andreas Beeker 2019-12-08 00:28:44 UTC
... and the offical MS spec is [MS_LCID]:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f
Comment 4 Andreas Beeker 2019-12-08 23:38:17 UTC
I've provided a reworked mapping of the LCIDs via r1871066.

The mapping is based on the [MS-LCID] specs.

Please verify, if this is ok for you.