c# - 以编程方式查找 .resx 文件中是否存在替代翻译

标签 c# .net localization resx

我有一个项目在多个 .resx 文件中有翻译。

例如

  • Admin.resx
  • Admin.fr.resx
  • Admin.it.resx
  • Admin.de.resx

有谁知道以编程方式查明默认回退中存在的翻译是否存在于替代语言文件中的方法?

我希望这是有道理的!

最佳答案

这应该做你想做的。

public static bool StringExistsInCulture(string key, CultureInfo ci)
{
   ResourceManager resources = new ResourceManager(typeof(Admin));
   string defaultString = resources.GetString(key, CultureInfo.InvariantCulture);
   string transString = resources.GetString(key, ci);

   return (defaultString == transString);
}

关于c# - 以编程方式查找 .resx 文件中是否存在替代翻译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7742679/

相关文章:

xcode - 本地化 - 向 localizable.strings 文件添加其他语言

asp.net - 另一个项目中具有本地化资源的 Blazor 服务器大小

c# - 使用 AutoMapper 时如何忽略内部嵌套对象

c# - 在一个列表中查找不在另一个列表中的项目

c# - TFS 2010 : how to retrieve a deleted file?

c# - 为谷歌浏览器设置默认搜索引擎

.net - System.ComponentModel.CancelEventHandler 如何工作?我不明白什么是可取消事件?

c# - 他们有什么好的方法可以通过.NET 中的 C# 生成 XML 文件吗?

c# - 在按钮单击、回发问题上动态加载用户控件

c# - 本地化组名