On Friday, 8. April 2011 03:35:42 Purodha Blissenbach wrote: Krinkle wrote:
- Direction (Get which direction a language is, LTR or RTL). Handy
when constructing your <html> element:
<html dir="{$I18N->getDir()}" lang="{$I18N->getLang()}"
This is not enough. The use of fallback languages requiers the same functions to exist for each message, because its message text may be coming from the requested language or any of its fallback languages, or from English, or from the zxx pseudo language (n linguisitc content) if no message text exists, even not in English, and a message ey is returned. That means, it must be possible, to ask for the actual language/locale code and directionality of each message text returned.
One possible way to do that in one go would be to use an array return code and list() in PHP, such as:
list( $htmltext, $lang, $dir) = full_msg( ...); echo('<div lang="'.$lang.'" dir="'.$dir.'">'.$htmltext.'</div>');
If you're not interested in $dir, e.g. because you know your language and the fallbacks are all LTR, and English, and zxx are, too, you can use
list( $htmltext, $lang) = full_msg( ...);
etc.
So $I18N->msg('blabla') (or _('blabla') ) will return the "[blabla]" string.
Just to mention: MediaWiki uses "<blabla>" instead of "[blabla]" in these cases. I would not mind making it so,too, but also do not really care for full compability in this point.
Greetings - Purodha
toolserver-l@lists.wikimedia.org