@@ -1126,7 +1126,7 @@ toPolyglossiaEnv l =
11261126
11271127-- Takes a list of the constituents of a BCP 47 language code and
11281128-- converts it to a Polyglossia (language, options) tuple
1129−-- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf
1129+-- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf
11301130toPolyglossia :: [String] -> (String, String)
11311131toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
11321132toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
@@ -1154,18 +1154,21 @@ toPolyglossia ("en":"UK":_) = ("english", "variant=british")
11541154toPolyglossia ("en":"US":_) = ("english", "variant=american")
11551155toPolyglossia ("grc":_) = ("greek", "variant=ancient")
11561156toPolyglossia ("hsb":_) = ("usorbian", "")
1157−toPolyglossia ("la":"x-classic":_) = ("latin", "variant=classic")
1157+toPolyglossia ("la":"x":"classic":_) = ("latin", "variant=classic")
11581158toPolyglossia ("sl":_) = ("slovenian", "")
11591159toPolyglossia x = (commonFromBcp47 x, "")
11601160
11611161-- Takes a list of the constituents of a BCP 47 language code and
11621162-- converts it to a Babel language string.
1163−-- http://mirrors.concertpass.com/tex-archive/macros/latex/required/babel/base/babel.pdf
1164−-- Note that the PDF unfortunately does not contain a complete list of supported languages.
1163+-- http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf
1164+-- List of supported languages (slightly outdated):
1165+-- http://tug.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyphenation.pdf
11651166toBabel :: [String] -> String
11661167toBabel ("de":"1901":_) = "german"
11671168toBabel ("de":"AT":"1901":_) = "austrian"
11681169toBabel ("de":"AT":_) = "naustrian"
1170+toBabel ("de":"CH":"1901":_) = "swissgerman"
1171+toBabel ("de":"CH":_) = "nswissgerman"
11691172toBabel ("de":_) = "ngerman"
11701173toBabel ("dsb":_) = "lowersorbian"
11711174toBabel ("el":"polyton":_) = "polutonikogreek"
@@ -1179,7 +1182,7 @@ toBabel ("fr":"CA":_) = "canadien"
11791182toBabel ("fra":"aca":_) = "acadian"
11801183toBabel ("grc":_) = "polutonikogreek"
11811184toBabel ("hsb":_) = "uppersorbian"
1182−toBabel ("la":"x-classic":_) = "classiclatin"
1185+toBabel ("la":"x":"classic":_) = "classiclatin"
11831186toBabel ("sl":_) = "slovene"
11841187toBabel x = commonFromBcp47 x
11851188
@@ -1188,12 +1191,15 @@ toBabel x = commonFromBcp47 x
11881191-- https://tools.ietf.org/html/bcp47#section-2.1
11891192commonFromBcp47 :: [String] -> String
11901193commonFromBcp47 [] = ""
1191−commonFromBcp47 ("pt":"BR":_) = "brazilian"
1194+commonFromBcp47 ("pt":"BR":_) = "brazilian"
1195+commonFromBcp47 ("sr":"Cyrl":_) = "serbianc"
1196+commonFromBcp47 ("zh":"Latn":"pinyin":_) = "pinyin"
11921197commonFromBcp47 x = fromIso $ head x
11931198 where
11941199 fromIso "af" = "afrikaans"
11951200 fromIso "am" = "amharic"
11961201 fromIso "ar" = "arabic"
1202+ fromIso "as" = "assamese"
11971203 fromIso "ast" = "asturian"
11981204 fromIso "bg" = "bulgarian"
11991205 fromIso "bn" = "bengali"
@@ -1217,12 +1223,13 @@ commonFromBcp47 x = fromIso $ head x
12171223 fromIso "fur" = "friulan"
12181224 fromIso "ga" = "irish"
12191225 fromIso "gd" = "scottish"
1226+ fromIso "gez" = "ethiopic"
12201227 fromIso "gl" = "galician"
12211228 fromIso "he" = "hebrew"
12221229 fromIso "hi" = "hindi"
12231230 fromIso "hr" = "croatian"
1224− fromIso "hy" = "armenian"
12251231 fromIso "hu" = "magyar"
1232+ fromIso "hy" = "armenian"
12261233 fromIso "ia" = "interlingua"
12271234 fromIso "id" = "indonesian"
12281235 fromIso "ie" = "interlingua"
@@ -1230,6 +1237,7 @@ commonFromBcp47 x = fromIso $ head x
12301237 fromIso "it" = "italian"
12311238 fromIso "jp" = "japanese"
12321239 fromIso "km" = "khmer"
1240+ fromIso "kmr" = "kurmanji"
12331241 fromIso "kn" = "kannada"
12341242 fromIso "ko" = "korean"
12351243 fromIso "la" = "latin"
@@ -1245,6 +1253,7 @@ commonFromBcp47 x = fromIso $ head x
12451253 fromIso "no" = "norsk"
12461254 fromIso "nqo" = "nko"
12471255 fromIso "oc" = "occitan"
1256+ fromIso "pa" = "panjabi"
12481257 fromIso "pl" = "polish"
12491258 fromIso "pms" = "piedmontese"
12501259 fromIso "pt" = "portuguese"
@@ -1261,6 +1270,7 @@ commonFromBcp47 x = fromIso $ head x
12611270 fromIso "ta" = "tamil"
12621271 fromIso "te" = "telugu"
12631272 fromIso "th" = "thai"
1273+ fromIso "ti" = "ethiopic"
12641274 fromIso "tk" = "turkmen"
12651275 fromIso "tr" = "turkish"
12661276 fromIso "uk" = "ukrainian"