You can use mw.messages.set( { key: 'value', … } ) to set the message keys
that are used by mw.message() and mw.msg(). No need for
mw.loader.implement() (in fact, you should probably never call that
function at all).
This has no i18n support by itself, so you have to handle that part
yourself (either loading them from somewhere else or just keeping the
entire list in source code). A very simple practical example (with no
language fallback chain support, it just falls back to English):
var translations = {
en: {
'my-gadget-some-key': "My message"
},
pl: {
'my-gadget-some-key': "Moja wiadomość"
}
};
var userLanguage = mw.config.get( 'wgUserLanguage' );
mw.messages.set( translations[userLanguage] || translations.en );
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l