Help:Extension:Translate/Insertables/zh

可翻译的字符串通常包含标记，在翻译中应按原样保留. 由于特殊字符是共通的，输入这种标记可能会很慢，而且很困难. 可插入的是一块标记，它作为一个按钮或其他界面元素呈现给翻译者. 点击这个按钮，就可以把这段标记插入到当前光标位置的翻译中.

每个信息组可以有一个. 这个-{zh-hans:类; zh-hant:類別;}-负责生成一个 的列表. 每个 都有三个部分：


 * 1) 要向用户显示的内容
 * 2) 在翻译中，在光标位置之前插入的内容或替换所选内容的内容.
 * 3) 在翻译中光标位置之后插入的内容

Translate extension comes with  built-in. Suggesters for other type of content can be found in the translatewiki.net git repository.



Configuration
Here's a sample configuration change in a YAML file,

Pre-provided / Bundled insertables
Following is a list of bundled insertables.

HtmlTagInsertablesSuggester
This insertable will display suggestion for any HTML tags found inside the source string.

For example:


 * Message: This linklink takes you to the home page.
 * Suggester displayed:

MediaWikiInsertablesSuggester
This insertable will display various suggestion for MediaWiki related wikitext messages. These include suggestion for,


 * Parameters like  which are present in API Help messages.
 * Suggestions for HTML tags.

NumericalParameterInsertablesSuggester
This insertable will display suggestions for numerical parameters such as,  , or

RegexInsertablesSuggester
This insertable is a general purpose insertable that can be used to display suggestions based on a custom regular expression.

Example:

Parameter description,


 * regex - The regex to use for identifying insertables. Mandatory.
 * display - What to show to the user. Not mandatory, defaults to matched value.
 * pre - What to insert before selection, or replace selection if  remains empty Not mandatory, defaults to matched value.
 * post - What to insert after selection. Not mandatory, defaults to matched value.

TranslatablePageInsertablesSuggester
Used primarily on translatable pages to provide suggester for variables like.

Adding a custom insertable
In case existing insertables are not sufficient to meet your requirements, it is possible to add custom insertables.

Here is an example about adding insertables support for existing file based message group: FreeCol. The YAML file has been trimmed for brevity. The newly added lines are highlighted.

FreeCol.yaml:

Suggester.php:

The parameters to Insertable are: