Home

Awesome

sbt-locales

build

An sbt plugin that can create custom locales databases to be used with scala-java-locales and scala-java-time

The db is build out of the cldr database definition:

http://cldr.unicode.org/

The database is fairly large which produced very big files that may not be needed for your application, instead you can build a customized version containing just the data you need, e.g. just date formats for english and spanish

Usage

Include on project/plugins.sbt

addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.8.0")

Configuration

Most applications just need a few locales and may need for example only dates. The code generated will thus include only the minimal data

Example:

  .enablePlugins(LocalesPlugin)
  .settings(
      localesFilter := LocalesFilter.Selection("en-US", "fi", "fi-FI"),
      nsFilter := NumberingSystemFilter.Minimal,
      currencyFilter := CurrencyFilter.Selection("EUR"),
      supportISOCodes := true,
      supportNumberFormats := true
  )

Troubleshooting

Note that the plugin doesn't verify consistency, if e.g. your locale requires arabic numbers and you don't include the arabic numbering system you may get compilation errors

Example

See scalajs-locales-demo