mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-15 13:16:49 +01:00
Address review comments
This commit is contained in:
@@ -93,8 +93,8 @@
|
||||
"TaskUpdatePluginsDescription": "Downloads and installs updates for plugins that are configured to update automatically.",
|
||||
"TaskCleanTranscode": "Clean Transcode Directory",
|
||||
"TaskCleanTranscodeDescription": "Deletes transcode files more than one day old.",
|
||||
"TasksRefreshChannels": "Refresh Channels",
|
||||
"TasksRefreshChannelsDescription": "Refreshes internet channel information.",
|
||||
"TaskRefreshChannels": "Refresh Channels",
|
||||
"TaskRefreshChannelsDescription": "Refreshes internet channel information.",
|
||||
"TaskDownloadMissingLyrics": "Download missing lyrics",
|
||||
"TaskDownloadMissingLyricsDescription": "Downloads lyrics for songs",
|
||||
"TaskDownloadMissingSubtitles": "Download missing subtitles",
|
||||
|
||||
@@ -77,22 +77,36 @@ namespace Emby.Server.Implementations.Localization
|
||||
var cultures = new List<CultureInfo>();
|
||||
foreach (var option in _localizationOptions)
|
||||
{
|
||||
// Resource files use underscores for some variants (e.g. es_419);
|
||||
// CultureInfo only accepts hyphenated BCP-47 codes.
|
||||
var code = option.Value.Replace('_', '-');
|
||||
try
|
||||
// Skip novelty codes (e.g. "pr" Pirate, "jbo" Lojban) that .NET cannot resolve.
|
||||
if (TryGetCultureInfo(option.Value, out var cultureInfo))
|
||||
{
|
||||
cultures.Add(CultureInfo.GetCultureInfo(code));
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
// Skip novelty codes (e.g. "pr" Pirate, "jbo" Lojban) that .NET cannot resolve.
|
||||
cultures.Add(cultureInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return cultures;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves a Jellyfin resource culture code (which may use underscores, e.g. <c>es_419</c>)
|
||||
/// to a <see cref="CultureInfo"/>. Returns <see langword="false"/> for codes .NET cannot resolve.
|
||||
/// </summary>
|
||||
private static bool TryGetCultureInfo(string cultureCode, [NotNullWhen(true)] out CultureInfo? cultureInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Resource files use underscores for some variants (e.g. es_419);
|
||||
// CultureInfo only accepts hyphenated BCP-47 codes.
|
||||
cultureInfo = CultureInfo.GetCultureInfo(cultureCode.Replace('_', '-'));
|
||||
return true;
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
cultureInfo = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnConfigurationUpdated(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is IServerConfigurationManager configManager)
|
||||
@@ -614,20 +628,10 @@ namespace Emby.Server.Implementations.Localization
|
||||
|
||||
private static string GetDisplayName(string cultureCode)
|
||||
{
|
||||
// Resource files use underscores for codes that .NET's CultureInfo doesn't accept directly (e.g. es_419).
|
||||
var lookup = cultureCode.Contains('_', StringComparison.Ordinal)
|
||||
? cultureCode.Replace('_', '-')
|
||||
// Custom/novelty codes like "pr" (Pirate) — fall back to code itself
|
||||
return TryGetCultureInfo(cultureCode, out var cultureInfo)
|
||||
? cultureInfo.NativeName
|
||||
: cultureCode;
|
||||
|
||||
try
|
||||
{
|
||||
return CultureInfo.GetCultureInfo(lookup).NativeName;
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
// Custom/novelty codes like "pr" (Pirate) — fall back to code itself
|
||||
return cultureCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -40,10 +40,10 @@ namespace Jellyfin.LiveTv.Channels
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => _localization.GetLocalizedString("TasksRefreshChannels");
|
||||
public string Name => _localization.GetLocalizedString("TaskRefreshChannels");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description => _localization.GetLocalizedString("TasksRefreshChannelsDescription");
|
||||
public string Description => _localization.GetLocalizedString("TaskRefreshChannelsDescription");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Category => _localization.GetLocalizedString("TasksChannelsCategory");
|
||||
|
||||
Reference in New Issue
Block a user