karadzhov / scala-iso-country   0.5.0

The Unlicense GitHub

ISO 3166-1 alpha-2 countries using Enumeratum and translations

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

scala-iso-country Continuous integration Maven Central

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.

SBT

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

Enum without translations

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

Enum + Arabic translations

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

Enum + Bulgarian translations

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

Enum + Czech translations

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

Enum + German translations

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

Enum + English translations

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

Enum + Spanish translations

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

Enum + French translations

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

Enum + Hindi translations

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

Enum + Italian translations

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

Enum + Polish translations

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

Enum + Portuguese translations

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

Enum + Russian translations

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

Enum + Chinese translations

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

Sample

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"