Closed bryanforbes closed 6 years ago
I find it confusing that the first example shows fr
coming from /common
, but ar
and ar-JO
are loaded from /main
.
invalidate
, where do getCachedMessages
and setLocaleMessages
come from in their examples?package.json
" should be " the project's package.json
"@maier49 observeLocale
was recently changed to accept callbacks rather than observers, and the README has been updated accordingly.
@bryanforbes The i18n
function (from @dojo/i18n/i18n
) does not check message bundles for CLDR data. Users could add something like the following to the top of every bundle that needs ICU message formatting, but I would not recommend it:
import loadCldrData from '@dojo/i18n/cldr/load';
import likelySubtags from 'cldr-json/supplemental/likelySubtags';
import plurals from 'cldr-json/supplemental/plurals';
loadCldrData(likelySubtags);
loadCldrData(plurals);
export default {
locales: { /* ... */ },
messages: { /* ... */ }
}
However, we should probably add a note explaining that some of this heavy-lifted is handled by the build in Dojo 2 applications.
I think the first sentence should be moved after the code example. It would end up looking like this:
The locale bundles expose their messages on their default exports (in this case,
nls/fr/common
):Once the default bundle is in place, any locale-specific messages are loaded by passing the default bundle to the
i18n
function. Using the previous example as the default bundle, any locale-specific messages are loaded as follows:invalidate
come from in the example demonstrating that feature?systemLocale
andlocale
.cldr-json
. Something that shows pulling in the info into specific locale bundles:And then using
i18n()
to pull in the locale bundles and then runningloadCldrData()
on the key:getMessageFormatter
orformatMessage
? If so, should we show an example doing that?loadCldrData
again in the date and number formatting section.