Can I use jquery.uls on a MediaWiki wiki to get a

2019-08-09 17:41发布

WikiMedia has a jquery plugin called jquery.uls (Universal Language Selector) for choosing a language in all kinds of fancy ways.

All MediaWiki sites seem to have it available to the JavaScript running on them via $.uls. There is documentation for the ULS extension but it seems to only concern itself with the server side and how an end user would interact with it.

I want to know if I can use it to obtain a mapping from the English name of a language (such as "Vietnamese") to the ISO 639 language code for that language (such as "vi").

I can't seem to find this in the docs or find a method that does this among the exposed interfaces. Is it there and I just can't see it?

1条回答
Juvenile、少年°
2楼-- · 2019-08-09 18:03

You can use mw.config.get('wgULSLanguages') to get an associative array where the keys are language codes and the values are language names in English.

Here there are other options you could use with this extension as well.

查看更多
登录 后发表回答