2

我尝试使用以下代码从我的瑞典语 resx 中获取翻译,但它只会从我的默认 resx 中返回英文翻译。我在两个文件中都有完全相同的密钥的翻译。我从命令行 c# 程序调用它。谁知道为什么不翻译?

public String GetString(String resxPackageName, String xmlKey)
{            
    Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE", false);
    ResourceManager rm = new ResourceManager("MyPackage.CustomerPortal.Followup", this.GetType().Assembly);
    return rm.GetString("CurrentPriceTagTranslation");
}
4

1 回答 1

2

我认为如果你没有在GetString方法中指定一种文化,它将使用调用线程的CurrentUICulture,如果你改变它,一切都应该工作。

于 2012-10-30T08:22:05.567 回答