1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-02-24 23:23:21 +00:00

Fixed: Grab correct translation on case sensitive file systems

This commit is contained in:
Qstick 2020-12-27 21:07:20 -05:00
parent 80a744eff5
commit f499e846d9

View file

@ -122,11 +122,17 @@ private async Task<Dictionary<string, string>> GetDictionary(string prefix, stri
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
var baseFilenamePath = Path.Combine(prefix, baseFilename);
var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0]));
var alternativeFilenamePath = Path.Combine(prefix, GetResourceFilename(culture));
await CopyInto(dictionary, baseFilenamePath).ConfigureAwait(false);
await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false);
if (culture.Contains("_"))
{
var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0]));
await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false);
}
await CopyInto(dictionary, alternativeFilenamePath).ConfigureAwait(false);
return dictionary;
@ -160,11 +166,11 @@ private async Task CopyInto(IDictionary<string, string> dictionary, string resou
private static string GetResourceFilename(string culture)
{
var parts = culture.Split('-');
var parts = culture.Split('_');
if (parts.Length == 2)
{
culture = parts[0].ToLowerInvariant() + "-" + parts[1].ToUpperInvariant();
culture = parts[0].ToLowerInvariant() + "_" + parts[1].ToUpperInvariant();
}
else
{