diff --git a/src/NzbDrone.Core/Books/Calibre/Extensions.cs b/src/NzbDrone.Core/Books/Calibre/Extensions.cs index 9b3aa10a9..7c6435b4e 100644 --- a/src/NzbDrone.Core/Books/Calibre/Extensions.cs +++ b/src/NzbDrone.Core/Books/Calibre/Extensions.cs @@ -13,6 +13,31 @@ namespace NzbDrone.Core.Books.Calibre private static readonly Dictionary ByThree; private static readonly Dictionary NameMap; + // generated from https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt + public static readonly Dictionary 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 KnownLanguages { get; } static Extensions() @@ -74,6 +99,11 @@ namespace NzbDrone.Core.Books.Calibre { return raw; } + + if (BtoTmap.TryGetValue(raw, out var mapped)) + { + return mapped; + } } return NameMap.TryGetValue(raw, out var langByName) ? langByName : null;