문제

I am using `goog.locale.getlocalizedcountryname' function in my code to get localized full country names from country codes eg 'en-US'.

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

gives TypeError: Cannot read property 'COUNTRY' of undefined.

Also

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

gives undefined (went on debugging to find this)

What am I missing?

도움이 되었습니까?

해결책

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

This method depends on goog.locale.LocaleNameConstants__ available from http://go/js_locale_data. User of this method has to add dependency to this.

also:

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

We're deprecating the goog.locale package in favor of the goog.i18n functions, which don't require the mysterious locale data referenced in the comments (it's just a directory filled with translated strings, which is now obsolete).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top