Skip to content

GlobalizeCompiler does not work unicode extensions in locales. #30

@cahuja

Description

@cahuja

As per http://www.unicode.org/reports/tr35/#Locale_Extension_Key_and_Type_Data a locale should be able to handle unicode extensions such as

  • ca (Calendar algorithm)
  • cf (Currency format style)
  • co (Collation style)
  • cu (Currency type)
  • em (Emoji presentation style)
  • fw (First day of week)
  • hc (Hour cycle)
  • lb (line break style)
  • lw (line break word handling)
  • ms (measurement system)
  • nu (numbering system)

Now, I know many of these options are not supported by Globalize, but I know we can atleast handle -u-nu (numbering system), -u-cu (currency type) and -u-cf- (currency format style)

When running this in the Globalize compiler, there is an assumption that the passed in locale would match the CLDR directory structure.

➜  node-sandbox ./node_modules/.bin/globalize-compiler -l ar-EG-u-nu-latn -o dest.js app.js        
fs.js:808
  return binding.readdir(pathModule._makeLong(path));
                 ^

Error: ENOENT: no such file or directory, scandir '/home/site/ExternalRepos/node-sandbox/node_modules/cldr-data/main/ar-EG-u-nu-latn'
    at Error (native)
    at Object.fs.readdirSync (fs.js:808:18)
    at jsonFiles (/home/site/ExternalRepos/node-sandbox/node_modules/cldr-data/index.js:36:22)
    at /home/site/ExternalRepos/node-sandbox/node_modules/cldr-data/index.js:60:21
    at Array.reduce (native)
    at mainPathsFor (/home/site/ExternalRepos/node-sandbox/node_modules/cldr-data/index.js:59:18)
    at Function.cldrData.entireMainFor (/home/site/ExternalRepos/node-sandbox/node_modules/cldr-data/index.js:90:29)
    at cldr (/home/site/ExternalRepos/node-sandbox/node_modules/globalize-compiler/lib/compile-extracts.js:30:57)
    at Object.compileExtracts (/home/site/ExternalRepos/node-sandbox/node_modules/globalize-compiler/lib/compile-extracts.js:55:18)
    at Object.<anonymous> (/home/site/ExternalRepos/node-sandbox/node_modules/globalize-compiler/bin/globalize-compiler.js:82:28)

How should I resolve this? The problem is that when using Globalize with the globalize-compiler and the webpack plugin, we are assuming that the locale passed to Globalize matches the CLDR data directory.

Any guidance would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions