这是否是在 VSTO Word 插件中实现本地化的正确方法?目前我只遵循一种命名约定,在搜索资源文件时将当前文化附加到其末尾。我已经阅读了足够多的不同材料以至于感到困惑,其中一种方法是使用 Resgen.exe 然后使用 Al.exe 生成 .dll,但我不完全理解为什么要这样做,是为了能够在无需重新编译的情况下更新语言吗?
System.Resources.ResourceManager resMgr;
System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;
try
{
// somehow I feel this isn't how it was meant to be? but it works
resMgr = new System.Resources.ResourceManager("MyAddin.MyLocalisation." + ci, Assembly.GetExecutingAssembly());
string title = resMgr.GetString("MyTitle");
}