mirror of
https://github.com/Readarr/Readarr
synced 2025-12-20 15:23:55 +01:00
Fixed: Account for ISO 639 B vs T
This commit is contained in:
parent
27259c1ebd
commit
07829a19b8
1 changed files with 30 additions and 0 deletions
|
|
@ -13,6 +13,31 @@ public static class Extensions
|
|||
private static readonly Dictionary<string, string> ByThree;
|
||||
private static readonly Dictionary<string, string> NameMap;
|
||||
|
||||
// generated from https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
|
||||
public static readonly Dictionary<string, string> BtoTmap = new ()
|
||||
{
|
||||
{ "alb", "sqi" },
|
||||
{ "arm", "hye" },
|
||||
{ "baq", "eus" },
|
||||
{ "bur", "mya" },
|
||||
{ "chi", "zho" },
|
||||
{ "cze", "ces" },
|
||||
{ "dut", "nld" },
|
||||
{ "fre", "fra" },
|
||||
{ "geo", "kat" },
|
||||
{ "ger", "deu" },
|
||||
{ "gre", "ell" },
|
||||
{ "ice", "isl" },
|
||||
{ "mac", "mkd" },
|
||||
{ "mao", "mri" },
|
||||
{ "may", "msa" },
|
||||
{ "per", "fas" },
|
||||
{ "rum", "ron" },
|
||||
{ "slo", "slk" },
|
||||
{ "tib", "bod" },
|
||||
{ "wel", "cym" }
|
||||
};
|
||||
|
||||
public static HashSet<string> KnownLanguages { get; }
|
||||
|
||||
static Extensions()
|
||||
|
|
@ -74,6 +99,11 @@ public static string CanonicalizeLanguage(this string raw)
|
|||
{
|
||||
return raw;
|
||||
}
|
||||
|
||||
if (BtoTmap.TryGetValue(raw, out var mapped))
|
||||
{
|
||||
return mapped;
|
||||
}
|
||||
}
|
||||
|
||||
return NameMap.TryGetValue(raw, out var langByName) ? langByName : null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue