SlikelySubtags.json not loaded

时间秒杀一切 提交于 2021-02-10 07:39:07

问题


I use cldr and globalize libaries. And I read in docs that I need to load likelySubtags.json.
Maybe, it is due to my poor English but I can't get where I need to get these files? Or how to generate?
Just for example:

<script>
Globalize.load({
  main: {
    en: {
      ...
    }
  },
  supplemental: {
    likelySubtags: {
      ...
    },
    timeDate: {
      ...
    },
    weekData: {
      ...
    }
  }
});
</script>

As I understood it generates these JSONs. But that do I need to write instead of points?
Can anyone explain more clear?
Below the code that I need to use if it has any value:

<script type="text/javascript">
    $(function () {
        Globalize.locale('en');
        // Fix a date validation on the WebKit engine
        $.validator.methods.date = function (value, element) {
            return this.optional(element) || Globalize.parseDate(value, { skeleton: 'dd.MM.yyyy'});
        }
    });
</script>

P.S. Maybe, it's not difficult but I really can't get docs.

ADDED
This is an error that I get now:

Uncaught Error: E_MISSING_CLDR: Missing required CLDR content supplemental/likelySubtags.
at createError (globalize.js:105)
at validate (globalize.js:182)
at EventEmitter.validateCldr (globalize.js:204)
at EventEmitter.emitEvent (event.js:416)
at EventEmitter.aliasClosure [as trigger] (event.js:88)
at Cldr.get (event.js:572)
at validateLikelySubtags (globalize.js:337)
at Function.Globalize.locale (globalize.js:392)
at HTMLDocument. (Index:1892)
at mightThrow (jquery-3.1.1.js:3570)

Of course, I understand that I need to call Globalize.load() before using it but I don't know how.


回答1:


likelySubtags.json is a file from CLDR: https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/likelySubtags.json.

You can find the answer for your question at Globalize docs How do I get CLDR data:

How do I get CLDR data?

By downloading the JSON packages individually...

Unicode CLDR is available as JSON at https://github.com/unicode-cldr/ (after this json-packaging proposal took place). Please, read https://github.com/unicode-cldr/cldr-json for more information about packageorganization.

By using a package manager...

cldr-data can be used for convenience. It always downloads from the correct source.

Use npm npm install cldr-data or bower bower install cldr-data (detailed instructions). For more information, see:

  • https://github.com/rxaviers/cldr-data-npm
  • https://github.com/rxaviers/cldr-data-bower


来源:https://stackoverflow.com/questions/42155568/slikelysubtags-json-not-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!