At the Localisation & Globalisation team at my company, we've decided to release an internal "test" locale (we called it xx-XX) to provide pseudo localisation for all other teams across. Since this locale is fictional there is no CLDR data for it. Our approach was to take es-ES and alter the data so that it acts as the new xx-XX locale.
During the process we've missed the likelySubtags object, meaning there was a mismatch
Passing this data into a Globalize.load() causes no errors, however, instantiating a new instance new Globalize(locale) throws TypeError: Cannot read property '0' of undefined. Note that what locale is above doesn't matter. Locales with already loaded valid data can no longer be used.
We've traced the error to this file in CLDRjs. The error is thrown on line 23. It looks like it stores the data in a global variable and never clears the state.
Expected outcome
An error to be thrown only once by the Globalize.load() call. Alternatively, errors to be throws only when Globalize is instantiated with the locale which data cannot be made sense of.
Impact
The service that observed the error is using Globalize in its backend. This means that after an internal user (xx-XX is only an internal locale, no end-user can request it) tested the new locale end-users using actual locales started seeing errors due to the recurring exception thrown for valid locales.
PS. We are happy to contribute a fix, we want to first get the opinion/proposition of the maintainers :)
What happened
At the Localisation & Globalisation team at my company, we've decided to release an internal "test" locale (we called it xx-XX) to provide pseudo localisation for all other teams across. Since this locale is fictional there is no CLDR data for it. Our approach was to take es-ES and alter the data so that it acts as the new xx-XX locale.
During the process we've missed the likelySubtags object, meaning there was a mismatch
The error
Passing this data into a
Globalize.load()
causes no errors, however, instantiating a new instancenew Globalize(locale)
throwsTypeError: Cannot read property '0' of undefined
. Note that whatlocale
is above doesn't matter. Locales with already loaded valid data can no longer be used.We've traced the error to this file in CLDRjs. The error is thrown on line 23. It looks like it stores the data in a global variable and never clears the state.
Expected outcome
An error to be thrown only once by the
Globalize.load()
call. Alternatively, errors to be throws only when Globalize is instantiated with the locale which data cannot be made sense of.Impact
The service that observed the error is using Globalize in its backend. This means that after an internal user (xx-XX is only an internal locale, no end-user can request it) tested the new locale end-users using actual locales started seeing errors due to the recurring exception thrown for valid locales.
PS. We are happy to contribute a fix, we want to first get the opinion/proposition of the maintainers :)