Skip to content

feat(i18n): add Ukrainian language support - #782

Merged
ZGGSONG merged 1 commit into
STranslate:mainfrom
pasharm:feat/add-ukrainian-language
Sep 9, 2026
Merged

ZGGSONG merged 1 commit into
STranslate:mainfrom
pasharm:feat/add-ukrainian-language

Conversation

@pasharm

@pasharm pasharm commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

English

What

Adds a complete Ukrainian (uk) UI translation, following src/docs/i18n-internationalization.md step by step.

Step from the doc Done
1. Main dictionary Languages/uk.xaml, same keys as en.xaml ✅ 784 keys, identical key set and order
2. Register in AvailableLanguages (all three places) ✅ incl. the easily-missed GetSystemTranslation branch ("uk" => "Система")
3. Plugin files for every plugin ✅ 21 plugins × (uk.xaml + uk.json) = 42 files
4. Verification see below

Language code is the short form uk, matching the VS Code locale convention used by the project. Ukrainian is LTR, so no layout changes are needed.

Files

 src/STranslate/Languages/uk.xaml            | new, 784 keys
 src/STranslate/Core/Internationalization.cs | +3 lines
 src/docs/i18n-internationalization.md       | +1 line (language table)
 src/Plugins/*/Languages/uk.xaml, uk.json    | 42 new files

No .csproj changes: the existing globs (Languages\*.xaml in STranslate.csproj, Languages\*.* in every plugin project) already pick the new files up.

How the translation was produced

Same author and same method as the Russian translation in #770. Ukrainian is a separate language rather than a transliteration of Russian, so every value was translated and then re-read for false friends and calques, with the English and Chinese sources consulted wherever the wording is about what a setting actually does. Terminology is kept consistent across the main dictionary and all 21 plugin dictionaries (переклад / розпізнавання тексту / озвучення / словник / гарячі клавіші / буфер обміну / тайм-аут / проксі / плагін / сервіс / знімок екрана / поле введення / тека / журнали / налаштування), and the whole file was run through LanguageTool with the uk-UA profile.

Key names, comments and element order are taken from en.xaml unchanged. Verified mechanically against en.xaml: 784/784 keys, same set and same order; 17 
 in both files and 11 xml:space="preserve" in both; zero mismatches in {0}/{1}/{2} placeholders, compared key by key; zero Russian-only letters (ы/ъ/ё/э) anywhere in the 43 new translation files. The only 14 values left equal to the English ones are the intentionally untranslatable ones (HTTP, Socks5, Markdown, Latex, WebDav, numeric options, proxy host names).

Verification

Windows 10 x64, .NET SDK 10.0.400, on top of main @ 2a75118f:

  • dotnet build src/STranslate.slnx -c Debug — 0 errors;
  • dotnet test src/STranslate.slnx — 274/274 passing;
  • all 22 new resource dictionaries (main + 21 plugins) load through XamlReader.Load without errors, and the main one reports exactly 784 keys;
  • uk.xaml is copied to the output Languages/ folder by the existing glob;
  • every plugin's uk.xaml / uk.json has the same key set as its en counterpart.

Follow-up (not part of this PR)

While checking the language registry I noticed that src/STranslate/Languages/fa.xaml (added in #765) is not registered in AvailableLanguages, and fa is missing from the language table in src/docs/i18n-internationalization.md. As far as I can tell the Persian UI language therefore never appears in the language dropdown and the file is currently dead weight. That is a pre-existing issue unrelated to this PR, so it is left alone here — happy to send a one-line fix separately if you want it.


中文

内容

新增完整的乌克兰语(uk)界面翻译,严格按 src/docs/i18n-internationalization.md 的 Checklist 完成:

  1. Languages/uk.xaml:784 个 key,与 en.xaml 的 key 集合和顺序完全一致;
  2. AvailableLanguages 三处都已注册,包括最容易遗漏的 GetSystemTranslation 分支("uk" => "Система");
  3. 21 个官方插件全部补齐 uk.xaml + uk.json,共 42 个文件;
  4. 已在本机编译并通过测试验证。

语言代码用短码 uk。乌克兰语是从左到右书写,无需 RTL 相关改动。不涉及 .csproj 改动:Languages\*.xaml / Languages\*.* 通配符已自动包含新文件。

翻译方式

与 #770 的俄语翻译出自同一作者、同一方法。乌克兰语是独立语言而非俄语的转写:每条取值都重新翻译,并逐条排查与俄语的假朋友和直译痕迹;凡涉及「这个设置到底做什么」的措辞,都对照英文与中文原文确认。主程序词典与 21 个插件词典的术语保持统一,全文另经 LanguageTool 的 uk-UA 规则集校对。

key 名称、注释与元素顺序完全沿用 en.xaml。已机器校验:784/784 个 key,集合与顺序均一致;两个文件各有 17 处 
、11 处 xml:space="preserve";逐 key 比对 {0}/{1}/{2} 占位符,0 处不一致;43 个新翻译文件中不存在俄语专有字母(ы/ъ/ё/э)。仅 14 个取值与英文相同,均为本就不需要翻译的内容(HTTP、Socks5、Markdown、Latex、WebDav、数字选项、代理主机名)。

验证结果

Windows 10 x64、.NET SDK 10.0.400,在 main @ 2a75118f 之上:

  • dotnet build src/STranslate.slnx -c Debug 0 错误;
  • dotnet test src/STranslate.slnx 274/274 通过;
  • 22 个新增资源字典(主程序 + 21 个插件)均可被 XamlReader.Load 正常加载,主词典恰好 784 个 key;
  • uk.xaml 由既有通配符正确复制到输出目录的 Languages/;
  • 每个插件的 uk.xaml / uk.json 与其 en 版本 key 集合一致。

附带发现(不在本 PR 范围内)

src/STranslate/Languages/fa.xaml(#765 引入)并未在 AvailableLanguages 中注册,src/docs/i18n-internationalization.md 的语言表里也没有 fa。因此波斯语界面应该从未出现在语言下拉框中,该文件目前处于闲置状态。这是本 PR 之前就存在的问题,这里不做改动;如果需要,我可以另开一个 PR 补上这一行。

Adds a complete Ukrainian (`uk`) UI translation, following the checklist in
src/docs/i18n-internationalization.md:

- src/STranslate/Languages/uk.xaml: 784 keys, same key set and order as en.xaml
- AvailableLanguages: registered in all three places, including the
  GetSystemTranslation branch ("uk" => "Система")
- 21 plugins x (uk.xaml + uk.json) = 42 files
- language table in the i18n doc

No .csproj changes: the existing Languages globs pick the new files up.
Ukrainian is LTR, so no layout changes are needed.
@ZGGSONG
ZGGSONG merged commit fa64038 into STranslate:main Sep 9, 2026
pasharm added a commit to pasharm/STranslate that referenced this pull request Sep 9, 2026
`uk.xaml` was written against `main` @ `2a75118f`. Three commits that landed
while STranslate#782 was open added keys to every other language, but could not add them
to Ukrainian, because `uk.xaml` did not exist upstream yet:

- 8 keys in `src/STranslate/Languages/uk.xaml` — pinned image translation (STranslate#769)
  and the notification-only fallback for text selection;
- 78 keys in the Youdao plugin dictionary — the localized API error messages.

So Ukrainian users saw English text in those places: the missing keys resolve
through the English dictionaries, which stay merged for the whole session
(`LoadDefaultLanguage` loads every plugin's `en.xaml` and then clears
`_oldResources`, so `RemoveOldLanguageFiles` never takes them out). The one case
where the raw `No Translation for key ...` shows up is a plugin installed in the
current session: `LoadInstalledPluginLanguages` merges only the active language
for it until the next restart.

Both files are back to the `en.xaml` key set *and* order: 792/792 for the main
dictionary, 82/82 for the plugin, with the blank-line section breaks in the same
places, so each file is now line-for-line structurally identical to its
`en.xaml`. Insertions only, no existing line is touched.

Verified: `dotnet build -c Debug` 0 errors, `dotnet test` 296/296, every language
dictionary in the tree loads through `XamlReader.Load` with the same key count as
its `en.xaml` neighbour, and the new values pass LanguageTool with the `uk-UA`
profile with no remaining warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants