Git Product home page Git Product logo

Comments (5)

papandreou avatar papandreou commented on September 16, 2024

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

from node-cldr.

ppKrauss avatar ppKrauss commented on September 16, 2024

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.

papandreou avatar papandreou commented on September 16, 2024

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.

ppKrauss avatar ppKrauss commented on September 16, 2024

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.

papandreou avatar papandreou commented on September 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.