我有以下 C# 代码。由于我不会深入讨论的原因,这是本地化所需的方式。
我的问题是,我一生都无法弄清楚什么路径没有返回值。以下代码中没有其他错误:
ResourceManager ResMain = new ResourceManager("TorrentSched.Main", typeof(Main).Assembly);
/// <summary>Returns a localised string based on the Current UI Culture</summary>
public string Str(string Name)
{
Boolean StringNotFound = false;
switch(Thread.CurrentThread.CurrentUICulture.ToString())
{
case "en-GB":
switch(Name)
{
case "MinimizeToTray": return "Closing the program minimises it to the tray. To fully quit the program, right-click the icon in your tray and choose Exit.";
default: StringNotFound = true; break;
}
break;
default:
StringNotFound = true;
break;
}
if(StringNotFound)
{
StringNotFound = false;
switch(Name)
{
case "AppName": return ResMain.GetString("$this.Text");
case "MinimizeToTray": return "Closing the program minimizes it to the tray. To fully quit the program, right-click the icon in your tray and choose Exit.";
case "ReallyExit1": return "Do you really want to exit?";
case "ReallyExit2": return "Torrents will not be checked and downloaded until you launch the program again!";
default: return "String not found!";
}
}
}