我可以在MediaWiki Wiki上使用jquery.uls从英文名称中获取语言代码吗? [英] Can I use jquery.uls on a MediaWiki wiki to get a language code from the name of a language in English?

查看:91
本文介绍了我可以在MediaWiki Wiki上使用jquery.uls从英文名称中获取语言代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WikiMedia具有一个名为jquery.uls (通用语言选择器)的jquery插件,用于选择一种语言以各种花哨的方式.

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

所有MediaWiki网站似乎都可以通过$.uls在运行它们的JavaScript上使用它.有有关ULS扩展的文档,但它似乎只涉及服务器端本身,并且最终用户将如何与之交互.

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.

我想知道是否可以使用它来获取从一种语言的英语名称(例如越南")到该语言的ISO 639语言代码(例如"vi")的映射.

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?

推荐答案

您可以使用mw.config.get('wgULSLanguages')获取一个关联数组,其中键是语言代码,值是英语的语言名称.

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.

这篇关于我可以在MediaWiki Wiki上使用jquery.uls从英文名称中获取语言代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆