First note, don't use $wgLang; use getLanguage on the closest context you have (depends on where your code is).
Secondly, why do you have separate scripts for rtl/ltr? Writing two scripts that do the same thing sounds really weird when JS is itself a programming language.
You can get directionality information about the current language right out from the DOM.
document.documentElement.dir === 'rtl'
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
On 2016-06-09 7:27 PM, Tom wrote:
I would be grateful for some direction or an idea of where to look. I feel like I'm going in a circle with the resource module docs.
What I need to do is load a js module based on language direction in a skin. Ltr load a ltr.js, rtl direction load a rtl.js instead. Here is what I came up with, please let me know if there is a better way to do this.
if ( $GLOBALS['wgLang']->getDir() == 'rtl' ) { $out->addModules('skins.script-rtl.js'); } else { $out->addModules('skins.script-ltr.js'); }
Preliminary testing seems to work, is there a better or recommended way?
Thanks Tom
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l