Giter Club home page Giter Club logo

sbt-locales's Introduction

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" % "0.2.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

  • cldrVersion: Default is latest. It is possible to specify the CLDR version.
  • localesFilter: Default includes english. You can add locales by tag, e.g. en-US, fi, es-CL. Note that root and en are always included. If you include a locale for a country you'd need to also include its parent, e.g. to include fi-FI you should also include fi
  • currencyFilter: Default none. If you need currencies include them on this list
  • nsFilter: Default latn. List of numbering systems, latn is always included
  • calendarFilter: Default gregorian. List of calendars, gregorian is always included
  • supportDateTimeFormats: Default true. Whether to include date time formats
  • supportNumberFormats: Default false. Whether to include number formats
  • supportISOCodes: Default false. ISO codes list will be generated accordingly

Example:

  .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

sbt-locales's People

Contributors

cquiroz avatar scala-steward avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.