@@ -1125,7 +1125,7 @@ toPolyglossiaEnv l =
1126-- Takes a list of the constituents of a BCP 47 language code and
1126-- Takes a list of the constituents of a BCP 47 language code and
1127-- converts it to a Polyglossia (language, options) tuple
1127-- converts it to a Polyglossia (language, options) tuple
1128−-- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf
1128+-- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf
1129toPolyglossia :: [String] -> (String, String)
1129toPolyglossia :: [String] -> (String, String)
1130toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
1130toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
1131toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
1131toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
@@ -1153,18 +1153,21 @@ toPolyglossia ("en":"UK":_) = ("english", "variant=british")
1153toPolyglossia ("en":"US":_) = ("english", "variant=american")
1153toPolyglossia ("en":"US":_) = ("english", "variant=american")
1154toPolyglossia ("grc":_) = ("greek", "variant=ancient")
1154toPolyglossia ("grc":_) = ("greek", "variant=ancient")
1155toPolyglossia ("hsb":_) = ("usorbian", "")
1155toPolyglossia ("hsb":_) = ("usorbian", "")
1156−toPolyglossia ("la":"x-classic":_) = ("latin", "variant=classic")
1156+toPolyglossia ("la":"x":"classic":_) = ("latin", "variant=classic")
1157toPolyglossia ("sl":_) = ("slovenian", "")
1157toPolyglossia ("sl":_) = ("slovenian", "")
1158toPolyglossia x = (commonFromBcp47 x, "")
1158toPolyglossia x = (commonFromBcp47 x, "")
1160-- Takes a list of the constituents of a BCP 47 language code and
1160-- Takes a list of the constituents of a BCP 47 language code and
1161-- converts it to a Babel language string.
1161-- converts it to a Babel language string.
1162−-- http://mirrors.concertpass.com/tex-archive/macros/latex/required/babel/base/babel.pdf
1162+-- http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf
1163−-- Note that the PDF unfortunately does not contain a complete list of supported languages.
1163+-- List of supported languages (slightly outdated):
1164+-- http://tug.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyphenation.pdf
1164toBabel :: [String] -> String
1165toBabel :: [String] -> String
1165toBabel ("de":"1901":_) = "german"
1166toBabel ("de":"1901":_) = "german"
1166toBabel ("de":"AT":"1901":_) = "austrian"
1167toBabel ("de":"AT":"1901":_) = "austrian"
1167toBabel ("de":"AT":_) = "naustrian"
1168toBabel ("de":"AT":_) = "naustrian"
1169+toBabel ("de":"CH":"1901":_) = "swissgerman"
1170+toBabel ("de":"CH":_) = "nswissgerman"
1168toBabel ("de":_) = "ngerman"
1171toBabel ("de":_) = "ngerman"
1169toBabel ("dsb":_) = "lowersorbian"
1172toBabel ("dsb":_) = "lowersorbian"
1170toBabel ("el":"polyton":_) = "polutonikogreek"
1173toBabel ("el":"polyton":_) = "polutonikogreek"
@@ -1178,7 +1181,7 @@ toBabel ("fr":"CA":_) = "canadien"
1178toBabel ("fra":"aca":_) = "acadian"
1181toBabel ("fra":"aca":_) = "acadian"
1179toBabel ("grc":_) = "polutonikogreek"
1182toBabel ("grc":_) = "polutonikogreek"
1180toBabel ("hsb":_) = "uppersorbian"
1183toBabel ("hsb":_) = "uppersorbian"
1181−toBabel ("la":"x-classic":_) = "classiclatin"
1184+toBabel ("la":"x":"classic":_) = "classiclatin"
1182toBabel ("sl":_) = "slovene"
1185toBabel ("sl":_) = "slovene"
1183toBabel x = commonFromBcp47 x
1186toBabel x = commonFromBcp47 x
@@ -1187,12 +1190,15 @@ toBabel x = commonFromBcp47 x
1187-- https://tools.ietf.org/html/bcp47#section-2.1
1190-- https://tools.ietf.org/html/bcp47#section-2.1
1188commonFromBcp47 :: [String] -> String
1191commonFromBcp47 :: [String] -> String
1189commonFromBcp47 [] = ""
1192commonFromBcp47 [] = ""
1190−commonFromBcp47 ("pt":"BR":_) = "brazilian"
1193+commonFromBcp47 ("pt":"BR":_) = "brazilian"
1194+commonFromBcp47 ("sr":"Cyrl":_) = "serbianc"
1195+commonFromBcp47 ("zh":"Latn":"pinyin":_) = "pinyin"
1191commonFromBcp47 x = fromIso $ head x
1196commonFromBcp47 x = fromIso $ head x
1193 fromIso "af" = "afrikaans"
1198 fromIso "af" = "afrikaans"
1194 fromIso "am" = "amharic"
1199 fromIso "am" = "amharic"
1195 fromIso "ar" = "arabic"
1200 fromIso "ar" = "arabic"
1201+ fromIso "as" = "assamese"
1196 fromIso "ast" = "asturian"
1202 fromIso "ast" = "asturian"
1197 fromIso "bg" = "bulgarian"
1203 fromIso "bg" = "bulgarian"
1198 fromIso "bn" = "bengali"
1204 fromIso "bn" = "bengali"
@@ -1216,12 +1222,13 @@ commonFromBcp47 x = fromIso $ head x
1216 fromIso "fur" = "friulan"
1222 fromIso "fur" = "friulan"
1217 fromIso "ga" = "irish"
1223 fromIso "ga" = "irish"
1218 fromIso "gd" = "scottish"
1224 fromIso "gd" = "scottish"
1225+ fromIso "gez" = "ethiopic"
1219 fromIso "gl" = "galician"
1226 fromIso "gl" = "galician"
1220 fromIso "he" = "hebrew"
1227 fromIso "he" = "hebrew"
1221 fromIso "hi" = "hindi"
1228 fromIso "hi" = "hindi"
1222 fromIso "hr" = "croatian"
1229 fromIso "hr" = "croatian"
1223− fromIso "hy" = "armenian"
1224 fromIso "hu" = "magyar"
1230 fromIso "hu" = "magyar"
1231+ fromIso "hy" = "armenian"
1225 fromIso "ia" = "interlingua"
1232 fromIso "ia" = "interlingua"
1226 fromIso "id" = "indonesian"
1233 fromIso "id" = "indonesian"
1227 fromIso "ie" = "interlingua"
1234 fromIso "ie" = "interlingua"
@@ -1229,6 +1236,7 @@ commonFromBcp47 x = fromIso $ head x
1229 fromIso "it" = "italian"
1236 fromIso "it" = "italian"
1230 fromIso "jp" = "japanese"
1237 fromIso "jp" = "japanese"
1231 fromIso "km" = "khmer"
1238 fromIso "km" = "khmer"
1239+ fromIso "kmr" = "kurmanji"
1232 fromIso "kn" = "kannada"
1240 fromIso "kn" = "kannada"
1233 fromIso "ko" = "korean"
1241 fromIso "ko" = "korean"
1234 fromIso "la" = "latin"
1242 fromIso "la" = "latin"
@@ -1244,6 +1252,7 @@ commonFromBcp47 x = fromIso $ head x
1244 fromIso "no" = "norsk"
1252 fromIso "no" = "norsk"
1245 fromIso "nqo" = "nko"
1253 fromIso "nqo" = "nko"
1246 fromIso "oc" = "occitan"
1254 fromIso "oc" = "occitan"
1255+ fromIso "pa" = "panjabi"
1247 fromIso "pl" = "polish"
1256 fromIso "pl" = "polish"
1248 fromIso "pms" = "piedmontese"
1257 fromIso "pms" = "piedmontese"
1249 fromIso "pt" = "portuguese"
1258 fromIso "pt" = "portuguese"
@@ -1260,6 +1269,7 @@ commonFromBcp47 x = fromIso $ head x
1260 fromIso "ta" = "tamil"
1269 fromIso "ta" = "tamil"
1261 fromIso "te" = "telugu"
1270 fromIso "te" = "telugu"
1262 fromIso "th" = "thai"
1271 fromIso "th" = "thai"
1272+ fromIso "ti" = "ethiopic"
1263 fromIso "tk" = "turkmen"
1273 fromIso "tk" = "turkmen"
1264 fromIso "tr" = "turkish"
1274 fromIso "tr" = "turkish"
1265 fromIso "uk" = "ukrainian"
1275 fromIso "uk" = "ukrainian"