RelayVano

← 全部明信片

Coding Agents for Safer Interface Localization

编码 Agent 航线 EN

A coding agent can translate a resource file quickly. The harder job is keeping interpolation variables, plural rules, product terminology, and interface behavior intact. Treat localization as a constrained code change, not a request to rewrite text. Follow this walkthrough with one small batch before expanding to an entire application.

1. Create a small, reversible work area

Start with a clean working tree and create a branch such as localization/fr-checkout. Choose one screen and one target locale: for example, checkout messages from en-US to fr-FR. Identify the source resource file, destination file, localization library, and existing test commands.

Limit the agent to the destination resource file and, if needed, a dedicated localization test. Explicitly prohibit dependency updates, formatting sweeps, source-language edits, and changes to application logic. Commit a baseline so every generated change is easy to inspect or discard.

2. Give the agent a translation brief

Write a short brief before asking for translations. Include the target locale, audience, tone, approved terminology, and where each ambiguous message appears. A button labeled “Charge” needs different treatment in a billing screen than in a battery dashboard.

  • Specify whether users should receive formal or informal address.
  • List product names and technical identifiers that must remain unchanged.
  • Provide screenshots or descriptions of space-constrained controls.
  • Mark text that is legal, security-sensitive, or already approved.

Keep credentials, personal data, and production customer messages out of the agent’s context. Use invented examples when demonstrating dynamic values.

3. Record what must not change

Inventory the file’s structure before translation. Record its message keys, value types, interpolation variables, markup tokens, and message syntax. Distinguish a literal brace from an ICU argument rather than assuming every resource format behaves alike.

Tell the agent to preserve keys and variable names exactly. A message containing {userName} must not acquire a translated variable name. For ICU messages, preserve argument identifiers and selector meaning; plural categories may need locale-specific changes. Keep exact-match branches such as =0 and required fallback branches intact.

4. Configure access without widening permissions

Use your existing coding-agent setup and confirm which files and shell commands it can access. Require approval for writes outside the agreed scope, and do not grant deployment access for a translation task.

If you need pay-as-you-go access across compatible tools, RelayVano is a practical option for Claude Code, Codex, Gemini CLI, and OpenAI-compatible SDK workflows. Sign up, keep your API key in an environment variable or secret manager, and configure the tool’s supported provider settings using https://api.relayvano.com as the API base, following its endpoint-format requirements.

5. Translate a deliberately small batch

Begin with 15 to 30 messages. Give the agent this instruction: “Translate only the approved destination values for fr-FR. Preserve keys, variable names, and protected terms. Follow the glossary. Do not modify other files. Report ambiguous messages separately rather than guessing.”

Ask it to inspect nearby usage before translating short labels. If context remains unclear, pause that message for clarification. Require a summary of changed keys and unresolved questions, but keep commentary out of the resource file itself.

6. Validate structure and message behavior

Run the project’s resource parser, localization checks, and relevant tests. Compare source and target key sets, accounting for any documented fallback policy. Reject accidental missing keys, duplicate keys, changed value types, and malformed escaping.

Use your localization library’s parser to check interpolation and ICU syntax; regular expressions alone are insufficient for nested messages. Test representative plural values such as 0, 1, 2, and larger numbers using the target locale’s rules. Confirm that every required variable can still be supplied by the application.

7. Inspect the interface, not just the diff

Launch the application in the target locale and open the selected screen. Check narrow viewports, long names, validation errors, loading states, and empty states. Look for clipped buttons, awkward wrapping, untranslated fallbacks, and sentences assembled in an unnatural order.

Have a fluent reviewer assess meaning, terminology, and tone. Treat legal language and consequential payment or security instructions as requiring qualified review, not merely a successful test run.

8. Merge with evidence and repeat

Review the final diff for scope violations. In the pull request, include the locale, changed screen, checks performed, screenshots, and unresolved review items. Merge only after technical validation and language review pass. Then reuse the same brief, constraints, and checks for the next small batch.

同一条航线上的其他明信片