Frage

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?

War es hilfreich?

Lösung

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).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top