Skip to content

Commit

Permalink
Fix #2933 - look by .Name first, then fall back to ISO
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwille committed Mar 26, 2023
1 parent 2ddab6c commit facf2f6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;

Expand Down Expand Up @@ -114,20 +115,27 @@ internal static string LookupLocalizedXmlDoc(string fileName)
return null;

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);
if (File.Exists(localizedXmlDocFile))
{
return localizedXmlDocFile;
}
Debug.WriteLine("Try find XMLDoc @" + localizedXmlDocFallbackFile);
if (File.Exists(localizedXmlDocFallbackFile))
{
return localizedXmlDocFallbackFile;
}
Debug.WriteLine("Try find XMLDoc @" + xmlFileName);
if (File.Exists(xmlFileName))
{
return xmlFileName;
}
if (currentCulture != "en")
if (currentCulture.TwoLetterISOLanguageName != "en")
{
string englishXmlDocFile = GetLocalizedName(xmlFileName, "en");
Debug.WriteLine("Try find XMLDoc @" + englishXmlDocFile);
Expand Down

0 comments on commit facf2f6

Please sign in to comment.