>
>  I have a message dictionary in the form of
> {languageCode => message, ...}, and looking for a way to inject those
> messages into the message cache.


My immediate reaction was to suggest that you create wikipages of all the
messages. But I'm guessing this is for Zero and you can't have those
messages being changed?

Can you not just parse the messages yourself? About all that wfMessage
beyond the parser is giving you is the cache abstraction (which is mostly
overhead in your case, it sounds like you already have all the strings in
memory.)

~Matt Walker
Wikimedia Foundation
Fundraising Technology Team


On Mon, Apr 8, 2013 at 12:05 PM, Yuri Astrakhan <yastrak...@wikimedia.org>wrote:

> 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
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to