i'm using the current release version 1.2.3 and would like to use the functionality described here: https://github.com/globalizejs/globalize/blob/6d3a5a57c56fd0afb93e20340905a435d1650341/doc/api/message/load-translation.md#example
I need to inherit translations to have a fallback culture for the case that a browser culture is not defined / initialized in my loadMessages method. For example:
Globalize.loadMessages({
root: { hello: "Hi!" },
de: { hello: "Moin!" }
});
This is what i expect:
Globalize( "de-DE" ).formatMessage( "hello" );
"Moin!"
Globalize( "fr" ).formatMessage( "hello" );
"Hi!" (fallback)
How can i realize this?
Short answer
It's missing
Globalize.loadMessages({fr: {}});. The empty message tells globalizefris a valid bundle.Longer answer
The documentation example works just fine. Note: Use v1.2.3 documentation here: https://github.com/globalizejs/globalize/blob/1.2.3/doc/api/message/load-messages.md
In order to test I did:
Then: