马克笔什么牌子好| 晨僵是什么症状| vpc是什么| 什么是逆向思维| 预拌粉是什么东西| 凯子和马子是什么意思| 天生一对成伴侣是什么生肖| 34属什么| 麝香是什么东西| 牙齿酸软是什么原因| 血糖高吃什么食物最好最佳| 无的放矢什么意思| 钙过量会有什么症状| 胃酸反流吃什么药| 大便拉不出来是什么原因| 癸卯是什么意思| 阴中求阳是什么意思| 长期服用二甲双胍有什么副作用| 粘米是什么米| 检查肠胃挂什么科| 铅华是什么意思| 吃饭后胃疼是什么原因| 头痛是什么原因造成的| 吸顶灯什么牌子的好| afar是什么意思| 肚子痛吃什么药好| 大便干燥用什么药| 美业是什么| 被隐翅虫咬了用什么药| 鼻窦炎有什么特效药| 月经粉红色是什么原因| 芦荟有什么作用| 五行属什么怎么看| 鲱鱼为什么那么臭| 4是什么意思| 脚麻是什么原因造成的| 植入是什么意思| 今年28岁属什么生肖| 女人吃桃子有什么好处和坏处| ur是什么| 985代表什么意思| 六爻小说讲的什么| 不见棺材不落泪是什么生肖| 大腿肌肉疼是什么原因| 五行代表什么| 打哈哈是什么意思| 蛋白粉有什么营养| 九九重阳节是什么意思| 提肛运动有什么好处| 内眼角越揉越痒用什么眼药水| 眼底出血有什么症状| 鲁肃的性格特点是什么| 手术后不能吃什么| 司马懿字什么| 肛瘘不治疗有什么后果| 打呼噜挂什么科| 瞳字五行属什么| 肾结石吃什么好| 牙龈肿痛吃什么水果| 大便暗红色是什么原因| 什么水果补血效果最好| 总胆固醇低是什么原因| 什么是滑档| 老人头发由白变黑是什么原因| 总胆固醇高有什么症状| 牛肉炒什么| 蜜蜂是什么生肖| essence是什么意思| 孕妇头疼可以吃什么药| 血糖高能吃什么肉| 脑梗是什么病| 玻璃人是什么意思| 天蝎什么象| 癞蛤蟆吃什么| 尿臭是什么病| 射手座和什么座最配| 一月10号是什么星座| 老年人尿血是什么原因| 矜贵是什么意思| 谁的尾巴有什么作用| 补办身份证需要带什么| 耳后有痣代表什么| 甜醋是什么醋| 小腹隐隐作痛是什么原因女性| 梦见吃核桃是什么意思| 开水烫伤用什么药膏好得快| 榆钱是榆树的什么| showroom是什么意思| 大悲咒是什么意思| 囊性占位是什么意思| 什么是公历年份| 屮艸芔茻什么意思| 手机越狱什么意思| 内分泌科属于什么科| 妃子是什么意思| 眼镜轴位是什么意思| 射手座和什么座最配对| 做亲子鉴定需要什么东西| 一岁宝宝发烧吃什么药| 绯闻是什么意思| 白里透红的透是什么意思| 女人吃什么排卵最快| 胎位loa是什么位置| 拍胸片挂什么科室| camel是什么意思| 女生不来大姨妈是什么原因| 吃香菜有什么好处| 手足口病用什么药最好| 骨密度增高是什么意思| 川军为什么那么出名| 少字五行属什么| 什么时候绝经| 仓鼠用什么洗澡| acc是什么| 粘膜慢性炎是什么意思| 狗狗发烧吃什么药| 办理健康证需要带什么| 一生一世是什么意思| 油蜡皮是什么皮| 倒签是什么意思| 心脏不好吃什么药最好| 干燥综合症吃什么药| 瞧不起是什么意思| 促排药什么时候开始吃| hmo是什么| 偶是什么意思| 为什么掉发严重| 鳞状上皮乳头状瘤是什么| 七月八号是什么星座| 红细胞计数偏高是什么意思| 霉菌性阴道炎有什么症状| 眼袋浮肿什么原因| 火疖子是什么引起的| 第二性征是什么意思| 什么牌子的辅酶q10好| 早泄是什么| 什么是肾功能不全| 身主天相是什么意思| 胃寒吃点什么药| 七月二十二什么日子| 为什么要做羊水穿刺检查| bliss是什么意思| 有龙则灵的灵是什么意思| 什么样的梦想| 红艳艳的什么| 世界上有什么| 梦见狼是什么意思| 右眼跳是什么原因| 傲气是什么意思| pr是什么意思| 什么水果补钾| 逼格是什么意思| 胸闷气短吃什么药| 盆腔积液是什么意思| 痣的位置代表什么| 停车坐爱枫林晚中的坐是什么意思| 属猴本命佛是什么佛| 做肌电图挂什么科| 牛筋面是什么做的| 黄瓜炒什么菜好吃| 眼底出血是什么症状| 湿热内蕴证有什么症状| 办理公证需要什么材料| 手掌麻是什么原因引起的| 节瓜是什么瓜| 李元霸为什么怕罗士信| 台湾为什么叫4v| 早上起来流鼻血是什么原因| 胆红素三个指标都高是什么原因| 苏慧伦为什么不老| 后壁和前壁有什么区别| 真五行属什么| 男生生理期是什么表现| 尿液白细胞高是什么原因| 2023属什么生肖| 脾虚要吃什么东西调理| 乳痈是什么意思| 这什么意思| acg文化是什么意思| 治疗早泄吃什么药| 什么是扬州瘦马| 女人阴虚是什么意思| 脂肪液化是什么意思| 总胆固醇高吃什么药| 西元前是什么意思| 完全性右束支传导阻滞是什么意思| 肩膀上有痣代表什么| 早晨5点是什么时辰| 小猫踩奶是什么意思| 什么是有意义的东西| 两拐是什么军衔| ais是什么意思| 贫血会引起什么症状| 什么生活| 吃什么排湿气| 泮是什么意思| 有血尿是什么原因| 什么是胃溃疡| 后羿射日什么意思| 日值上朔是什么意思| 什么是肝炎| 狂鸟读什么| 肺纤维化是什么意思| 1970年属狗的是什么命| 羊水少了对宝宝有什么影响| 摩羯后面是什么星座| 女人血虚吃什么补最快| 痛风吃什么药效果最好| 吃维生素c片有什么好处| 玉是什么结构的字| 什么好像什么造句| 阴阴阳是什么卦| 上火喝什么比较好| 大肠埃希菌是什么病| 什么东西越吃越饿| 2016年是什么生肖| kids是什么意思| 心眼小是什么意思| 九月十三号是什么星座| 脉搏强劲有力代表什么| 紫砂壶适合泡什么茶| 小孩子发烧手脚冰凉是什么原因| 黄芪和什么搭配不上火| 宫颈萎缩意味着什么| 慢性肾炎吃什么药| 头发打结是什么原因| 肠上皮化生是什么意思| 阿米巴病是什么病| 头发粗硬是什么原因| 梦见掉牙齿是什么征兆| 神经衰弱吃什么药最好| 什么快递比较快| cold是什么意思| 免疫球蛋白适合什么人| 血糖高喝酒有什么影响| 翡翠的五行属性是什么| 后壁和前壁有什么区别| 左边脸长痘痘是什么原因| 鞋子上eur是什么意思| 聪明反被聪明误是什么意思| 脑萎缩是什么原因| 腹泻可以吃什么| 偷什么东西不犯法| 举贤不避亲什么意思| 无限极是干什么的| 排卵期是指什么时候| 摇曳是什么意思| 猴跟什么生肖配对最好| 韩国是什么民族| 黑枸杞泡水后什么颜色| 梦见石榴是什么意思| 十一月三十是什么星座| 痔疮用什么药治最好效果最快| 无证之罪什么意思| 夜字五行属什么| 肠道感染是什么原因引起的| lee是什么牌子中文名| 心绞痛是什么原因引起的| 狗什么东西不能吃| 落英缤纷是什么意思| 什么时候普及高中义务教育| 掉头发什么原因| 1988是什么生肖| 肠炎不能吃什么东西| 百度

油菜花旅游热带动乡村振兴

Warning Warning: This is a beta feature and we're looking for feedback on how to improve it. There is a performance issue that should be addressed before we can do a wider roll-out.
百度 )多囊卵巢综合征的治疗周期较长,且多数患者受孕需求较为迫切,因此治疗时心理压力较大。

This page documents how to use Message Bundles in Lua modules with the Translate extension using the mw.ext.translate.messageBundle Lua library. Message bundles are structured collections of translatable key-value pairs stored in wiki pages using a JSON format. This approach makes it easier to manage interface strings in code, while allowing translators to localize content through the Special:Translate interface. The guide explains how to define, enable, and access these bundles from Lua, along with metadata options.

Background information

edit

Why translatable modules?

edit

Translatable modules is a project to define, implement, document, and deploy a framework to improve the ability to translate and share modules. The goal is for user interface strings (messages) in Scribunto modules on multilingual wiki sites, such as Wikidata and Commons, to be easily localized, similarly to core MediaWiki, extensions, and translatable pages.

Read more at Translatable modules.

What are message bundles?

edit

Message bundles contain strings in key-value JSON format that, representing a message group that can be translated. Each key represents a translation unit and the value is the translation unit source that can be translated.

Read more at Help:Extension:Translate/Message Bundles.

What is this project trying to do?

edit

We built message bundles to reduce the complexity around localization of Scribunto modules. Since Message bundles are JSON objects, they can be used to store translations that can then be queried and used in Scribunto modules.

This document describes a Lua module that is built into the Translate extension in order to provide Scribunto modules an API that they can use to query message bundles.

API reference

edit

Initialization

edit

To add message bundle support to the module, add this:

local tmb = require 'mw.ext.translate.messageBundle'

Message bundle object

edit

Creating a message bundle object to access the message bundle in the page MessageBundleDemoForever:

--- MessageBundleDemoForever is the name of the page containing the message bundle
local mb = tmb.new( "MessageBundleDemoForever" )

The argument can be a string or an mw.title object but it must be the name or title of a valid message bundle page. With this message bundle object, translations will be loaded in the page language, and if certain keys lack translations, fallback languages are loaded.

To load a particular language, you can pass the language code as the second parameter.

--- MessageBundleDemoForever is the name of the page containing the message bundle
local mb = tmb.new( "MessageBundleDemoForever", "es" )

Fields and methods

edit

The message bundle object has the following method(s):

  • t( key ): Returns translation loaded for a key in the message bundle as an mw.message object (mw.message documentation). Returns nil if a non-existent key is passed as parameter.
  • getAllTranslations(): Returns a table containing all the keys in the message bundle and their translations as strings.

Fallback language

edit

By default, fallback languages are loaded. For example, if you request translation for Brazilian Portuguese (pt-br), and certain keys in the message bundle don't have translations in Brazilian Portuguese, Portuguese (pt) translations will be loaded if present, and if those are missing too, then the source language strings will be loaded.

To create a message bundle object with only Brazilian Portuguese translations, without loading any fallback language:

local mb = tmb.newWithoutFallbacks( "MessageBundleDemoForever", "pt-br" )

Disabling fallback language loading improves performance. If loading of fallback languages is disabled, accessing translations for certain strings may return nil depending on whether they have been translated.

Use cases

edit

Given the following message bundle, in a page named MessageBundleDemoForever with the page content model set to Translatable message bundle,

{
  "@metadata": {
	"priorityLanguages": ["es", "it"]
	"description": "You can add an optional tip or note related to the prompt like this.",
  },
  "choice1": "a correct answer, $1",
  "choice2": "an incorrect answer",
  "choice3": "an incorrect answer",
  "choice4": "a correct answer",
  "choice5": "Another incorrect answer ...",
  "people-sent-messages": "$1 {{PLURAL:$1|person|people}} sent messages to $1 to congratulate {{GENDER:$1|him|her|them}} upon promotion to administrator"
}

A translation administrator should add the message bundle to an aggregate group.

Accessing translation for a key

edit

To access the translation for the key: problem.choiceresponse.checkboxgroup.choice.5 in the page language in which the module is loaded, the following code can be used:

-- Load the translations in the page language in which the module is loaded
local mb = mw.ext.translate.messageBundle.new( "MessageBundleDemoForever" )

-- Access the needed key
-- Assuming the page language where the template is used is English, prints:
-- a correct answer, John
mb:t( "choice1" ):params( 'John' )

Accessing translation for a key in a particular language

edit

To load translations in a specific language, Spanish in this case:

-- Load the translations for the message bundle in Spanish
local mb = mw.ext.translate.messageBundle.new( "MessageBundleDemoForever", "es" )

-- Access the needed key
-- Assuming the choice1 key is translated to Spanish, prints: 
-- ?Una respuesta correcta, John
mb:t( "choice1" ):params( 'John' );

Enabling/disabling fallback language loading

edit

By default, translations in the fallback language will be loaded. To disable loading language fallback:

-- Load the translations in the page language, but skip using fallbacks
local mb = mw.ext.translate.messageBundle.newWithoutFallbacks( "MessageBundleDemoForever", 'fr' )

-- Access the needed key, without loading any fallback translations
-- Assuming there are no translations in French, prints nothing
mb:t( "choice5" )

Using GENDER and PLURAL

edit

{{GENDER}} and {{PLURAL}} can be used in messages loaded into modules. However, they are not parsed by default, and they require preprocessing. In Lua code, it's done like this:

frame:preprocess(mb:t( "people-sent-messages" ):plain())

Calling frame:preprocess() ensures that {{GENDER}} and {{PLURAL}} are parsed. :plain() is necessary because by default, t() returns a table, and frame:preprocess() requires a string.

Future changes

edit
  1. The methods in the module do not provide additional information about the translations, such as the current state (fuzzy, normal, reviewed, etc.) or which fallback language is being used in case the translation is not available in the requested language. We will be adding additional methods to provide these features.
弢是什么意思 色拉油是什么 舌头胖大是什么原因 英五行属什么 肾结石的症状是什么
抗凝药是什么意思 有什么办法让男人死精 or什么意思 喝红糖水有什么好处和坏处 巾帼指什么
什么津乐道 美尼尔症是什么病 什么人容易得老年痴呆 鹦鹉能吃什么水果 打是什么意思
敲木鱼是什么意思 白绫是什么意思 嗜睡乏力没精神容易疲劳是什么原因 淼念什么 冰岛茶属于什么茶
什么是升华hcv9jop4ns4r.cn 吃维生素c有什么好处hcv8jop4ns5r.cn 马齿苋是什么hcv8jop2ns7r.cn 蹒跚什么意思hcv9jop0ns6r.cn 伤口消毒用什么好hcv8jop3ns7r.cn
双子座和什么座最配hcv8jop8ns2r.cn 脚痒用什么药hcv9jop0ns5r.cn 海参什么时间吃最好hkuteam.com 中医为什么下午不把脉hcv8jop6ns2r.cn opo是什么意思hcv8jop0ns2r.cn
药店为什么不让卖高锰酸钾hcv8jop5ns1r.cn 未土是什么土hcv8jop5ns5r.cn 什么是鸡胸hcv9jop3ns4r.cn 受凉拉肚子吃什么药hcv8jop2ns3r.cn 近亲结婚生的孩子会得什么病hcv8jop9ns0r.cn
hp感染是什么病hcv7jop6ns8r.cn 胃火大吃什么药效果好hcv9jop8ns1r.cn 包皮炎挂什么科hcv9jop0ns7r.cn 脑炎的后遗症是什么hcv8jop7ns5r.cn 佑是什么意思naasee.com
百度