localization - 如何为本地化创建和加载 resource.dll?
问题描述
我正在开发一个在运行时翻译菜单的功能。从下面的代码生成了一个dll,但我不知道如何使用它。我编译时已经嵌入了一些资源 dll 文件,它运行良好。
生成 *.resx 文件。
using (ResXResourceWriter writer = new ResXResourceWriter(fullPath)) { writer.AddResource("Key1", "Test1"); writer.AddResource("Key2", "Test2"); writer.AddResource("Key3", "Test3"); writer.Generate(); }
从 *.resx 生成 *.resource 文件。
ProcessStartInfo info1 = new ProcessStartInfo("ResGen.exe", fullPath) Process.Start(info1);
从 *.resource 生成 dll。
ProcessStartInfo info2 = new ProcessStartInfo("al.exe", $@"/t:lib /link:{path}{resourcefileName}.resources /culture:en /out:{resourcefilepath}.resources.dll"); Process.Start(info2);
现在,我怎样才能加载这个结果?
解决方案
推荐阅读
- java - Spring Junit在运行maven测试时无法加载applicationContext
- ruby - 捆绑安装错误
- c# - 从“wwwroot”之外的 Asp.net 核心 Web API 3.1 文件夹加载图像
- php - 出现错误:注意:尝试访问 null 类型值的数组偏移量
- python-3.x - Google Sheets API 中的竞争条件
- reactjs - 单个 Wordpress 插件中有多个 CRA?
- javascript - 根据条件使用反应路线
- gatsby - Gatsby GraphQL 是否需要括号?
- json - Yajra 数据表返回无效的 JSON 响应
- pdf - Dynamics 365 Operations 中的文件文档附件问题