karadzhov / scala-iso-language   0.5.0

The Unlicense GitHub

ISO 639 languages using Enumeratum and translations

Scala versions: 3.x 2.13 2.12
Scala.js versions: 1.x
Scala Native versions: 0.4

scala-iso-language Continuous integration Maven Central

scala-iso-language is a minimalistic library compatible with Scala, Scala.js and Scala Native. It simplifies the representation of ISO 639 languages using Enumeratum and provides translations of language names into various languages.

SBT

To get started with SBT add the following to your build.sbt file:

Enum without translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-core" % "0.5.0"

Enum + Arabic translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-ar" % "0.5.0"

Enum + Bulgarian translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-bg" % "0.5.0"

Enum + Czech translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-cs" % "0.5.0"

Enum + German translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-de" % "0.5.0"

Enum + English translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-en" % "0.5.0"

Enum + Spanish translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-es" % "0.5.0"

Enum + French translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-fr" % "0.5.0"

Enum + Hindi translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-hi" % "0.5.0"

Enum + Italian translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-it" % "0.5.0"

Enum + Polish translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-pl" % "0.5.0"

Enum + Portuguese translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-pt" % "0.5.0"

Enum + Russian translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-ru" % "0.5.0"

Enum + Chinese translations

libraryDependencies += "com.karadzhov" %% "scala-iso-language-i18n-zh" % "0.5.0"

Sample

import com.karadzhov.iso.language.Language
import com.karadzhov.iso.language.i18n.LanguageNameDE

Language.values
// Vector(Language.Abkhazian, Language.Afar, Language.Afrikaans...)

Language.Chinese.entryName
// "zh"

Language.withNameOption("zh")
// Some(Language.Chinese)

Language.withNameOption("ac")
// None

object GermanLanguagePack extends LanguageNameDE

GermanLanguagePack.languageName(Language.Samoan)
// "Samoanisch"