Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: Support non-latin formats #70

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

er1c
Copy link
Collaborator

@er1c er1c commented Dec 18, 2016

For some reason this breaks on the JVM, even though its not reproducible on the console:

eric@Erics-MacBook-Pro:~/Work/scala-java-locales$ sbt console
[info] Loading project definition from /Users/eric/Work/scala-java-locales/project
[info] Set current project to scala-java-locales (in build file:/Users/eric/Work/scala-java-locales/)
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> import java.util.Locale
import java.util.Locale

scala> import java.text.NumberFormat
import java.text.NumberFormat

scala> val locale = Locale.forLanguageTag("hi-IN")
locale: java.util.Locale = hi_IN

scala> val decimalFormat = NumberFormat.getInstance(locale)
decimalFormat: java.text.NumberFormat = java.text.DecimalFormat@674dc

scala> decimalFormat.format(1234567890.123)
res0: String = १,२३४,५६७,८९०.१२३

@er1c
Copy link
Collaborator Author

er1c commented Dec 18, 2016

@er1c this is reproducible with export JAVA_OPTS="-Djava.locale.providers=CLDR"

@er1c
Copy link
Collaborator Author

er1c commented Dec 18, 2016

@er1c you can use java.util.Locale.getAvailableLocales.foreach { l => println(s"${l} - ${java.text.NumberFormat.getInstance(l).format(123456789.01)}") } to get a list if you have that export up

@cquiroz
Copy link
Owner

cquiroz commented Dec 28, 2016

@er1c I tested this locally and I reproduce that it works on JVM but not on JS, any plans about getting this to work?

@er1c
Copy link
Collaborator Author

er1c commented Dec 28, 2016

@cquiroz there is a reason it says do not merge :) we need to fix the getZeroDigit to pull from the CLDR, then I think this should work

@cquiroz
Copy link
Owner

cquiroz commented Dec 28, 2016

Ok, no pressure, just checking in 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants