When translating an interface with AI, preserve variable names, argument types, and condition values, and adapt number forms to the target language. For ICU MessageFormat messages, one correct JSON object is not enough: you need to parse the inner string, verify the arguments, and render the message with different input values. The Russian version is especially illustrative: “1 item,” “2 items,” “5 items,” “21 item.”
This FAQ is for business app developers and localization editors who translate messages from English into Russian. It covers the classic ICU MessageFormat syntax used by FormatJS. i18next, printf, and MessageFormat 2 use a different contract; you cannot move examples into them without adapting them.
This material was prepared by the AI studio of Vladimir Lomtev. The documentation was reviewed on November 18, 2026. The fictional examples below were actually parsed and formatted locally: Node.js 22.23.5, intl-messageformat 12.2.0, ICU 78.3. The editors did not verify the model’s translation itself or the interface behavior in the browser. At the end, there is a section about the publisher’s services; there are no affiliate links.
Contents
- What should you give the AI besides the string itself?
- Can variable names and JSON keys be translated?
- Why aren’t English one and other enough for Russian?
- How is one different from =1, and why is =0 needed?
- Do shipped and cancelled inside select need to be translated?
- Why did the brackets disappear after translation, or why isn’t the argument being inserted?
- What should you put in the prompt, and does JSON Schema guarantee ICU integrity?
- How can you make sure the translation works, and what has already been verified here?
What should you give the AI besides the string itself?
Pass the full message, its identifier, where it is used, the source and target languages, and a description of the arguments. For example: cart.items — the item count label in the cart; count — a nonnegative integer number of items. For order.status describe the allowed statuses and the order number format. Then the model gets the context for translating “order” and “item,” and the developer gets explicit constraints for validating the result.
ICU MessageFormat is a message format where text appears alongside arguments in curly braces. A simple argument {orderId} inserts a value; plural selects a variant based on number and language, select — based on the condition value. ICU recommends passing the full message to the translator: separate fragments make word order and agreement harder to handle. ICU documentation on messages.
Suggested intake card for one message:
| Field | Example | Why it’s needed |
|---|---|---|
| Identifier | cart.items |
Return the translation to the correct place in the catalog |
| Context | Label next to the cart icon | Choose a short wording |
| Variable | count: integer, starting at zero |
Choose valid forms and test values |
| Source language | en |
Understand the source grammar |
| Target language | ru-RU |
Set up the formatter and Russian forms |
| Constraint | Keep the ID and argument name unchanged: count |
Keep the link to the code |
This is a suggested intake template for the team. Do not insert real personal data into it just for context: for names and numbers, fictional values are usually enough. If the task involves company terminology, it can be prepared separately using the DeepL glossary FAQ. A glossary helps with vocabulary; the ICU contract still has to be checked separately.
Can variable names and JSON keys be translated?
Keep variable names unchanged. If the code passes orderId, but the translation expects {orderNumber}, the substitution will not find the right argument. Values like the fictional number B-104 are supplied at runtime; the translator changes the surrounding phrase.
In the examples below, cart.items and order.status are message identifiers in an external JSON catalog. The formatting library receives the message string itself, and the application selects it by ID. Keep the catalog keys unchanged so the application can still find each message.
The word order in the sentence can be changed if Russian requires it. But matching the set of names does not yet prove correctness: an argument may end up in a different branch or lose its number format. FormatJS requires you to pass values for the arguments used in formatting. intl-messageformat contract.
For verification, compare three things: the keys in the source and target catalogs, the names and roles of the arguments inside each message, and then the actual substitution on examples. Searching for identical fragments with a regular expression does not provide a full parse of a nested ICU message.
Why aren’t English one and other enough for Russian?
In Russian, the choice of form for cardinal numbers depends on the category one, few, many or other. For example, 1 and 21 belong to one, 2 and 22 belong to few, 5 and 11 belong to many; fractional 1.5 belongs to other. These are language categories, not commands like “one” and “everything else.” Russian CLDR rules.
So the rule “translate the text, do not change the structure at all” is too strict for plural . In a Russian translation, you may need to add categories that do not exist in English. For the fictional cart, the source message is:
{count, plural, =0 {Your cart is empty} one {# item in your cart} other {# items in your cart}}
The localized catalog contains:
{
"cart.items": "{count, plural, =0 {The cart is empty} one {# item in the cart} few {# items in the cart} many {# items in the cart} other {# items in the cart}}",
"order.status": "{status, select, shipped {Order {orderId} has shipped} cancelled {Order {orderId} has been canceled} other {Order {orderId} is being processed}}"
}
The symbol # inside plural displays the number with local formatting. In FormatJS, the other branch is required. Adding target-language categories is different from changing argument names or business logic. Plural syntax in FormatJS.
A product counter usually does not have fractional values. In the example, the fractional branch is left in to show how other works; the allowed data type must be defined in the application. If you sell weight-based goods, the word forms should be matched to the unit of measure: kilograms and order line items describe different quantities.
How is one different from =1, and why do you need =0?
=1 checks for the exact number 1. The one category is defined by language rules and in Russian also applies to 21. Replacing one with =1 will leave other numbers in that category without the needed text. The exact-match branch =0 is useful for a separate “Your cart is empty” message and is chosen before the category-based option. Exact-match syntax is described in the plural section of the FormatJS documentation.
The table shows results from a local test of the message using the ru-RUlocale, with the Russian output shown in English for readability:
| count value | Number category | Message result |
|---|---|---|
| 0 | many, overridden by =0 |
The cart is empty |
| 1 | one |
There is 1 item in the cart |
| 2 | few |
There are 2 items in the cart |
| 5 | many |
There are 5 items in the cart |
| 11 | many |
There are 11 items in the cart |
| 21 | one |
21 items in the cart |
| 22 | few |
There are 22 items in the cart |
| 25 | many |
There are 25 items in the cart |
| 1.5 | other |
There are 1.5 items in the cart |
This test used a synthetic message. The editors checked the number category with Intl.PluralRules, and intl-messageformat was used for output. The runtime environment used CLDR 48.0 data; the current CLDR 50 table confirms the listed Russian categories.
If the source contains offset, do not remove it during translation. It changes the category calculation and the value of #; exact variants =n verify the original number. Such a pattern requires its own inputs, including offset boundaries. The simple table results apply to a message without offset. Description of complex ICU arguments.
Should shipped and cancelled inside select be translated?
No, if these are values passed by the application. The messages inside the branches are translated, while shipped, cancelled and the argument name status are preserved. The other branch takes values that do not have a separate variant; in FormatJS it is required. select rules.
For the above order.status local run produced the following results with orderId = B-104:
shipped→ "Order B-104 has been shipped";cancelled→ "Order B-104 has been cancelled";unknown→ "Order B-104 is being processed".
For a real application, the meaning of other must be defined by the process owner. If an unknown status means an integration error, the phrase "being processed" may mislead the customer. In that case, you need an agreed fallback text and separate handling for the unknown value. The phrase choice in the example does not define your order workflow rules.
If select contains a nested plural, check combinations of conditions and numbers. A successful output for the "shipped" branch does not confirm the correctness of the "cancelled" branch. You cannot mechanically require every branch in the source and translation to match exactly: plural categories are adapted to the language, and business plural rules vary by language, while the business values passed toselect must match the values used by the code.
Why did the parentheses disappear after translation, or why isn't the argument being substituted?
First check whether the argument was turned into literal text because of escaping. In classic ICU, syntax characters can be enclosed in ASCII apostrophes. For example, the string Enter '{name}' in the tested environment produced Enter {name} without substitution. That is appropriate for a syntax hint, but incorrect if the interface is supposed to show the user name.
Distinguish between the standard typographic apostrophe ’ and the syntactic '. Automatically replacing them during editing can change template behavior. The # inside pluralalso has special meaning; a literal hash sign requires context awareness. Escaping in ICU.
External JSON escaping is a separate layer. First, the file must be read correctly as JSON, then the extracted string must be read as an ICU message. A set of balanced curly braces by itself confirms neither contract. When searching for an error, preserve the original text and see exactly which layer raised the exception.
If the source material is a regular HTML page, use a different route: HTML translation with markup preservationHTML tags and ICU arguments require different handling rules; tag translation mode does not prove that pluralwas preserved.
What should you write in the prompt, and does JSON Schema guarantee ICU integrity?
In the prompt, list the allowed changes and the return-file contract. JSON Schema can constrain the outer structure of the response, but a string with invalid ICU syntax is still just a string. It must be checked with a separate message parser. FormatJS provides a parser that builds an AST — a tree of the argument and text structure. ICU parser documentation.
Suggested prompt for the editorial workflow:
Translate the message catalog from en to ru-RU.
String format: classic ICU MessageFormat, FormatJS implementation.
Preserve message IDs, argument names and types,
exact =n branches, select values, and offset, if present.
Adapt plural categories to Russian; keep other.
Translate full messages inside branches and account for context.
Do not add new arguments or business statuses.
Return a JSON object with the same keys, with no explanations.
If the context is insufficient, do not guess: raise the question separately
during preparation, before requesting the final JSON.
The prompt was suggested by the editors and was not tested on a model. Before requesting it, add context cards and the catalog itself; align questions separately, then ask for the final JSON. Even exact compliance with these instructions does not confirm that the text matches the button action, the legal meaning of the notice, or the width of the element.
When automating, compare the structure of parsed messages: required arguments, their types, exact numeric conditions, offset and business branches. For plural rules, allow consistent expansion for the target locale. Simple byte-for-byte equality of the trees will reject a valid Russian translation; comparing only the number of braces will miss a semantic error.
How do you make sure the translation works, and what has already been verified here?
Check the file, the messages, and their output in sequence. The file must be readable as JSON and preserve the expected identifiers. Each line must parse with the target ICU parser. Then render it with real argument types, the selected locale, and inputs that cover the branches. According to the intl-messageformat documentation, the string is parsed when the instance is created, and values are passed into format. Formatting order.
In local verification, the editorial team parsed four strings — two messages in English and two in Russian. For the Russian basket message, nine inputs from the table were run; for the status message, three inputs were run, including an unknown value. Literal braces with apostrophes were checked. It was also confirmed separately that the parser rejects plural without other, and formatting the selected branch with a missing orderId fails with an error. All of these checks passed in a single session on November 18, 2026.
The recommended product-level check is broader than a local run: show the translation on the target screen, verify line wrapping, truncation, accessible labels, and the link between the message and the action. A person should read all meaningful branches. The parser will not judge tone or notice that a cancellation string ended up on a successful payment screen.
The result is ready for the next stage when the catalog is readable, arguments and conditions are aligned, control values produce the expected phrases, and the screen has been tested in the app. The last point has not been completed here: the examples were not connected to the product, the LLM was not called, and the speed and quality of the automated translation were not measured.
How the studio helps connect translation with the app
Vladimir Lomtev’s AI studio handles data preparation, integrations, and testing of automated processes. In a localization task, this may include extracting translatable messages from an export, integrating the AI translation stage with a return flow into a draft catalog, and testing messages before loading them into the app. The specific library and verification method are determined by the project setup.
The first step is to choose one screen, collect its current catalog and sample inputs, define the constraints, and set the criterion for correct output. Discuss the project.
Bottom line: preserve the contract, adapt the grammar
To translate an interface with AI, separate immutable names and conditions from language-specific forms. In ICU MessageFormat, variables and business values select are tied to code, while plural must account for Russian grammar. Take one string with a number, test it with 0, 1, 2, 5, 11, and 21, then parse the remaining branches and show the result on the target screen.



