Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Javascript/Typescript
 QCSPCChart for Javascript/GWT
 Localizing dates, times, and values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

martintijmes

Netherlands
23 Posts

Posted - 26 Sep 2018 :  09:55:23  Show Profile  Reply with Quote
For our customer we need to be able to localize all tags in the SPC Chart.

This means that all dates, times, and values need to follow the localized format.
I found that for some tags the format can be specified, but it seems that it is not updated everywhere.
- For the DateHeader/DateString, the DateString can already be the formatted string. No issue here.
- For the TableSetup, the CustomTimeFormatString can be set. But I found that is for example not accepting the 'tt' annotation to shown AM/PM.
- For the datetime in the tooltip of the chart points, it does not seem to follow the CustomTimeFormatString for the TableSetup.
- For the values in the table, I need to be able to specify whether to use a dot or comma as decimal separator.
- The same decimal separator should be used for all values shown in the chart (e.g. on axis, in the tooltip, histogram, limits).

How to do this?

quinncurtis

1585 Posts

Posted - 26 Sep 2018 :  15:10:32  Show Profile  Reply with Quote
The underlying programming language of the software is Java. It is transpiled to JavaScript using the Google GWT developer tools.

Java does not use "tt" for formatting AM/PM. Try "a" instead.


All of our data tooltip tests use HH:MM format for the time, so customized dates has never been an issue. The software does not update the Date format for the tooltip if the default Date format is changed. It probably should so we will address that in an update.


The GWT numeric conversion routines (which are supposed to be functionally equivalent to the Java routines, but aren't) do not take into account the localized decimal separator (".", or ","). We do not see direct way to resolve this issue in GWT. We will have to investigate.
Go to Top of Page

quinncurtis

1585 Posts

Posted - 27 Sep 2018 :  13:29:10  Show Profile  Reply with Quote
We have found that GWT transpiler we use to create the software has a very poor way to support locales. It ends up creating an new set of *.js files for every locale. But it does work. So we added fr (French) and en (English) to the implementation. The French locale will force the GWT numeric conversion routines to convert numbers to a string which uses a comma, rather than a period, as the decimal separator.

You can download the modified library using your original download link. Delete your original qcspcchartgwt and copy over the new one.

If you want to force the library to use a comma as a decimal separator, you must add the following line to the head section of the HTML file hosting the QCSPCChart GWT web page.

<meta name="gwt:property" content="locale=fr">

for example

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="gwt:property" content="locale=fr">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet" href="QCSPCChartGWT.css">
<script src="chartdefExampleScripts.js"></script>



If you leave the meta line out, it seems to default to English, though we are not sure if this applies to all browsers running in different locales elsewhere in the world. It may be that the default in other locations does pick up the correct setting for the locale without forcing it, though the GWT documentation on this issue is non-existent. So, if you want to force the comma decimal separator, use the meta command and specify a locale value of fr.
Go to Top of Page

martintijmes

Netherlands
23 Posts

Posted - 03 Oct 2018 :  04:12:11  Show Profile  Reply with Quote
Hello, thank you for looking into this!

Indeed, the "a" formatter for AM/PM works. Thank you for pointing that out.

I also downloaded the updated version to test the French locale, and this works well.

Are you planning to add support for other locales as well? Or are you planning to investigate an alternative method, because this way requires a separate set js files for each locale?

Apart from the decimal separator, different locales also have a different thousands separators. On Wikipedia (https://en.wikipedia.org/wiki/Decimal_separator) I see that there are basically 4 formats:
- 1,234,567.89
- 1 234 567.89
- 1 234 567,89
- 1.234.567,89

On short term we would also like to request locale support for Russian (1.234.567,89).

Do you have an idea when an update for the formatting of the data tooltip would be possible?
Go to Top of Page

quinncurtis

1585 Posts

Posted - 03 Oct 2018 :  12:23:29  Show Profile  Reply with Quote
We only plan to support the decimal separator, either comma or period. The default (English) mode is the decimal, and the French is for the comma. We don't plan on supporting the other variants you describe. We do not support the comma decimal separtor in English, so we don't plan to support it other languages. If you want to contract us to add this to the software we can investigate. You are asking us to create variants which double, triple, quadruple, the size of the installation and we are not going to do that for the standard product. If you want us to create and maintain a custom version specifically for you we will need to charge you for that. We are amazed that you have some sort of Russian requirement for your software. As far as as we know, going back 20-30 years, we have never sold a software package to Russia, or a satellite of Russia.

We have not come up with a simple solution for the data tooltip and have no date for that we can give you.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07