Relay365Multi-model API relay desk
← All desk bulletins
Field notes from the deskEN1 desk reads

Shift Note: Keep Translation Placeholders Intact

The sentence can change; the variable contract cannot

A translation task arrives with a small string: “Welcome back, {first_name}.” The words should change for the target language. The placeholder should not. Your application replaces {first_name} with a real value at runtime. If an AI changes it to {name}, translates its contents, or drops a brace, the result may display incorrectly or fail validation.

This is the basic rule for translating product copy with AI: let the model translate human language while preserving the parts your software depends on. A good workflow makes that boundary explicit, then checks it with code rather than trusting a fluent-looking answer.

Mark the parts that belong to the application

Placeholders come in several forms. You might see {count}, {{customer_name}}, %s, or a numbered token such as %1$s. Different formatting systems apply different rules, so identify the format before sending text for translation.

  • Named placeholders must keep their exact spelling and syntax, although their position may change to fit the target language.
  • Unnumbered positional placeholders, such as two %s tokens, need special care because changing their order can swap the values they display.
  • Message identifiers and output field names should remain unchanged so your application can find the translated text.
  • Product names and other protected terms should follow an explicit terminology list rather than being left to the model’s judgment.

Do not protect everything that looks technical automatically. A button labeled “Save” is translatable copy; a resource key such as settings.save_button is usually not. Keeping keys separate from values makes that distinction easier.

Give the model a narrow translation job

Start with a small batch and clear instructions. Specify the target language and locale, the intended audience, and where each string appears. “Short confirmation message after payment” gives the model more useful context than an unexplained sentence.

A practical instruction is: “Translate only the text values into the requested locale. Preserve resource keys and placeholder spelling exactly. Do not add or remove placeholders. Reorder named placeholders only when needed for natural grammar. Return only the requested structured output.”

Include a source string such as “Your order {order_id} ships on {ship_date}.” Identify both tokens as protected. If there is a character limit, state it, but do not let brevity override placeholder integrity. Ask the model to flag an impossible constraint instead of silently removing required content.

Treat the source copy as data, not as instructions. Delimit it clearly and keep translation rules separate, especially when strings come from user-generated content.

Check the result before it enters the release

For simple named placeholders, extract the tokens from both source and translation, then compare their names and occurrence counts. Comparing only unique names can miss a duplicated token. Also verify that every expected resource key is present and that the response can be parsed.

A regular expression can work for a narrowly defined placeholder format. It is not a universal solution. ICU messages, for example, can contain nested plural and select branches. Use a parser or validation tool for that message format, and account for the target locale’s plural rules. Valid translation may require different plural categories, not a literal copy of the source structure.

Reject failed outputs and report the specific mismatch for correction. Keep the original source available, and validate corrected output again. Finally, preview the strings in the interface: correct tokens do not guarantee readable buttons, natural wording, or sensible line breaks.

Use a relay to test models without changing the checks

If you want to compare translation candidates, Relay365 is a pay-as-you-go relay desk for multiple model families. You could test a small representative batch with Gemini 2.5 Flash, while keeping the same instructions and validation rules. Evaluate terminology, tone, and placeholder handling rather than assuming one successful sentence proves release readiness.

Relay365 works with OpenAI SDK clients; its API base is https://api.api365relay.com, with /v1 added for those clients. Create an account if that access pattern fits your workflow. Keep the release gate unchanged: automated format checks first, then human review of meaning and interface context.

Further desk bulletins

Curious how it runs on your own code? Sign up →