Comments (5)
I'm not sure exactly what this is regarding? Does it have anything to do with this library (node-cldr)?
from node-cldr.
Sorry, simplifying: how to check if "pt-BR" or "pt-UU" are valid codes? Both are not in the main
folder, but one is valid and the other is not valid.
from node-cldr.
Hmm, I'm not aware of an easy way to check that, or even an authoritative source for the information. node-cldr
will just use whatever data it can find as a result of splitting up the locale id, so pt-BOGUS
will also be accepted. Even a locale id of just bogus
will still get the data from root.xml.
node-cldr
does expose a localeIds
property, though, which is a list of all (normalized) locale ids that have data:
$ node -p -e "require('cldr').localeIds.filter(function (localeId) {return /^pt(?:_|$)/.test(localeId);})"
[ 'pt',
'pt_ao',
'pt_br',
'pt_cv',
'pt_gw',
'pt_mo',
'pt_mz',
'pt_pt',
'pt_st',
'pt_tl' ]
Can that be used? What makes pt_br
show up is that it has an actual file in the distribution: https://github.com/papandreou/node-cldr/blob/master/3rdparty/cldr/common/main/pt_BR.xml
The file doesn't really add anything to what's defined in https://github.com/papandreou/node-cldr/blob/master/3rdparty/cldr/common/main/pt.xml (except for <language type="pt"/><territory type="BR"/>
). I guess that indicates that every valid locale id will have an xml file. Does that sound like something you can use?
from node-cldr.
You find, there are a pt_BR file! Why it is not at https://github.com/unicode-cldr/cldr-dates-full/tree/master/main folder?
Problem: the authority is https://github.com/unicode-cldr , and I need an authoritative source.
PS: sorry, your https://github.com/papandreou is not valid for this "official demand".
... Can we request (unicode-cldr) an official list of language codes?
- You say "node-cldr will just use whatever data it can find as a result of splitting up the locale id"... Ok, the data is there, isn't?
- I see similar problem with en-UK, en-US, etc. all they are big countries, so need an authoritative manifestation... Well, how to add correct codes at ietf-language-tagsdataset??
Thanks about your array-checker (!), but the problem is about the authoritative and reliable list.
The XPath on cldr/common/main/pt.xml
/ldml/localeDisplayNames/localeDisplayNames/languages/language[@type=$check]
is a possible workaround, but is less authoritative and less reliable than a ls
at main
folder.
from node-cldr.
You find, there are a pt_BR file! Why it is not at https://github.com/unicode-cldr/cldr-dates-full/tree/master/main folder?
I don't know. I haven't studied how they chose to divide up their data after moving to github.
I hope you'll find a sufficiently authoritative source somewhere. node-cldr
just comes bundled with a copy of the CLDR distribution downloaded from here: http://cldr.unicode.org/index/downloads
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.