Skip to content

Commit

Permalink
Merge pull request #103 from cquiroz/libupdates
Browse files Browse the repository at this point in the history
Libupdates
  • Loading branch information
cquiroz authored Dec 6, 2017
2 parents a52222e + aa3885b commit 27170a2
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 68 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
sudo: false
language: scala
scala:
- 2.10.6
- 2.11.11
- 2.12.3
- 2.10.7
- 2.11.12
- 2.12.4
- 2.13.0-M2
jdk:
- oraclejdk8
env:
- TRAVIS_NODE_VERSION="5.12.0" SCALAJS_VERSION="0.6.20"
- TRAVIS_NODE_VERSION="5.12.0" SCALAJS_VERSION="1.0.0-M1"
- TRAVIS_NODE_VERSION="6.10.0" SCALAJS_VERSION="0.6.20"
- TRAVIS_NODE_VERSION="6.10.0" SCALAJS_VERSION="1.0.0-M1"
- TRAVIS_NODE_VERSION="7.6.0" SCALAJS_VERSION="0.6.20"
- TRAVIS_NODE_VERSION="7.6.0" SCALAJS_VERSION="1.0.0-M1"
- TRAVIS_NODE_VERSION="7.10.1" SCALAJS_VERSION="0.6.21"
- TRAVIS_NODE_VERSION="7.10.1" SCALAJS_VERSION="1.0.0-M2"
- TRAVIS_NODE_VERSION="8.9.1" SCALAJS_VERSION="0.6.21"
- TRAVIS_NODE_VERSION="8.9.1" SCALAJS_VERSION="1.0.0-M2"
- TRAVIS_NODE_VERSION="9.2.0" SCALAJS_VERSION="0.6.21"
- TRAVIS_NODE_VERSION="9.2.0" SCALAJS_VERSION="1.0.0-M2"
install:
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
- npm install
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 0.3.9-cldr32

* Scala.js 0.6.21 and 1.0.0-M2
* Scala versions 2.10.7, 2.11.12, 2.12.2 and 2.13.0-M2
* Updated to cldr32

## 0.3.8-cldr31

* Scala.js 0.6.20 and 1.0.0-M1
* Scala versions 2.11.11, 2.12.3 and 2.13.0-M2
* Support for scala-native

## 0.3.7-cldr31

* Updated to scala.js 0.6.18
* Supports scala.js 1.0.0-M1

## 0.3.5-cldr31

* Updated to scala.js 0.6.17
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# scala-java-locales

[![Build Status](https://api.travis-ci.org/cquiroz/scala-java-locales.svg?branch=master)](https://travis-ci.org/cquiroz/scala-java-locales)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.8.svg)](https://www.scala-js.org/)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.cquiroz/scala-java-locales_sjs0.6_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.cquiroz/scala-java-locales_sjs0.6_2.12)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.17.svg)](https://www.scala-js.org/)

`scala-java-locales` is a clean-room BSD-licensed implementation of the `java.util.Locale` API and related classes as defined on JDK8, mostly for Scala.js usage. It enables the locale API in Scala.js projects and supports usage requiring locales like number and dates formatting.

Expand All @@ -10,7 +11,7 @@
Simply add the following line to your sbt settings:

```scala
libraryDependencies += "com.github.cquiroz" %%% "scala-java-locales" % "0.3.3-cldr31"
libraryDependencies += "com.github.cquiroz" %%% "scala-java-locales" % "0.3.9-cldr32"
```

If you have a `crossProject`, the setting must be used only in the JS part:
Expand All @@ -19,7 +20,7 @@ If you have a `crossProject`, the setting must be used only in the JS part:
lazy val myCross = crossProject.
...
.jsSettings(
libraryDependencies += "com.github.cquiroz" %%% "scala-java-locales" % "0.3.3-cldr31"
libraryDependencies += "com.github.cquiroz" %%% "scala-java-locales" % "0.3.9-cldr32"
)
```

Expand Down Expand Up @@ -90,24 +91,25 @@ A very simple `Scala.js` project is available at [scalajs-locales-demo](https://
`scala-java-locales` uses [Semantic Versioning](http://semver.org/) and includes the CLDR version used as a build tag, e.g.:

```
0.3.3-cldr31 // Version 0.3.3 with CLDR version 31
0.3.9-cldr32 // Version 0.3.9 with CLDR version 32
```

## Publishing

on 0.6.18
on 0.6.21
```
sbt
clean
+publishSigned
coreNative/publishSigned
sonatyeRelease
```

Important: Remember to clean between different scala.js versions

on 1.0.0-M1
on 1.0.0-M2
```
SCALAJS_VERSION=1.0.0-M1 sbt
SCALAJS_VERSION=1.0.0-M2 sbt
clean
+publishSigned
sonatyeRelease
Expand Down
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ lazy val downloadFromZip: TaskKey[Unit] =
taskKey[Unit]("Download the sbt zip and extract it")

val commonSettings: Seq[Setting[_]] = Seq(
cldrVersion := "31",
version := s"0.3.8-cldr${cldrVersion.value}",
cldrVersion := "32",
version := s"0.3.9-cldr${cldrVersion.value}",
organization := "io.github.cquiroz",
scalaVersion := "2.11.11",
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.3", "2.13.0-M2"),
scalacOptions ++= Seq("-deprecation", "-feature"),
scalaVersion := "2.12.4",
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.4", "2.13.0-M2"),
scalacOptions ++= Seq("-deprecation", "-feature"),
scalacOptions := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Expand Down Expand Up @@ -91,8 +91,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform).
generateLocaleData((sourceManaged in Compile).value,
(resourceDirectory in Compile).value / "core")
}.taskValue
).
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
)

lazy val coreJS: Project = core.js
.settings(
Expand Down Expand Up @@ -133,6 +132,7 @@ lazy val testSuite = crossProject(JVMPlatform, JSPlatform, NativePlatform).
)
).
jsConfigure(_.dependsOn(coreJS, macroUtils)).
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)).
jvmSettings(
// Fork the JVM test to ensure that the custom flags are set
fork in Test := true,
Expand Down
12 changes: 3 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.20")
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.21")

addSbtPlugin("org.scala-native" % "sbt-crossproject" % "0.2.2")
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.3.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)

// For sbt-crossproject support even with Scala.js 0.6.x
{
if (scalaJSVersion.startsWith("0.6."))
Seq(addSbtPlugin("org.scala-native" % "sbt-scalajs-crossproject" % "0.2.2"))
else
Nil
}
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.3.0")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.3")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ class DateFormatSymbolsTest extends LocaleTestSetup {
List("上午", "下午"),
List("西元前", "西元")),
Locale.US -> LocaleTestItem(en_US, "en_US", cldr21 = false,
List("January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December", ""),
List("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""),
List("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"),
List("", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"),
List("AM", "PM"),
List("BC", "AD")),
Locale.CANADA -> LocaleTestItem(en_CA, "en_CA", cldr21 = false,
List("January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December", ""),
List("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""),
Expand Down Expand Up @@ -103,7 +95,7 @@ class DateFormatSymbolsTest extends LocaleTestSetup {
List("Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez.", ""),
List("", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"),
List("", "So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."),
List("vorm.", "nachm."),
List("AM", "PM"),
List("v. Chr.", "n. Chr.")),
Locale.GERMANY -> LocaleTestItem(de_DE, "de_DE", cldr21 = true,
List("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August",
Expand All @@ -119,7 +111,7 @@ class DateFormatSymbolsTest extends LocaleTestSetup {
List("Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez.", ""),
List("", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"),
List("", "So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."),
List("vorm.", "nachm."),
List("AM", "PM"),
List("v. Chr.", "n. Chr.")),
Locale.ITALIAN -> LocaleTestItem(it, "it", cldr21 = true,
List("gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio",
Expand Down Expand Up @@ -268,7 +260,23 @@ class DateFormatSymbolsTest extends LocaleTestSetup {
List("", "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"),
List("", "dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."),
List("a.m.", "p.m."),
List("av. J.-C.", "ap. J.-C."))
List("av. J.-C.", "ap. J.-C.")),
Locale.CANADA -> LocaleTestItem(en_CA, "en_CA", cldr21 = true,
List("January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December", ""),
List("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""),
List("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"),
List("", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"),
List("AM", "PM"),
List("BC", "AD")),
Locale.CANADA -> LocaleTestItem(en_CA, "en_CA", cldr21 = false,
List("January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December", ""),
List("Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec.", ""),
List("", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"),
List("", "Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."),
List("a.m.", "p.m."),
List("BC", "AD"))
)

val extraLocalesData = List(
Expand Down Expand Up @@ -552,7 +560,7 @@ class DateFormatSymbolsTest extends LocaleTestSetup {
List("янв.", "февр.", "мар.", "апр.", "мая", "июн.", "июл.", "авг.", "сент.", "окт.", "нояб.", "дек.", ""),
List("", "воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"),
List("", "вс", "пн", "вт", "ср", "чт", "пт", "сб"),
List("ДП", "ПП"),
List("AM", "PM"),
List("до н. э.", "н. э."))
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.FRENCH, cldr21 = true, Map( // JVM
TestCase(root, "fr", Locale.FRENCH, cldr21 = true, Map( // JVM
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "d MMM y",
Expand All @@ -127,7 +127,7 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.FRENCH, cldr21 = false, Map( // JS
TestCase(root, "fr", Locale.FRENCH, cldr21 = false, Map( // JS
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "d MMM y",
Expand All @@ -137,7 +137,7 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.GERMAN, cldr21 = true, Map(
TestCase(root, "de", Locale.GERMAN, cldr21 = true, Map(
DateFormat.FULL -> "EEEE, d. MMMM y",
DateFormat.LONG -> "d. MMMM y",
DateFormat.MEDIUM -> "dd.MM.yyyy",
Expand All @@ -147,7 +147,7 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.GERMAN, cldr21 = false, Map(
TestCase(root, "de", Locale.GERMAN, cldr21 = false, Map(
DateFormat.FULL -> "EEEE, d. MMMM y",
DateFormat.LONG -> "d. MMMM y",
DateFormat.MEDIUM -> "dd.MM.y",
Expand All @@ -157,7 +157,7 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.ITALIAN, cldr21 = true, Map(
TestCase(root, "it", Locale.ITALIAN, cldr21 = true, Map(
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "dd MMMM y",
DateFormat.MEDIUM -> "dd/MMM/y",
Expand All @@ -167,10 +167,10 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.ITALIAN, cldr21 = false, Map(
TestCase(root, "it", Locale.ITALIAN, cldr21 = false, Map(
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "dd MMM y",
DateFormat.MEDIUM -> "d MMM y",
DateFormat.SHORT -> "dd/MM/yy"),
Map(
DateFormat.FULL -> "HH:mm:ss zzzz",
Expand Down Expand Up @@ -330,7 +330,7 @@ class DateFormatTest extends LocaleTestSetup {
TestCase(root, "", Locale.ITALY, cldr21 = false, Map(
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "dd MMM y",
DateFormat.MEDIUM -> "d MMM y",
DateFormat.SHORT -> "dd/MM/yy"),
Map(
DateFormat.FULL -> "HH:mm:ss zzzz",
Expand Down Expand Up @@ -467,15 +467,15 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(root, "", Locale.CANADA_FRENCH, cldr21 = false, Map( // JS
TestCase(root, "ca_fr", Locale.CANADA_FRENCH, cldr21 = false, Map( // JS
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "d MMM y",
DateFormat.SHORT -> "yy-MM-dd"),
Map(
DateFormat.FULL -> "HH:mm:ss zzzz",
DateFormat.LONG -> "HH:mm:ss z",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.FULL -> "HH 'h' mm 'min' ss 's' zzzz",
DateFormat.LONG -> "HH 'h' mm 'min' ss 's' z",
DateFormat.MEDIUM -> "HH 'h' mm 'min' ss 's'",
DateFormat.SHORT -> "HH 'h' mm"))
)

Expand Down Expand Up @@ -656,8 +656,8 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.MEDIUM -> "h:mm:ss a",
DateFormat.SHORT -> "h:mm a")),
TestCase(ar, "ar", Locale.ROOT, cldr21 = false, Map( // JS
DateFormat.FULL -> "EEEE، d MMMM، y",
DateFormat.LONG -> "d MMMM، y",
DateFormat.FULL -> "EEEE، d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "dd‏/MM‏/y",
DateFormat.SHORT -> "d‏/M‏/y"),
Map(
Expand Down Expand Up @@ -736,15 +736,15 @@ class DateFormatTest extends LocaleTestSetup {
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
TestCase(my, "my", Locale.ROOT, cldr21 = false, Map( // JS
DateFormat.FULL -> "EEEE d MMMM y",
DateFormat.LONG -> "d MMMM y",
DateFormat.MEDIUM -> "d MMM y",
DateFormat.FULL -> "y၊ MMMM d၊ EEEE",
DateFormat.LONG -> "y၊ d MMMM",
DateFormat.MEDIUM -> "y၊ MMM d",
DateFormat.SHORT -> "dd-MM-yy"),
Map(
DateFormat.FULL -> "zzzz HH:mm:ss",
DateFormat.LONG -> "z HH:mm:ss",
DateFormat.MEDIUM -> "HH:mm:ss",
DateFormat.SHORT -> "HH:mm")),
DateFormat.MEDIUM -> "B HH:mm:ss",
DateFormat.SHORT -> "B H:mm")),
TestCase(ru_RU, "ru-RU", Locale.ROOT, cldr21 = true, Map( // JVM
DateFormat.FULL -> "EEEE, d MMMM y\u00A0'г'.",
DateFormat.LONG -> "d MMMM y\u00A0'г'.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class DecimalFormatSymbolsTest extends LocaleTestSetup {
List("0", ".", ",", "", "%", "#", ";", "", "NaN", "-", "E"),
Locale.US ->
List("0", ".", ",", "", "%", "#", ";", "", "NaN", "-", "E"),
Locale.CANADA ->
List("0", ".", ",", "", "%", "#", ";", "", "NaN", "-", "E"),
Locale.CANADA_FRENCH ->
List("0", ",", "\u00A0", "", "%", "#", ";", "", "NaN", "-", "E")
)
Expand Down Expand Up @@ -131,7 +129,11 @@ class DecimalFormatSymbolsTest extends LocaleTestSetup {
LocaleTestItem(ru_RU, "ru-RU", cldr21 = true) ->
List("0", ",", "\u00A0", "", "%", "#", ";", "", "не число", "-", "E"),
LocaleTestItem(ru_RU, "ru-RU") ->
List("0", ",", "\u00A0", "", "%", "#", ";", "", "не число", "-", "E")
List("0", ",", "\u00A0", "", "%", "#", ";", "", "не число", "-", "E"),
LocaleTestItem(ca, "ca", cldr21 = true) ->
List("0", ",", ".", "", "%", "#", ";", "", "NaN", "-", "E"),
LocaleTestItem(ca, "ca") ->
List("0", ",", ".", "", "%", "#", ";", "", "NaN", "-", "E")
)

def test_dfs(dfs: DecimalFormatSymbols, symbols: List[String]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ class LocaleTest extends LocaleTestSetup {
@Test def test_get_iso_codes(): Unit = {
// The data from CLDR gives a different amount of countries and
// languages than the JVM
val countriesCount = if (Platform.executingInJVM) 250 else 246
val languagesCount = if (Platform.executingInJVM) 188 else 122
val countriesCount = if (Platform.executingInJVM) 250 else 247
val languagesCount = if (Platform.executingInJVM) 188 else 126
assertEquals(countriesCount, Locale.getISOCountries.length)
assertEquals(languagesCount, Locale.getISOLanguages.length)
}
Expand Down

0 comments on commit 27170a2

Please sign in to comment.