goog.locale: 类型错误: 无法读取未定义的属性'COUNTRY'



我在代码中使用"goog.locale.getlocalizedcountryname"函数从国家/地区代码(例如"en-US"(中获取本地化的完整国家/地区名称。

goog.locale.getLocalizedCountryName('en-US')  // Actual implementation contains variablename.

TypeError: Cannot read property 'COUNTRY' of undefined.

goog.locale.getResource('LocaleNameConstants', goog.locale.getLocale())

给出undefined(继续调试以找到这个(

我错过了什么?

http://docs.closure-library.googlecode.com/git/closure_goog_locale_locale.js.source.html#line161

此方法取决于goog.locale.LocaleNameConstants__ 可从http://go/js_locale_data获得。此方法的用户必须 为此添加依赖关系。

也:

https://groups.google.com/forum/#!topic/closure-library-discuss/1fQ-GmNmLgM

我们弃用了goog.locale包,转而使用goog.i18n 函数,不需要引用的神秘区域设置数据 在评论中(它只是一个充满翻译字符串的目录, 现在已经过时了(。

最新更新