Skip to content

Commit

Permalink
add support for iso639_3
Browse files Browse the repository at this point in the history
  • Loading branch information
theScrabi committed Oct 15, 2024
1 parent 5f6d69a commit f9f5953
Showing 1 changed file with 190 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ enum class LanguageIdentifier {
}


fun toISO639_2() =
fun toISO639_1() =
when (this) {
AA -> "aa"
AB -> "ab"
Expand Down Expand Up @@ -1155,5 +1155,194 @@ enum class LanguageIdentifier {
else -> throw NewPlayerException("Unknwon language identifier: $identifier")
}

fun fromISO639_3(lang: String) =
when(lang) {
"aar" -> AA
"abk" -> AB
"afr" -> AF
"aka" -> AK
"amh" -> AM
"ara" -> AR
"arg" -> AN
"asm" -> AS
"ava" -> AV
"ave" -> AE
"aym" -> AY
"aze" -> AZ
"bak" -> BA
"bam" -> BM
"bel" -> BE
"ben" -> BN
"bis" -> BI
"bod" -> BO
"bos" -> BS
"bre" -> BR
"bul" -> BG
"cat" -> CA
"ces" -> CS
"cha" -> CH
"che" -> CE
"chu" -> CU
"chv" -> CV
"cor" -> KW
"cos" -> CO
"cre" -> CR
"cym" -> CY
"dan" -> DA
"deu" -> DE
"div" -> DV
"dzo" -> DZ
"ell" -> EL
"eng" -> EN
"epo" -> EO
"est" -> ET
"eus" -> EU
"ewe" -> EE
"fao" -> FO
"fas" -> FA
"fij" -> FJ
"fin" -> FI
"fra" -> FR
"fry" -> FY
"ful" -> FF
"gla" -> GD
"gle" -> GA
"glg" -> GL
"glv" -> GV
"grn" -> GN
"guj" -> GU
"hat" -> HT
"hau" -> HA
"heb" -> HE
"her" -> HZ
"hin" -> HI
"hmo" -> HO
"hrv" -> HR
"hun" -> HU
"hye" -> HY
"ibo" -> IG
"ido" -> IO
"iii" -> II
"iku" -> IU
"ile" -> IE
"ina" -> IA
"ind" -> ID
"ipk" -> IK
"isl" -> IS
"ita" -> IT
"jav" -> JV
"jpn" -> JA
"kal" -> KL
"kan" -> KN
"kas" -> KS
"kat" -> KA
"kau" -> KR
"kaz" -> KK
"khm" -> KM
"kik" -> KI
"kin" -> RW
"kir" -> KY
"kom" -> KV
"kon" -> KG
"kor" -> KO
"kua" -> KJ
"kur" -> KU
"lao" -> LO
"lat" -> LA
"lav" -> LV
"lim" -> LI
"lin" -> LN
"lit" -> LT
"ltz" -> LB
"lub" -> LU
"lug" -> LG
"mah" -> MH
"mal" -> ML
"mar" -> MR
"mkd" -> MK
"mlg" -> MG
"mlt" -> MT
"mon" -> MN
"mri" -> MI
"msa" -> MS
"mya" -> MY
"nau" -> NA
"nav" -> NV
"nbl" -> NR
"nde" -> ND
"ndo" -> NG
"nep" -> NE
"nld" -> NL
"nno" -> NN
"nob" -> NB
"nor" -> NO
"nya" -> NY
"oci" -> OC
"oji" -> OJ
"ori" -> OR
"orm" -> OM
"oss" -> OS
"pan" -> PA
"pli" -> PI
"pol" -> PL
"por" -> PT
"pus" -> PS
"que" -> QU
"roh" -> RM
"ron" -> RO
"run" -> RN
"rus" -> RU
"sag" -> SG
"san" -> SA
"sin" -> SI
"slk" -> SK
"slv" -> SL
"sme" -> SE
"smo" -> SM
"sna" -> SN
"snd" -> SD
"som" -> SO
"sot" -> ST
"spa" -> ES
"sqi" -> SQ
"srd" -> SC
"srp" -> SR
"ssw" -> SS
"sun" -> SU
"swa" -> SW
"swe" -> SV
"tah" -> TY
"tam" -> TA
"tat" -> TT
"tel" -> TE
"tgk" -> TG
"tgl" -> TL
"tha" -> TH
"tir" -> TI
"ton" -> TO
"tsn" -> TN
"tso" -> TS
"tuk" -> TK
"tur" -> TR
"twi" -> TW
"uig" -> UG
"ukr" -> UK
"urd" -> UR
"uzb" -> UZ
"ven" -> VE
"vie" -> VI
"vol" -> VO
"wal" -> WAL
"wln" -> WA
"wol" -> WO
"xho" -> XH
"yid" -> YI
"yor" -> YO
"zha" -> ZA
"zho" -> ZH
"zul" -> ZU
else -> throw NewPlayerException("Unknwon language in ISO639_3 format: $lang")
}

}
}

0 comments on commit f9f5953

Please sign in to comment.