[MGNLDEMO-348] Changing Java 7 Locale Names To Java 8 for demo project Created: 13/Oct/20  Updated: 13/Oct/20  Resolved: 13/Oct/20

Status: Closed
Project: Magnolia Demo Projects
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Neutral
Reporter: Julian Nodarse Assignee: Aleksandr Pchelintcev
Resolution: Not an issue Votes: 0
Labels: maintenance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
clones MGNLUI-6272 Convert strings to locales in LocaleS... Closed
Problem/Incident
is caused by MAGNOLIA-7897 Provide Compatibility And Documentati... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Epic Link: Support

 Description   

Like MAGNOLIA-7897, demo project should be fixed info.magnolia.demo.travel.model.NavigationAreaModel#getLocale

Reproduce steps for current error:

  • on CE, I changed the value of /modules/travel-demo/config/travel/i18n/locales/en@language to en_GB
  • Tried to open any page and switch languages and I get our 404 page. The underlying error is:
      
    Caused by: java.lang.IllegalArgumentException: Invalid locale format: en_gb
    		at org.apache.commons.lang3.LocaleUtils.parseLocale(LocaleUtils.java:158)
    		at org.apache.commons.lang3.LocaleUtils.toLocale(LocaleUtils.java:126)
    		at info.magnolia.demo.travel.model.NavigationAreaModel.getLocale(NavigationAreaModel.java:142)
    


 Comments   
Comment by Aleksandr Pchelintcev [ 13/Oct/20 ]

This issue actually seems different from the one in main: the LocaleUtils is the right tool to parse the underscore-based locales. However, it gets the locale in lower-case format, which it doesn't accept. Checking the situation, thanks.

Comment by Aleksandr Pchelintcev [ 13/Oct/20 ]

Tried both with dx-core ad CE by changing the country in travel demo i18n config. All of the three (en, en_GB and en_CH) as well as e.g. en-CH seem to work fine.

jnodarse feel free to re-open

Comment by Aleksandr Pchelintcev [ 13/Oct/20 ]

See the locale configuration docs for a bit more details (i.e. language and country have to be specified separately except for the fallback locale case, which is now handled correctly ever since the issue in the core was fixed.

Generated at Mon Feb 12 05:18:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.