据我了解,WPF 中推荐的本地化方法是使用 LocBaml 工具将可本地化的项目提取到例如 csv 文件中,将项目翻译成所需的语言,并从此 csv 文件重新生成新的卫星程序集。 然而,从我的实验来看,这似乎与从 resources.resx 文件生成卫星程序集相冲突,因为两者都没有将资源组合到单个资源文件中,而是简单地覆盖任何现有的卫星程序集。
是否有推荐的方法(或者更好的是现有工具)来“合并” LocBaml /generate 的输出和在 resources.resx 文件上运行 resgen 的输出(默认情况下由 VS 在构建时完成)。 有人在解决同样的问题吗?
Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with the generation of satellite assemblies from resources.resx files since neither is combining the resources into the single resource file but simply override any existing satellite assembly.
Is there a recommended approach (or even better, an existing tool) for doing a "merge" of output from LocBaml /generate and the output of running resgen on a resources.resx file (which is by default done by VS on builds). Are anybody out there tackling the same issues?
发布评论
评论(3)
您必须手动执行此操作,从 LocBaml 生成 .resources,然后使用程序集链接器合并 Resx 和 BAML 资源。
该过程看起来像这样:(
批处理文件中的一行上的所有内容)。
您可以将上述内容放入为您的项目定制的批处理文件中。 请记住 LocBaml 必须与输出文件位于同一文件夹中。 您可以将其添加为构建后任务。
You have to manually do this generating .resources from LocBaml and then merging the Resx and BAML resources using the Assembly linker.
The process looks something like this:
(everything on one line in a batch file).
You can put the above in a batch file customized for your project. Remember LocBaml has to in the same folder as your output files. You can add this as a post build task.
我更喜欢使用 WPF 本地化扩展 项目,您可以在 codeplex 本地化我的 WPF 项目。
它允许您使用与 WinForms 相同的方法,并且比 LocBaml 更容易使用。
I prefer to use the WPF Localization Extension project that you can found on codeplex to localize my WPF project.
It lets you use the same approach than WinForms and is much easier to use than LocBaml.
用 Google 搜索了一下,发现此页面描述了使用 LocBaml 的几种方法,其中包含有关如何将 resources.resx 和 locbaml 生成的资源合并到单个文件中的非常详细的描述(使用 al.exe)。
使用 LocBaml 本地化 WPF
页面描述了使用 LocBaml 的三种方法,我一直在寻找方法 3 中的最后一步。顺便说一句,那篇文章中有很多好东西
Googled around a bit and found this page describing a few ways to use LocBaml which iuncludes a very detailed descripion on how to merge the resources.resx and locbaml generated resources into a single file (using al.exe).
Localizing WPF using LocBaml
The page describes three ways to use LocBaml and I was looking for the last step in approach 3. Lots of good stuff in that article by the way