scala-iso-country is a minimalistic library compatible with Scala, Scala.js and Scala Native. It simplifies the representation of ISO 3166-1 alpha-2 countries using Enumeratum and provides translations of country names into various languages.
To get started with SBT add the following to your build.sbt file:
libraryDependencies += "com.karadzhov" %% "scala-iso-country-core" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-ar" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-bg" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-cs" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-de" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-en" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-es" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-fr" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-hi" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-it" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-pl" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-pt" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-ru" % "0.5.0"
libraryDependencies += "com.karadzhov" %% "scala-iso-country-i18n-zh" % "0.5.0"
import com.karadzhov.iso.country.Country
import com.karadzhov.iso.country.i18n.CountryNameDE
Country.values
// Vector(Country.Afghanistan, Country.AlandIslands, Country.Albania...)
Country.Jamaica.entryName
// "JM"
Country.withNameOption("JM")
// Some(Country.Jamaica)
Country.withNameOption("AA")
// None
object GermanLanguagePack extends CountryNameDE
GermanLanguagePack.countryName(Country.Cambodia)
// "Kambodscha"