Comments (8)
I dug around a bit, but CLDR docs are pretty sparse. The closest thing I could find was that some of the incomplete locales, such as nn
, are littered with draft="unconfirmed"
attributes:
node-cldr/3rdparty/cldr/common/main/nn.xml
Line 7976 in eeff9f2
That doesn't really solve the <listPattern type="or">
problem though, as that is completely absent from the nn
locale.
I'm out of ideas, so I'll close this for now. The "easy" fix was released in 5.0.0.
from node-cldr.
You're getting the data from the root
locale, which all locales inherit from.
require('cldr').localeIds
should be a list of locales that have data available. Does that solve your problem? I could also make the extract... functions throw or return nothing (not even the root data) in this case.
from node-cldr.
I think the best course of action would be to throw exception or just return null
value. I'm not sure if every locale from localeIds
actually has data (for example not all locales has pluralization function).
from node-cldr.
I landed a fix for this, but it turned out to be problematic when extracting from the supplemental
folder where not every locale has its own file. I might revisit it later.
from node-cldr.
+1 on this.
At least it would be good to have a “strict mode”, where the library does not silently fall back to root. Even if this is only partially implemented (not working on supplemental data extraction), it would be an improvement, imho.
A typical use case is when working on a fallback chain of languages, e.g. ["nn", "no", "nb"]
(nn
has less than 100 % coverage in CLDR).
from node-cldr.
Hmm, it would be fairly easy to just throw when attempting to extract data for a locale that does not exist in CLDR at all, but I'm not sure how to implement a strict mode like that. Since nn
is in there: https://github.com/papandreou/node-cldr/blob/master/3rdparty/cldr/common/main/nn.xml it's hard to tell if the fallback to root
is intentional or not.
For example, en.xml
does not contain an entry for the America/Coral_Harbour
time zone, so that will fall back to the entry in root.xml
. Which is probably perfectly fine -- then the exemplar city will be Atikokan in the Englishes.
That being said I don't have a full overview of everything in the CLDR -- it could be that there's some information in there that would help detect when the fallback isn't intentional. Please prove me wrong :)
from node-cldr.
Implemented the easy one here: #73
from node-cldr.
For example,
en.xml
does not contain an entry for theAmerica/Coral_Harbour
time zone, so that will fall back to the entry inroot.xml
. Which is probably perfectly fine -- then the exemplar city will be Atikokan in the Englishes.
I see, reality is more complex than I imagined. As always.
I guess if there was a way to know what fallback level was actually used, the client could use that information for decide whether the fallback was appropriate for their particular situation, but I have no idea how that would work...
from node-cldr.
Related Issues (20)
- npm package includes .git HOT 1
- renderSpelloutCardinal doesn't handle decimal digits well HOT 4
- renderDigitsOrdinal alsways uses Latin digits
- spelloutCardinal stopped working in a lot of languages HOT 1
- Dependency <xmldom> 0.6.0 has security vulnerability HOT 3
- renderDigitsOrdinal returns unformatted number HOT 1
- 'sr' Plural rule is wrong HOT 3
- Extract variant display names HOT 2
- renderDigitsOrdinal looks off in some languages HOT 3
- Get language display names dynamically HOT 5
- Extract most popular territory for locale HOT 3
- Territoryinformation - language population wrong HOT 4
- Get list of plural classes HOT 3
- Can you cut a release for 4.12.0? HOT 2
- How to render a number in a specific number system HOT 6
- RBNF rule parsing error HOT 6
- "undefined" in RBNF:SpelloutCardinalNeuter HOT 1
- Territory subdivision HOT 3
- Publish without .git HOT 1
- Consider using gzip HOT 4
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 node-cldr.