diff --git a/docs/LOCALIZATION.md b/docs/LOCALIZATION.md new file mode 100644 index 0000000..9e077bd --- /dev/null +++ b/docs/LOCALIZATION.md @@ -0,0 +1,98 @@ +# Localization Guide + +OpenClaw Tray uses WinUI `.resw` resource files for localization. Windows automatically selects the correct language based on the OS locale — no user configuration needed. + +## Currently Supported Languages + +| Language | Locale | Resource File | +|----------|--------|---------------| +| English (US) | `en-us` | `Strings/en-us/Resources.resw` | +| Chinese (Simplified) | `zh-cn` | `Strings/zh-cn/Resources.resw` | + +## Adding a New Language + +1. **Copy the English resource file** as your starting point: + + ``` + src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw + ``` + +2. **Create a new folder** for your locale under `Strings/`: + + ``` + src/OpenClaw.Tray.WinUI/Strings//Resources.resw + ``` + + Use the standard BCP-47 locale tag in lowercase (e.g., `de-de`, `fr-fr`, `ja-jp`, `ko-kr`, `pt-br`, `es-es`). + +3. **Translate the `` elements** — do not change the `name` attributes. Each entry looks like: + + ```xml + + Save + + ``` + +4. **Keep format placeholders intact.** Some strings use `{0}`, `{1}`, etc. These must remain in the translation: + + ```xml + + Sessions ({0}) + + ``` + +5. **Do not translate resource key names** (the `name` attribute). Only translate `` content. + +6. **Submit a pull request** with just your new `Resources.resw` file. No code changes are needed — the build system automatically discovers new locale folders. + +## How It Works + +### XAML strings (automatic) +Elements with `x:Uid` attributes are automatically matched to resource keys: +```xml +