SlikelySubtags.json 未加载
SlikelySubtags.json not loaded
我使用 cldr
和 globalize
库。我在 docs 中读到我需要加载 likelySubtags.json
.
也许是因为我的英语不好,但我找不到需要获取这些文件的地方?或者如何生成?
举个例子:
<script>
Globalize.load({
main: {
en: {
...
}
},
supplemental: {
likelySubtags: {
...
},
timeDate: {
...
},
weekData: {
...
}
}
});
</script>
据我了解,它会生成这些 JSON。但是我需要写那个而不是分数吗?
谁能解释的更清楚?
在我需要使用的代码下方,如果它有任何价值:
<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。也许,这并不难,但我真的无法获得文档。
已添加
这是我现在得到的错误:
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)
当然,我知道我需要在使用它之前调用Globalize.load()
,但我不知道如何。
likelySubtags.json
是来自 CLDR 的文件:https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/likelySubtags.json.
您可以在 Globalize 文档中找到问题的答案 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:
我使用 cldr
和 globalize
库。我在 docs 中读到我需要加载 likelySubtags.json
.
也许是因为我的英语不好,但我找不到需要获取这些文件的地方?或者如何生成?
举个例子:
<script>
Globalize.load({
main: {
en: {
...
}
},
supplemental: {
likelySubtags: {
...
},
timeDate: {
...
},
weekData: {
...
}
}
});
</script>
据我了解,它会生成这些 JSON。但是我需要写那个而不是分数吗?
谁能解释的更清楚?
在我需要使用的代码下方,如果它有任何价值:
<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。也许,这并不难,但我真的无法获得文档。
已添加
这是我现在得到的错误:
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)
当然,我知道我需要在使用它之前调用Globalize.load()
,但我不知道如何。
likelySubtags.json
是来自 CLDR 的文件:https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/likelySubtags.json.
您可以在 Globalize 文档中找到问题的答案 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 bowerbower install cldr-data
(detailed instructions). For more information, see: