Comments (4)
Agreed :) I wonder if this hasn't bitten us much yet because of Mac OS X's infuriating case-insensitive file system.
from twitter-cldr-rb.
Oh, right, that explains why I was getting different errors locally and on the server. On the server it was failing while trying to find the resource file and locally it was failing because it couldn't find any data in the file using the lowercase key.
from twitter-cldr-rb.
Alright, I did a little bit of digging in twitter-cldr and ruby-cldr and here are my thoughts. Initially I was going to convert all resources and everything else in twitter-cldr to lower-case locales and then downcase locales that we get from users, but I no longer think that's the best approach.
First, even though the standard doesn't require it, I looks like most commonly region codes is written in upper case, so that should be the default expectation.
Second, going full lower-case makes it tricky to retrieve data from ruby-cldr on a case-sensitive filesystem, because all directories/files in the original CLDR data are using upper case region names. E.g., if you ask ruby-cldr to export resources for "en-gb", it'll find them only on case-insensitive filesystem and I'd rather not make that assumption. Besides, although this part is trivial, it requires an additional option in ruby-cldr to downcase all locales during the export (in directory names, hash keys, etc.).
With all that said, I still want to make twitter-cldr user-friendly in terms of locale casing, so I'm going to add a small 'hack' to lib/twitter_cldr.rb
that will map lower-case locale names to standard CLDR names similar to how we map "twitter" locale names to CLDR locale names right now. It'll add a bit more work to our TwitterCldr.conver_locale
method, but it will be a small local change in twitter-cldr rather than a whole bunch of changes in both libraries and in all our locale resources.
Does it make sense?
from twitter-cldr-rb.
Yes, that makes perfect sense, thanks for writing up such a thorough explanation of the problem, @KL-7. It seems much less error-prone to handle casing logic in convert_locale
than in a bunch of other, potentially case-insensitive places (i.e. the filesystem).
from twitter-cldr-rb.
Related Issues (20)
- Formatting a full datetime with a time zone gives current time timezone (PST instead of PDT) HOT 4
- Incorrect list formatter behaviour HOT 2
- Exception when using hyphenate HOT 1
- Incorrect LikelySubtags.locale_for behaviour HOT 1
- Incorrect ListFormatter behaviour HOT 6
- Weekday names `:wide` format is the same as `:abbreviated` HOT 5
- Ruby 3.1.0 with Psych 4 forces YAML.safe_load and throws Psych::DisallowedClass HOT 1
- Month names :narrow format returns array of digits rather than the first letter of each month HOT 3
- Ruby 2.7+ compatibility issue/question HOT 1
- Warning when running Sorbet HOT 2
- Why use :one instead of :name HOT 1
- Remove lone release HOT 1
- Missing titlecase and/or uppercase mappings? HOT 1
- Add support for yMMMMd (October 7, 2022) HOT 2
- `format: :long` breaks when combined with currency formatting HOT 4
- Breaking by word a string containing Japanese and Latin characters HOT 3
- Contributor access revoked HOT 1
- Wrong language name is returned for Norwegian Nynorsk (nn) HOT 1
- Unicode, ICU, CLDR update HOT 1
- Convert CLDR Date/Time pattern to Ruby-compatible pattern HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitter-cldr-rb.