go-playground / locales

:earth_americas: a set of locales generated from the CLDR Project which can be used independently or within an i18n package; these were built for use with, but not exclusive to https://github.com/go-playground/universal-translator
MIT License
268 stars 55 forks source link

UK Dates #7

Closed martin-css closed 7 years ago

martin-css commented 7 years ago

The en_GB locale has incorrect date formatting. The UK uses the DD/MM/YYYY format as per most of Europe, not the US style MM/DD/YYYY format.

I had a very quick look at the unicode CLDR but didn't see exactly where this was specified for individual dialects. I would be surprised if this was wrong as a US date format often causes complaints from users. I did find other auto generated data has the correct format, e.g. https://github.com/unicode-cldr/cldr-dates-full/blob/master/main/en-GB/ca-gregorian.json

Hence I was wondering if this was a code generation issue?

deankarn commented 7 years ago

Hey @martin-css

Thanks for reporting, I'm using the XML CLDR data downloaded from the CLDR site here and I know the CLDR data still isn't perfect.

It is very possible that I have made a parsing mistake as well though; I will check this out ASAP and keep you apprised of my progress.

If you could provide any or all locales you know the format is I correct, that would help :smile:

Even if the CLDR data is incorrect I am able to override anything needed during the generation phase, just need to know the details.

deankarn commented 7 years ago

UPDATE: so when no data, in this case DateFormats for the gregorian calendar, exist in the XML as is the case for en_GB I fallback to the base language/locale which would be en and that has the MM/DD/YYYY information.

Obviously this isn't 100% correct and I will endevor to find out the correct way to do this; in the meantime if there are any formats you need updating right away I am more than willing to add the exceptions.

deankarn commented 7 years ago

UPDATE 2: I was already looking at converting this to use the JSON CLDR information, this issue is the perfect reason to implement it.

Will keep apprised.

martin-css commented 7 years ago

Thanks for the updates. I had a look at the Unicode CLDR site, they have a page on the rules for English inheritance.

I think this is the underlying issue. en_GB should be inheriting from en_001 instead of en. This is why the JSON CLDR was correct but not the locale in this project.

Hopefully it should just be a case of updating the inheritance rules in the code generation to match this table.

deankarn commented 7 years ago

Thanks @martin-css that's definitely the solution! 👍

I will add the English Inheritance cross reference to the code generation and that will solve the problem :smile:

I have a few interviews today, but will try to squeeze this in.

P.S. I will still probably eventually convert the code generation to use the new JSON rules, just so I can avoid issues like this in the future and avoid new issues as rules change.

martin-css commented 7 years ago

Thanks.

Good luck with the interviews :+1:

deankarn commented 7 years ago

Hey @martin-css this has been corrected in Release 0.11.1

thanks for all your help!