ICU 消息语法

Crowdin 支持 ICU 消息语法, 它用来帮助表达特定语言拼写、语法和翻译格式的微调。

以 ICU 消息语法格式化的字符串可以有不同类型的替换,称为参数。 每个参数都放在大括号内,并指定输入数据中的一个值。 在 Crowdin 中支持以下类型的参数:数字、日期、时间、选择和复数。

ICU Message Syntax in the Editor

ICU 语法参数总是高亮于 编辑器 中,以让您知道字符串的哪一部分不应该被翻译。 更改翻译中参数的位置以遵循目标语言中的自然词序。 还有预览模式,这将使您能看到翻译将如何在界面中显示,以确保所有可翻译元素都被翻译。

编辑器中的 ICU 语法标志

复数

Plural type is used to handle plural category variations, as each language has its own set of plural categories (for example, English has “one” and “other”, while Ukrainian has “one”, “few”, “many”, and “other”).

下面的短标签用于确定复数类别:

  • zero
  • one(单数)
  • two(双数)
  • few(数个)
  • many(如果他们有一个单独的类,也用作分数)
  • other(要求一般复数形式,如果语言只有单一形式也使用)

In the Editor, you don’t have to manually add or delete plural categories to the translations you are making. Just click Copy Source, and the source string will be copied to the translation field with the number of plural categories right for the current target language.

Read more about Language Plural Rules.

复数类型

Select Ordinal

The purpose of the select ordinal type is to choose output based on the ordinal pluralization rules (1st, 2nd, 3rd, etc.) of the current target language. It is very similar to the plural type, except the value is mapped to an ordinal plural category.

Select Ordinal type

选取

Select type is mostly used to represent the right gender-based inflections in the message.

Select type

数字

The purpose of the number type is to display different number values such as percentage, currency, and decimal numbers independently from the locale conventions for those. This enables adjustment of the message output to the number formats used in different locales. ICU Number Skeletons are also supported.

Number type

日期和时间

Date and time types show date and time values according to the formats preferred in the specified locales. These types can also have a style – extra information on how the value will be formatted. The following four styles can be used: short, medium, long, and full.

Date, Time types

符号错误

Syntax error detection significantly reduces confusion when translating strings with ICU Message syntax, as the platform automatically detects potential translation errors. 如果发现语法错误,您将会看到一个包含需要修复内容的通知。

Syntax error detected

另请参阅

本文是否有帮助?