全球化运行时生成的程序集
背景
项目会安装一些文件,其中包含定义 UserControl 的所有元素 - 一些用户源、用于设计器代码的 CodeCompileUnit 和 resx 文件。 在运行时,这些文件被编译成程序集,并且这些类由我们的主应用程序使用(程序集仅在必要时更新)。
问题
该项目必须全球化,作为该过程的一部分,需要提供这些文件的本地化版本。 两个选项是允许包含不同区域设置的附加 resx 文件(在同一文件中或作为附加并排文件),这些文件可以编译到主程序集的附属程序集中,或者提供每种受支持语言的每个完整文件,为受支持的语言编译适当的集。
- 有人还有其他值得考虑的选择吗?
- 我提出的任一解决方案可能存在哪些固有问题?
限制/免责声明
我知道情况不太理想,在某些领域可以做出更好的选择(例如从一开始就全球化),但在项目的此时点无法更改。 我感谢您提供的任何建议、解决方案或线索。 谢谢。
Background
A project installs some files that contain all the elements to define a UserControl - some user source, a CodeCompileUnit for designer code, and a resx file. At runtime, these files are compiled into an assembly and the classes are consumed by our main application (the assembly is only updated when necessary).
Question
The project has to be globalized and as part of that process, there is a need to provide localizations of these files. Two options are either to allow the inclusion of additional resx files for different locales (either within the same files or as additional side-by-side files) that can be compiled into a satellite assembly for the main assembly, or to provide a copy of each full file for each supported language, compiling the appropriate set for the language being supported.
- Does anyone have any other options that might be worth considering?
- What problems might be inherent in either of the solutions I've proposed?
Constraints/Disclaimer
I am aware that the scenario is less than ideal and that better choices could've been made in some areas (like globalizing from the start), but they cannot be changed at this point in the project. I appreciate any advice, solutions, or leads you can provide. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为每种文化创建单独的附属程序集。 这有两个好处:
即使“构建卫星程序集”的最后一部分是在运行时完成的(您可以在安装时完成吗?),您至少仍然可以获得第二个和第三个要点优势。 这也意味着,如果您确实采用更正常的方式来提供卫星组件(而不是在用户的盒子上构建它们),那么您将需要进行的更改更少。
如果我误解了这个问题,我很抱歉......
Create a separate satellite assembly for each culture. This has two benefits:
Even if the final part of "building the satellite assembly" is done at runtime (can you do it at install time instead?) you still get the second and third bullet advantages at least. It also means that if you ever do go the more normal route of supplying the satellite assemblies to start with (instead of building them on the user's box) you'll have less to change.
Apologies if I've misunderstood the question though...
如果您不打算在部署后添加其他语言(至少在没有软件更新的情况下),那么我倾向于将所有其他 RESX 文件编译到您包含的附属程序集中。 这样,一旦部署它们,用户就无法编辑它们。
If you're not planning on adding additional languages after deployment (at least not without a software update), then I'd favor compiling all the additional RESX files into a satellite assembly that you include. That way, they're not user editable once they're deployed.