淡蓝色配什么颜色好看| 文科和理科有什么区别| 裸睡有什么好处| 朋友妻不可欺是什么意思| 遗精是什么原因引起的| 陌上花开可缓缓归矣什么意思| 先兆临产是什么意思| 痔疮是什么原因引起| 什么太阳| 西安有什么| 左卵巢内囊性结构什么意思| 甲功不正常有什么表现| 吃醪糟有什么好处| 脑血栓不能吃什么水果| 三尖瓣少量反流是什么意思| 男属龙和什么属相最配| 八字中的印是什么意思| 肝郁气滞吃什么中成药| 头晕冒冷汗是什么原因| air是什么牌子| 偏光眼镜是什么意思| 人流后吃什么恢复快| 剖腹产后能吃什么水果| 冠心病是什么病| 范畴的意思是什么| 试孕纸什么时候测最准| 乙木的根是什么| 怎么查自己五行缺什么| 梦见自己升职了是什么预兆| 小肚右边疼是什么原因| 月经淋漓不尽什么原因| 吃什么可以补充雌激素| 石英岩玉是什么| 甲状腺球蛋白低是什么意思| 来例假可以吃什么水果| 农历2月份是什么星座| cpi是什么意思啊| 郁结是什么意思| hla一b27阳性是什么意思| 喝什么睡眠效果最好| 日语亚麻得是什么意思| 龄字五行属什么| 11月份是什么星座的| 脖子上长小肉疙瘩是什么原因| 脚冰凉是什么原因| 辟谷吃什么| 抄手是什么| 血脂六项包括什么| 胰腺在人体什么部位| 惊雷是什么意思| 下眼皮肿是什么原因| 劲酒加什么好喝| 娃娃脸是什么意思| 无所不用其极是什么意思| 梦见自己吃肉是什么预兆| 02年属马的是什么命| 疟疾病是什么病| 死鱼眼是什么样子的| 笼中鸟是什么意思| 吐痰带血丝是什么原因| 夏字五行属什么| 乙肝检查挂什么科| 什么的水| 小孩拉肚子吃什么药| 又什么又什么的草地| 塞屁股的退烧药叫什么| 挚爱适合用在什么人| 补充公积金是什么意思| 呕吐挂什么科| 卵泡期什么意思| 疱疹是什么症状| 娇兰属于什么档次| 一见倾心什么意思| 7大营养素是什么| 体癣用什么药膏好得快| 蛇最怕什么药| 为什么脖子老是痒| 加湿器加什么水最好| 血糖高什么水果可以吃| 嫐什么意思| 月亮发红是什么原因| 什么属于轻微糖尿病| 肖战是什么星座| 类风湿有什么症状| 慈禧和溥仪是什么关系| 娇兰属于什么档次| 什么的歌| 双侧肋膈角锐利是什么意思| 总是放屁是什么原因引起的| 海市蜃楼为什么可怕| 夏季有什么水果| 同妻是什么意思| 主管是什么级别| 月经黑红色是什么原因| 梦见自己刷牙是什么意思| 天蝎座跟什么星座最配| 紫色加绿色是什么颜色| 什么来钱快| eb病毒是什么病毒| 什么争什么斗| 胶原蛋白是什么意思| 隐翅虫皮炎用什么药| 文采是什么意思| 藏红花什么时候喝最好| 什么是零和博弈| 什么是春天的什么| 右肝钙化灶是什么意思| 乳房胀痛挂什么科| 为什么手指会发麻| 眷属是什么意思| 献完血应该注意什么| 食之无味什么意思| 梦见抓龙虾是什么意思| 喝椰子水有什么好处| 子宫脱落是什么原因引起的| 睡眠不好吃什么中成药| 盆底肌是什么| 热淋是什么病| 束带是什么| 脸痒是什么原因| 梦见老鼠是什么意思| 非钙化斑块是什么意思| 放生是什么意思| 什么书在书店买不到| 宝宝消化不良吃什么药| 后脑勺发麻是什么原因| 耳朵上长痘痘什么原因| 女人吃知了有什么好处| od什么意思| 脚上长疣是什么原因| 为什么会有甲状腺结节| 阳虚是什么| 晟这个字念什么| 总胆固醇高忌口什么| 什么粮食| 1943年属什么生肖| c14和c13有什么区别| 2月13号是什么星座| 手麻木吃什么药好| experiment是什么意思| 珍珠米是什么米| 肝癌晚期什么症状| 什么是抗性淀粉| 为什么会喜欢一个人| 桃花什么季节开| 无机磷测定是检查什么| 舌头凉凉的是什么原因| 喉癌是什么原因引起的| 上午右眼皮跳什么预兆| 放生鱼有什么好处| 为什么一直口渴| 霉菌性阴道炎用什么药好得快| 老想睡觉是什么原因| 多囊卵巢综合征吃什么药| 茯苓的作用是什么| 强扭的瓜不甜什么意思| 睾丸痒是什么原因| 手机为什么会发热| 脚抽筋是什么原因引起的| camouflage什么意思| 嘴角周围长痘痘是什么原因| 中药为什么那么苦| 姨妈血是黑褐色是什么原因| 伤风败俗是什么意思| 天梭表什么档次| 逸夫是什么意思| 燕子吃什么食物| 百米12秒什么水平| 什么是甲母痣| 六月六日是什么节日| 奇异果是什么| 一直打嗝是什么原因引起的| 羊齿状结晶代表什么| 黄瓜敷脸有什么效果| 走花路是什么意思| 胎发什么时候剃最合适| 属马的贵人属相是什么| perry是什么意思| 绝对值是什么意思| 胆固醇偏高有什么危害| 为什么手脚冰凉还出汗| 腰间盘突出用什么药好| 蛋白粉什么时候吃最好| 男女双修是什么意思| 思伤脾是什么意思| 按摩手推是什么意思| 什么是潜规则| 谷草谷丙偏低代表什么| 唐塞是什么意思| 火靠念什么| 什么是996| 预判是什么意思| 咳嗽有痰吃什么药好得最快最有效| 天气热吃什么解暑| 雅诗兰黛属于什么档次| 6s管理内容是什么| 夏至为什么要吃面条| 降血脂吃什么食物| 1922年属什么生肖| 216是什么意思| 少许是什么意思| 小孩缺锌吃什么补的快| 血糖低什么症状| 免去职务是什么意思| 宫颈分离是什么意思| 二八佳人是什么意思| 纤维条索灶是什么意思| 意见是什么意思| 体细胞是什么| aq什么意思| 背后长疙瘩是什么原因| 蜂蜜水什么时候喝好| 白猫是什么品种| 母亲是o型血孩子是什么血型| 鼻子上长痘是什么原因| 糖尿病人吃什么| 郭晶晶什么学历| 维民所止什么意思| a4纸可以折什么| 12月21日什么星座| 故宫什么时候建的| 摸头杀是什么意思| 因应是什么意思| 胎儿永存左上腔静脉是什么意思| 盐酸安罗替尼胶囊主要治疗什么| 低密度脂蛋白偏高吃什么药| 手痛挂什么科| 斯里兰卡用什么货币| 腊肠炒什么好吃| 头发染什么颜色显皮肤白显年轻| 胃胀打嗝吃什么药| 兔和什么属相最配| 临床路径是什么意思| 上火有什么症状| 多吃蔬菜对身体有什么好处| 二狗子是什么意思| 6月18什么星座| 身份证末尾x代表什么| 美瞳是什么| 猫的偏旁叫什么| 碘伏遇到什么会变白| 93是什么意思| 疤痕增生是什么| 三花五罗都是什么鱼| 月经前一周是什么期| 小便带血什么原因| oz是什么单位| 血压低吃什么药见效快| 左肺上叶纤维灶是什么意思| 05是什么生肖| 牙膏属于什么类商品| 意念是什么意思| phoebe是什么意思| 伤口发炎用什么药| 沙门氏菌用什么药| 1450是什么意思| 莯字五行属什么| 鼻炎是什么症状| 胃酸吃什么可以缓解| 看到流星代表什么预兆| 柳丁是什么| 六月十七是什么星座| 经常掏耳朵有什么危害| 少校什么级别| 百度Jump to content

从叙利亚战场看未来战争模样

From mediawiki.org
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.
百度 2017年1月7日,由《环球时报》社、《生命时报》社、环球网联合主办的首届养老产业环球峰会暨2016年度中国养老产业网络评选发布典礼在人民日报社新媒体大厦举办,《环球时报》社总编辑胡锡进出席峰会并致欢迎辞。

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.
黄体期是什么时候 儿童办理护照需要什么材料 吃什么补精养肾 水嘴是什么 什么是西米
ipi是什么意思 北是什么生肖 环切手术是什么 橙色预警是什么级别 乾隆是什么朝代
鹦鹉为什么会学人说话 b型血和o型血生的孩子是什么血型 灵魂伴侣什么意思 虾皮是什么虾 狗咬到什么程度需要打针
腿脚肿是什么原因 梦到买房子是什么意思 右脸长痣代表什么意思 一箭双雕是什么意思 乌鸡白凤丸适合什么人吃
嫣然是什么意思hcv7jop7ns0r.cn hpv是什么意思clwhiglsz.com 失恋什么意思hcv8jop4ns2r.cn 为什么医生不建议献血小板hcv8jop3ns8r.cn 经期吃什么补气血hcv7jop5ns1r.cn
carrots是什么意思hcv8jop8ns6r.cn 什么带不能系hcv8jop4ns9r.cn 聚首一堂是指什么生肖hcv8jop8ns5r.cn 什么食物降血糖hcv8jop1ns3r.cn 脾胃虚弱吃什么食物补tiangongnft.com
说女人强势是什么意思hcv9jop5ns9r.cn 孕妇梦到蛇是什么意思hcv8jop3ns3r.cn sch是什么意思hcv7jop9ns9r.cn 睡觉脚抽筋是什么原因引起的beikeqingting.com 南通有什么大学hcv8jop7ns3r.cn
梦见捡到钱是什么征兆cl108k.com 耳朵里发炎用什么药好hcv7jop9ns7r.cn 身心交瘁什么意思hcv8jop9ns4r.cn 西凤酒属于什么香型hcv8jop5ns7r.cn 阴虚火旺有什么症状hcv9jop6ns4r.cn
百度