There are many ways to realize WPF internationalization:
- You can use xaml resource files (*.xaml) to store content displayed in various languages. I have introduced it in another number:
- Universal resource files (*.resx) can also be used. This method is not limited to project templates and can be applied to other project types. C/S, B/S, App(Xamarin), etc. can be used.
本文不是要介绍怎样实现项目国际化,主要是介绍一款VS扩展程序,可方便的管理通用的资源文件(*.resx),比如下面这样:
Manage multiple resource files with ResX Manager

** Conveniently: **
- One interface lists all resource files for the entire solution
- International resource files of the same project can be managed by comparison with one interface
按多语言资源文件命名规则,相同前缀的资源文件,后缀(.resx 前的一小部分)区分不同语言,比如UiResource.zh-CN.resx为简体中文,UiResource.resx为默认语言,其他语言扩展只需要增加一个资源文件,修改后缀即可。
Compare the effect of directly opening resource files:
Default language resource file

Simplified Chinese resource file

There are only two files above that support more international languages. For every time a translation or modification is added, you have to double-click all resource files. How tiring would it be?
Simply laying the groundwork, let's talk about how to install the plug-in and how to use it.
1 is mounted
请到 ResXManager 发布地址下载安装:

或者VS扩展中搜索ResX Manager安装:

2 Function description
2.1 Unified management and modification of various resource documents
见本文第一张图(来自乐趣课堂 WPF 项目资源文件),左侧展示解决方案中所有工程的资源文件结构、位置,选择某资源文件后,右侧展示资源文件中的键及键对应的各语言翻译文字,同一名命名规则的资源文件可同时进行编辑。
2.2 check for missing
如下图,Search和StartTime键对应的中文缺少翻译,输入框有红色背景提示,此时可直接进行即时输入翻译。
Missing translation mark

如果键较多,或者支持的语言较多,可点击下面的翻译切换,一般我在上面这里就直接修改了,下面的这个界面我很少操作:
- 切换
翻译Tab - Enter untranslated language
- Click Start and Apply All to apply the modified translation to the corresponding resource file
Clearly display the language to be translated

2.3 Exporting and importing Excel files
当多语言翻译工作量较大,或者某一语言需要专业人士协助,让别人使用Visual Studio来编辑资源文件是不太合理的,这时使用导出功能将指定的资源文件导出为 Excel 格式,直接填写缺漏部分,再将完善的 Excel 文件导入自动更新各资源文件。

也可以选择需要翻译的资源文件对应的键,选择导出所选,导出文件如下,红框处为刚输入的简体中文翻译文。

As shown in the figure above, after completing the translation, you can select import.
Is this extension convenient? Welcome to leave messages and exchanges.