-
Notifications
You must be signed in to change notification settings - Fork 17
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
Question on locale-specific formatting #39
Comments
Hi, Thanks for raising this question. If e.g. Your app seems to use JavaFX, so if you're able to contribute here, we'd love to have your help under https://github.com/unitsofmeasurement/uom-demos/tree/master/javafx. At the moment there's just one example modeled after a nice Android app. It's not localized at the moment. For the default So in most cases you should not require special Regards, |
From what I can tell, that is indeed what is happening.
Yep, it does. Once things get worked out I'll see if I can get something ready for a PR.
Sorry, I'm not quite understanding what you are saying. Are you suggesting doing something like lines 474-478 of USCustomary.java? That works, but I was hoping that there would have been something in the UoM libraries (not necessarily RI) that had already done something like that so I don't have to add unit/symbol pairs manually.
So I'm missing an easy way to add format strings/symbols from multiple resource bundles? Seems to me that each unit system has its own
Unfortunately, I'm not familiar with Java's The reason I want that is because by the time I'm expecting to have something misunderstood, though, so please let me know if I got something wrong.
I think that's the behavior I was originally expecting? Unfortunately, that particular overload of
I get a similar exception when using |
The RI and The problem you mentioned
should be fixed in the latest uom-se snapshot. Please give it a try. Not every unit may be translated, e.g.
|
Sorry, been swamped at work and haven't gotten to look at the Java code for a while. I'll give it a try this coming week.
I actually had tried something like that by testing to see if the unit in question was a part of the
Unfortunately, as noted in the documentation, units which are scalar multiples of other units, such as
Awesome! I'll take a look at it as soon as I can.
Will do when I get around to the rest of the stuff
Oh, my mistake. Shows how inexperienced I am...
Hmmm, I think I get it. Seems to me that the returned formatter wouldn't work for multiple systems though? Seems like a good way to get all the formatters for all systems, but I'm not sure how useable that is... |
Has this issue been fixed? I'm trying to print I'm using |
The issue described in #50 is not related to locale-specific formatting. |
@keilw and/or @otaviojava, let's make it clear, what should this declaration format? Is it compatible with all the units on
and
occurs because the method |
Similar to |
But I mean, the |
At the moment the package actually changed after properties for the two SE formats in uom-se were combined, but I recall the "merge" of properties was not so trivial. It requires further investigation, but a harmonization of EBNFUnitFormat and LocalUnitFormat is scheduled for 1.0.6 at the latest. Now uom-se 1.0.5 is already out to be used by the new systems release and its dependencies (SI units need upgrade, too;-) |
It does work to put the same backing bundle into the correct package. Java |
I have an application which has a list of
Length
s displayed in a drop-down menu, with members such as "foot", "meter", "yard", etc. The code looks like this:I expected this to return the symbols usually associated with each unit, e.g.
m
forUnits.METRE
andin
forUS.INCH
. It works just fine for the SI units, but the US units get printed as scaled SI units, e.g.m*127.0/5000.0
forUS.INCH
, which was puzzling at first.I took a look at the
UnitFormat
interface andLocalUnitFormat
class, but I couldn't figure out how to put things together. I tried the following implementation oftoString()
first:But all that seemed to do was not show the
.0
at the end of the numbers and change the asterisk for multiplication to a dot. Makes sense, as the resource bundle inuom-se
didn't define symbols for US units.Next I tried loading the resource bundle in the
systems-common-java8
package, which contained the symbols for US units:But unfortunately some units still didn't format correctly; millimeters were formatted as
m/1000
, and centimeters asm/100
.USCustomary.YARD
also didn't format properly, displaying asm<dot>1143/1250
.What am I doing wrong? Is there a clean way of formatting units from multiple systems using a single
UnitFormat
instance?Edited the earlier post because I was stupid and used an old version of
systems-common-java8
. Updating got rid of the exception, but the other issues still remain.The text was updated successfully, but these errors were encountered: