cldr-api

scala-java-locales cldrl api

License

License

GroupId

GroupId

io.github.cquiroz
ArtifactId

ArtifactId

cldr-api_sjs0.6_2.13
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

cldr-api
scala-java-locales cldrl api
Project URL

Project URL

https://github.com/cquiroz/sbt-locales
Project Organization

Project Organization

io.github.cquiroz
Source Code Management

Source Code Management

https://github.com/cquiroz/sbt-locales

Download cldr-api_sjs0.6_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.cquiroz/cldr-api_sjs0.6_2.13/ -->
<dependency>
    <groupId>io.github.cquiroz</groupId>
    <artifactId>cldr-api_sjs0.6_2.13</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.cquiroz/cldr-api_sjs0.6_2.13/
implementation 'io.github.cquiroz:cldr-api_sjs0.6_2.13:1.0.0'
// https://jarcasting.com/artifacts/io.github.cquiroz/cldr-api_sjs0.6_2.13/
implementation ("io.github.cquiroz:cldr-api_sjs0.6_2.13:1.0.0")
'io.github.cquiroz:cldr-api_sjs0.6_2.13:jar:1.0.0'
<dependency org="io.github.cquiroz" name="cldr-api_sjs0.6_2.13" rev="1.0.0">
  <artifact name="cldr-api_sjs0.6_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.cquiroz', module='cldr-api_sjs0.6_2.13', version='1.0.0')
)
libraryDependencies += "io.github.cquiroz" % "cldr-api_sjs0.6_2.13" % "1.0.0"
[io.github.cquiroz/cldr-api_sjs0.6_2.13 "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.2
org.scala-js : scalajs-library_2.13 jar 0.6.32
org.portable-scala : portable-scala-reflect_sjs0.6_2.13 jar 1.0.0

test (2)

Group / Artifact Type Version
org.scala-js : scalajs-test-bridge_2.13 jar 0.6.32
org.scalameta : munit_sjs0.6_2.13 jar 0.7.3

Project Modules

There are no modules declared in this project.

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" % "1.0.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:

  .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

Versions

Version
1.0.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.0
0.1.1
0.0.8
0.0.7
0.0.2