Browse Source

Fix #2933 - look by .Name first, then fall back to ISO

pull/2936/head
Christoph Wille 3 years ago
parent
commit
facf2f662b
  1. 14
      ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs

14
ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -114,20 +115,27 @@ namespace ICSharpCode.Decompiler.Documentation
return null; return null;
string xmlFileName = Path.ChangeExtension(fileName, ".xml"); string xmlFileName = Path.ChangeExtension(fileName, ".xml");
string currentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
string localizedXmlDocFile = GetLocalizedName(xmlFileName, currentCulture); CultureInfo currentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
string localizedXmlDocFile = GetLocalizedName(xmlFileName, currentCulture.Name);
string localizedXmlDocFallbackFile = GetLocalizedName(xmlFileName, currentCulture.TwoLetterISOLanguageName);
Debug.WriteLine("Try find XMLDoc @" + localizedXmlDocFile); Debug.WriteLine("Try find XMLDoc @" + localizedXmlDocFile);
if (File.Exists(localizedXmlDocFile)) if (File.Exists(localizedXmlDocFile))
{ {
return localizedXmlDocFile; return localizedXmlDocFile;
} }
Debug.WriteLine("Try find XMLDoc @" + localizedXmlDocFallbackFile);
if (File.Exists(localizedXmlDocFallbackFile))
{
return localizedXmlDocFallbackFile;
}
Debug.WriteLine("Try find XMLDoc @" + xmlFileName); Debug.WriteLine("Try find XMLDoc @" + xmlFileName);
if (File.Exists(xmlFileName)) if (File.Exists(xmlFileName))
{ {
return xmlFileName; return xmlFileName;
} }
if (currentCulture != "en") if (currentCulture.TwoLetterISOLanguageName != "en")
{ {
string englishXmlDocFile = GetLocalizedName(xmlFileName, "en"); string englishXmlDocFile = GetLocalizedName(xmlFileName, "en");
Debug.WriteLine("Try find XMLDoc @" + englishXmlDocFile); Debug.WriteLine("Try find XMLDoc @" + englishXmlDocFile);

Loading…
Cancel
Save