Синтаксис сообщений ICU

Crowdin Enterprise supports ICU Message syntax, which is used to help express the subtleties of language-specific spelling, grammar, and formatting in translations.

Strings formatted in the ICU Message syntax can have different types of replacements called arguments.
Each argument is enclosed in curly brackets and refers to a value in the input data. Arguments of the following types are supported in Crowdin Enterprise: number, date, time, select, and plural.

ICU Message Syntax in the Editor

ICU syntax arguments are always highlighted in the Editor, so you know which part of the string shouldn’t be translated. При этом можно изменять место аргумента в предложении; это поможет сохранить естественный порядок слов в переводе на целевом языке. Также доступен режим просмотра, который позволяет увидеть конечный вариант отображения переводов в пользовательском интерфейсе; это позволит точно проверить, что все переводимые элементы переведены.

Синтаксис сообщений 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.

Plural type

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. If a syntax error is found, you’ll see a notice with a suggestion of what of what needs to be fixed.

Syntax error detected

Полезная информация

Была ли эта статья полезной?