mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
Fixed: Displaying audio and subtitle languages in UI
(cherry picked from commit 139412284276479921632ee5ef1dabe76c5388b4) Rename LocalizationLanguageResource to avoid collision with LanguageResource (cherry picked from commit d2cd3f77169887086980feac3bab1f16301d189e)
This commit is contained in:
@@ -20,6 +20,7 @@ namespace NzbDrone.Core.Localization
|
||||
Dictionary<string, string> GetLocalizationDictionary();
|
||||
string GetLocalizedString(string phrase);
|
||||
string GetLocalizedString(string phrase, string language);
|
||||
string GetLanguageIdentifier();
|
||||
}
|
||||
|
||||
public class LocalizationService : ILocalizationService, IHandleAsync<ConfigSavedEvent>
|
||||
@@ -45,14 +46,14 @@ namespace NzbDrone.Core.Localization
|
||||
|
||||
public Dictionary<string, string> GetLocalizationDictionary()
|
||||
{
|
||||
var language = GetSetLanguageFileName();
|
||||
var language = GetLanguageFileName();
|
||||
|
||||
return GetLocalizationDictionary(language);
|
||||
}
|
||||
|
||||
public string GetLocalizedString(string phrase)
|
||||
{
|
||||
var language = GetSetLanguageFileName();
|
||||
var language = GetLanguageFileName();
|
||||
|
||||
return GetLocalizedString(phrase, language);
|
||||
}
|
||||
@@ -66,7 +67,7 @@ namespace NzbDrone.Core.Localization
|
||||
|
||||
if (language.IsNullOrWhiteSpace())
|
||||
{
|
||||
language = GetSetLanguageFileName();
|
||||
language = GetLanguageFileName();
|
||||
}
|
||||
|
||||
if (language == null)
|
||||
@@ -84,19 +85,24 @@ namespace NzbDrone.Core.Localization
|
||||
return phrase;
|
||||
}
|
||||
|
||||
private string GetSetLanguageFileName()
|
||||
public string GetLanguageIdentifier()
|
||||
{
|
||||
var isoLanguage = IsoLanguages.Get((Language)_configService.UILanguage);
|
||||
var language = isoLanguage.TwoLetterCode;
|
||||
|
||||
if (isoLanguage.CountryCode.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
language = string.Format("{0}_{1}", language, isoLanguage.CountryCode);
|
||||
language = $"{language}-{isoLanguage.CountryCode.ToUpperInvariant()}";
|
||||
}
|
||||
|
||||
return language;
|
||||
}
|
||||
|
||||
private string GetLanguageFileName()
|
||||
{
|
||||
return GetLanguageIdentifier().Replace("-", "_").ToLowerInvariant();
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetLocalizationDictionary(string language)
|
||||
{
|
||||
if (string.IsNullOrEmpty(language))
|
||||
|
||||
Reference in New Issue
Block a user