Can I use jquery.uls on a MediaWiki wiki to get a language code from the name of a language in English?

家住魔仙堡 提交于 2019-12-11 13:04:56

问题


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:


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.



来源:https://stackoverflow.com/questions/29485489/can-i-use-jquery-uls-on-a-mediawiki-wiki-to-get-a-language-code-from-the-name-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!