动态添加本地化文件 C#
我需要帮助来本地化我的 Wpf .net 3.5 应用程序。我将仅向我的客户提供 exe 文件,他将用该文件为他的用户创建安装程序。我的客户想要自己添加文件进行本地化。
本地化的一般方法是为每种语言创建 .resx 文件并在 CurrentUICulture 中设置语言。但由于他无法使用resgen工具创建资源文件,我想知道让他添加txt、excel、xml格式的文件进行本地化的最佳方法。
PS:读取流并分配密钥是唯一的方法吗?
I need a help in localizing my Wpf .net 3.5 application. I am going to give only the exe file to my cient with which he will create setup for his users. My client wants to add files for localization by himself.
The general method of localization is creating .resx files for each languages and set the language in CurrentUICulture. but since, he cant use resgen tool to create resource files, I want to know the best method to let him add files in txt,excel,xml format to make the localization.
PS: reading through stream and assigning the key is the only way?
如果您无法使用 resgen 工具,则最简单的方法是使用键值对的简单文本文件。如果你只使用简单的字符串,你应该使用这个。按照默认约定命名它们,并使用名称中的语言来标识要加载的正确文件,并自行编写一个自定义
resourceManager
,在启动时或按需加载这些文件到字典中以访问它们。编辑:
我对此进行了更多详细介绍...
希望这有帮助
If you cannot use the resgen Tool a simple textfile wit Key-Value Pairs would be the simplest way. And if you just staying with simple strings you should use just this. Name them after the default convention with the language in the name to identify to correct file to load and write yourself a custom
resourceManager
that load this files at startup or on demand into a Dictionary to access them.Edit:
I go a bit more in details about this...
Hope this helps