Add Translation Strings (runbook)
Any user-facing string must be a TranslationString and reflected in English.xlf. Follow in order.
Steps
- Add/edit the string in the right place:
- A form/control literal → declare a
private readonly TranslationString _x = new("...");on theTranslate-derived class, or edit the control's designer text. - A shared/common literal → add to TranslatedStrings.cs.
- Use
SmartFormatplaceholders for plurals (e.g."{0:item|items}").
- A form/control literal → declare a
- Build first:
dotnet build /v:qmust succeed (the generator reflects over the built assemblies). - Regenerate the catalog: run from the repo root:
This runs.\update-loc.cmdTranslationApp, regenerates English.xlf, and stages it. - Commit together: include the regenerated
English.xlfin the same commit as the code change.
Verify
git statusshowsEnglish.xlfstaged/updated.- The new string appears in
English.xlf.
STOP conditions / hard rules
- NEVER hand-edit any
.xlffile — they are generated. - Do not wrap non-UI strings (logs, internal exceptions) as
TranslationString. - If you skip
update-loc.cmd, CI will fail on a staleEnglish.xlf.
Background: translation-system.