papandreou / node-cldr

node.js library for extracting data from CLDR (the Unicode Common Locale Data Repository)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

valid pt-BR not there

ppKrauss opened this issue · comments

commented

The oficial code pt-BR exist as pt_BR.xml file at http://www.unicode.org/Public/cldr/latest/core.zip (and i18ndata.appspot)
but not as record at https://github.com/unicode-cldr/cldr-dates-full/tree/master/main
... ok, because not changes its pt root (understanding that "default pt" is pt-BR).

There are a https://github.com/unicode-cldr/cldr-valid for check all that have defined identity?

I'm not sure exactly what this is regarding? Does it have anything to do with this library (node-cldr)?

commented

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.

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?

commented

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.

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