Hi, I need to use the localization framework - wfMessage() to translate my
own custom messages. I have a message dictionary in the form of
{languageCode => message, ...}, and looking for a way to inject those
messages into the message cache. The actual messages dictionary is stored
as a custom setting as part of a json blob, and cannot be added to the
regular $message['xx'] = '...'; for  translatewiki.  Thanks!

Usage scenario:

// Array is generated from an external source and will look like this:
$messageMap = array('en'=>'aaa', 'fr'=>'b {{SITENAME}} b', ...);

// Some magic method to add the entire message map into message cache
messageCache->Add('custom-key1', $messageMap);

// Process message
// Note that in case 'fr' is not defined, it should fallback using default
resolution rules.
$result = wfMessage('custom-key1')->inLanguage('fr')->text();
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to