Page 1 of 2

Cumulus MX lang parameter

Posted: Fri 12 Jun 2015 3:39 pm
by Dinant
I live in the Netherlands. If I start CumulusMX on a Raspberry PI the default language is en-GB.
After adding -lang nl-NL parameter to the command line the language is Dutch as seen on the console and in the diag logfile.
But now the comma is being used as a decimal. I do not want decimal commas because this also produces files with decimal commas.
What is the best solution to this problem?
If I choose to use the en-GB language do I become date and time in English language?
Which settings are dependant on the language chosen?

Regards,
Dinant

Re: Cumulus MX lang parameter

Posted: Fri 12 Jun 2015 4:11 pm
by steve
I don't know, to be honest. On Windows, you can customise all the settings (decimal separator, date format etc) for the locale as you wish. I suspect that you can do the same in Linux, but I don't know how you do that.

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 10:37 am
by rogerthn
Not as simple as in Windows but it should be possible?
Edit /usr/share/i18n/locales/nl_NL as below to get . as decimal point and run

Code: Select all

sudo locale-gen
OLD

Code: Select all

LC_NUMERIC
decimal_point             "<U002C>"
thousands_sep             ""
grouping                  0;0
END LC_NUMERIC
NEW

Code: Select all

LC_NUMERIC
decimal_point             "<U002E>"
thousands_sep             ""
grouping                  0;0
END LC_NUMERIC
Please note that this is UNTESTED :lol:

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 11:21 am
by Dinant
I modified the "nl_NL" file.
After changing the default system locale to "nl_NL.UTF-8" with the command and a reboot of the PI I started CumulusMX with the shell script.
I went to the web interface; calibration settings and changed some of them to include a decimal. After restarting CumulusMX I examined the diag file and I still see decimal comma's. Also a restart does not change this behaviour.
Anyone a suggestion?

Code: Select all

2015-06-13 11:02:06.856  ========================== Cumulus MX starting ==========================
2015-06-13 11:02:06.906 Command line: /home/pi/CumulusMX/CumulusMX.exe -port 8998
2015-06-13 11:02:06.911 Cumulus MX v.3.0.0 build 3025
2015-06-13 11:02:06.938 Platform: Unix
2015-06-13 11:02:06.945 OS version: Unix 3.18.11.0
2015-06-13 11:02:06.946 Current culture: Dutch (Netherlands)
2015-06-13 11:02:06.947 Standard time zone name:   UTC
2015-06-13 11:02:06.949 Daylight saving time name: UTC
2015-06-13 11:02:06.951 Daylight saving time? False
2015-06-13 11:02:06.959 13-6-2015 11:02:06
2015-06-13 11:02:06.968 Data path = data/
2015-06-13 11:02:07.007 Creating backup folder backup/20150613110206/
2015-06-13 11:02:07.301 Reading Cumulus.ini file
2015-06-13 11:02:07.617 ASM=10 AST=00:10:00
2015-06-13 11:02:07.642 Cumulus start date: 17-08-2013
2015-06-13 11:02:07.750 Debug logging is disabled
2015-06-13 11:02:07.751 Logging interval = 1
2015-06-13 11:02:08.599 Sunrise: 03:12:39
2015-06-13 11:02:08.600 Sunset : 19:55:56
2015-06-13 11:02:08.718 Station type: Davis Vantage Pro2
2015-06-13 11:02:08.727 WindUnit=km/h RainUnit=mm TempUnit=°C PressureUnit=hPa
2015-06-13 11:02:08.741 YTDRain=0,000 Year=0
2015-06-13 11:02:08.742 RainDayThreshold=-1,000
2015-06-13 11:02:08.743 Offsets and Multipliers:
2015-06-13 11:02:08.746 PO=0,123 TO=0,000 HO=0 WDO=0 ITO=0,000 UVO=0,000
2015-06-13 11:02:08.748 WSM=1,000 WGM=1,000 TM=1,000 TM2=1,000 HM=1,000 RM=1,000 UVM=1,000
2015-06-13 11:02:08.748 Spike removal:
2015-06-13 11:02:08.750 TD=999,000 GD=999,000 WD=999,000 HD=999,000 PD=999,000
2015-06-13 11:02:08.752 MR=999,000 MH=999,000
2015-06-13 11:02:08.752 Cumulus Starting
2015-06-13 11:02:08.759 Opening station
2015-06-13 11:02:09.129 Last update time from today.ini: 13-6-2015 11:02:08
2015-06-13 11:02:09.131 Read today file: Date = 00/00/00, LastUpdateTime = 13-6-2015 11:02:08, Month = 6
2015-06-13 11:02:09.140 ET not initialised

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 11:28 am
by steve
It appears that after modifying the locale you have to do 'sudo locale-gen' before any changes take effect, so that's probably worth trying.

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 4:27 pm
by freddie
steve wrote:It appears that after modifying the locale you have to do 'sudo locale-gen' before any changes take effect, so that's probably worth trying.
...which is what @rogerthn said to do in his post:

rogerthn wrote:Not as simple as in Windows but it should be possible?
Edit /usr/share/i18n/locales/nl_NL as below to get . as decimal point and run

Code: Select all

sudo locale-gen

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 4:47 pm
by steve
Ah right, of course he did. I think I should stick to all the other stuff that is taking my time and attention at the moment and leave the forum and Cumulus to itself for a while, it's one too many thing to concentrate on. In my defence, the OP didn't actually say that he had done that.

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 4:58 pm
by rogerthn
It might be that "mono doesn't care"?

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 5:19 pm
by steve
Could be - it may not be picking up the changed setting, it may just use its built-in settings for the locale.

Re: Cumulus MX lang parameter

Posted: Sat 13 Jun 2015 7:13 pm
by Dinant
I did some tests. First I reset the system locale to nl_NL and run sudo locale-gen.
I have made a small bash script:

Code: Select all

#!/bin/bash
printf "%'f\n" 56789
The initial result is: 55.789,000000
Now I change the file /usr/share/i18n/locales/nl_NL the following text:

OLD

Code: Select all

LC_NUMERIC
decimal_point             "<U002C>"
thousands_sep             "<U002E>"
grouping                  3;3
END LC_NUMERIC
NEW

Code: Select all

LC_NUMERIC
decimal_point             "<U002E>"
thousands_sep             ""
grouping                  0;0
END LC_NUMERIC
sudo locale-gen

and now the result of the test bash script is 56789.000000
Great, now I start Cumulus with the bash script

The result:

Code: Select all

2015-06-13 21:10:37.990  ========================== Cumulus MX starting ==========================
2015-06-13 21:10:38.035 Command line: /home/pi/CumulusMX/CumulusMX.exe -port 8998
2015-06-13 21:10:38.040 Cumulus MX v.3.0.0 build 3025
2015-06-13 21:10:38.066 Platform: Unix
2015-06-13 21:10:38.072 OS version: Unix 3.18.11.0
2015-06-13 21:10:38.073 Current culture: Dutch (Netherlands)
2015-06-13 21:10:38.074 Standard time zone name:   CET
2015-06-13 21:10:38.075 Daylight saving time name: CEST
2015-06-13 21:10:38.077 Daylight saving time? True
2015-06-13 21:10:38.084 13-6-2015 21:10:38
2015-06-13 21:10:38.092 Data path = data/
2015-06-13 21:10:38.129 Creating backup folder backup/20150613211038/
2015-06-13 21:10:38.399 Reading Cumulus.ini file
2015-06-13 21:10:38.686 ASM=10 AST=00:10:00
2015-06-13 21:10:38.712 Cumulus start date: 17-08-2013
2015-06-13 21:10:38.810 Debug logging is disabled
2015-06-13 21:10:38.811 Logging interval = 1
2015-06-13 21:10:39.567 Sunrise: 07:56:25
2015-06-13 21:10:39.568 Sunset : 20:03:38
2015-06-13 21:10:39.674 Station type: Davis Vantage Pro2
2015-06-13 21:10:39.683 WindUnit=km/h RainUnit=mm TempUnit=°C PressureUnit=hPa
2015-06-13 21:10:39.696 YTDRain=0,000 Year=0
2015-06-13 21:10:39.696 RainDayThreshold=-1,000
2015-06-13 21:10:39.697 Offsets and Multipliers:
2015-06-13 21:10:39.698 PO=0,000 TO=0,000 HO=0 WDO=0 ITO=0,000 UVO=0,000
2015-06-13 21:10:39.700 WSM=1,000 WGM=1,000 TM=1,000 TM2=1,000 HM=1,000 RM=1,000 UVM=1,000
2015-06-13 21:10:39.701 Spike removal:
2015-06-13 21:10:39.702 TD=999,000 GD=999,000 WD=999,000 HD=999,000 PD=999,000
2015-06-13 21:10:39.703 MR=999,000 MH=999,000
2015-06-13 21:10:39.704 Cumulus Starting
Cumulus still shows decimal commas.

Regards
Dinant

Re: Cumulus MX lang parameter

Posted: Sun 14 Jun 2015 9:36 am
by steve
I'll have a look to see what I can do when I get some time. But working with locales with Mono has turned out to be quite problematic, let alone 'mixed' locales. What version of Mono are you using?

Re: Cumulus MX lang parameter

Posted: Sun 14 Jun 2015 10:11 am
by rogerthn
steve wrote:... working with locales with Mono has turned out to be quite problematic ...
+1 :bash:
https://bugzilla.xamarin.com/show_bug.cgi?id=30851

Re: Cumulus MX lang parameter

Posted: Sun 14 Jun 2015 12:12 pm
by Dinant

Code: Select all

pi@raspberrypi ~ $ mono --version
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Re: Cumulus MX lang parameter

Posted: Sun 14 Jun 2015 12:22 pm
by steve
There are known issues with locales with decimal commas in Mono 3.2.8 (as documented elsewhere on the forum). Perhaps what you are seeing is another symptom of that.

Re: Cumulus MX lang parameter

Posted: Thu 25 Jun 2015 7:51 pm
by Dinant
I bought a Raspberry PI 2 and installed a recent version of mono 4.0.1 as explained in Later version of mono for Raspberry Pi 2.

Code: Select all

$ mono --version
Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:25:52 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. http://www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen
I've installed 3 languages en_US, en_GB and nl_NL.
nl_NL is set as the default language.

I've added the following text to the file .profile:

LC_NUMERIC="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"

After a reboot of the PI I got:

Code: Select all

$ locale
LANG=nl_NL.UTF-8
LANGUAGE=
LC_CTYPE="nl_NL.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME="nl_NL.UTF-8"
LC_COLLATE="nl_NL.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="nl_NL.UTF-8"
LC_PAPER="nl_NL.UTF-8"
LC_NAME="nl_NL.UTF-8"
LC_ADDRESS="nl_NL.UTF-8"
LC_TELEPHONE="nl_NL.UTF-8"
LC_MEASUREMENT="nl_NL.UTF-8"
LC_IDENTIFICATION="nl_NL.UTF-8"
LC_ALL=
Now I start CumulusMX without parameters and this is the resulting MXdiag file:

Code: Select all

2015-06-25 20:58:11.543  ========================== Cumulus MX starting ==========================
2015-06-25 20:58:11.579 Command line: /home/pi/CumulusMX/CumulusMX.exe
2015-06-25 20:58:11.581 Cumulus MX v.3.0.0 build 3025
2015-06-25 20:58:11.593 Platform: Unix
2015-06-25 20:58:11.598 OS version: Unix 3.18.11.7
2015-06-25 20:58:11.599 Current culture: Dutch (Netherlands)
2015-06-25 20:58:11.600 Standard time zone name:   CET
2015-06-25 20:58:11.600 Daylight saving time name: CEST
2015-06-25 20:58:11.605 Daylight saving time? True
2015-06-25 20:58:11.610 25-6-2015 20:58:11
2015-06-25 20:58:11.612 Data path = data/
2015-06-25 20:58:11.621 Creating backup folder backup/20150625205811/
2015-06-25 20:58:11.710 Reading Cumulus.ini file
2015-06-25 20:58:11.789 ASM=10 AST=00:10:00
2015-06-25 20:58:11.799 Cumulus start date: 25 June 2015
2015-06-25 20:58:11.823 Debug logging is disabled
2015-06-25 20:58:11.823 Logging interval = 10
2015-06-25 20:58:12.334 Sunrise: 07:58:57
2015-06-25 20:58:12.335 Sunset : 20:06:11
2015-06-25 20:58:12.375 Station type: Undefined
2015-06-25 20:58:12.377 WindUnit=m/s RainUnit=mm TempUnit=°C PressureUnit=mb
2015-06-25 20:58:12.381 YTDRain=0,000 Year=0
2015-06-25 20:58:12.382 RainDayThreshold=-1,000
2015-06-25 20:58:12.382 Offsets and Multipliers:
2015-06-25 20:58:12.382 PO=0,000 TO=0,000 HO=0 WDO=0 ITO=0,000 UVO=0,000
2015-06-25 20:58:12.383 WSM=1,000 WGM=1,000 TM=1,000 TM2=1,000 HM=1,000 RM=1,000 UVM=1,000
2015-06-25 20:58:12.383 Spike removal:
2015-06-25 20:58:12.383 TD=999,000 GD=999,000 WD=999,000 HD=999,000 PD=999,000
2015-06-25 20:58:12.384 MR=999,000 MH=999,000
2015-06-25 20:58:12.384 Cumulus Starting
2015-06-25 20:58:12.386 Opening station
2015-06-25 20:58:12.640 625 web tags initialised
2015-06-25 20:58:12.661 HTML root path = /home/pi/CumulusMX/interface
2015-06-25 20:58:13.029 Starting web socket server on port 8002
2015-06-25 21:00:59.079 Cumulus closing
2015-06-25 21:00:59.134 Writing Cumulus.ini file
So CumulusMX is still using decimal commas where the PI is configured to use decimal points. Dates are ok!

Changing the default language to en_GB and MXdiag shows:

Code: Select all

2015-06-25 21:20:51.712  ========================== Cumulus MX starting ==========================
2015-06-25 21:20:51.747 Command line: /home/pi/CumulusMX/CumulusMX.exe
2015-06-25 21:20:51.749 Cumulus MX v.3.0.0 build 3025
2015-06-25 21:20:51.761 Platform: Unix
2015-06-25 21:20:51.766 OS version: Unix 3.18.11.7
2015-06-25 21:20:51.767 Current culture: English (United Kingdom)
2015-06-25 21:20:51.768 Standard time zone name:   CET
2015-06-25 21:20:51.768 Daylight saving time name: CEST
2015-06-25 21:20:51.773 Daylight saving time? True
2015-06-25 21:20:51.778 25/06/2015 21:20:51
2015-06-25 21:20:51.780 Data path = data/
2015-06-25 21:20:51.789 Creating backup folder backup/20150625212051/
2015-06-25 21:20:51.879 Reading Cumulus.ini file
2015-06-25 21:20:51.958 ASM=10 AST=00:10:00
2015-06-25 21:20:51.966 Cumulus start date: 25 June 2015
2015-06-25 21:20:51.989 Debug logging is disabled
2015-06-25 21:20:51.989 Logging interval = 10
2015-06-25 21:20:52.501 Sunrise: 07:58:57
2015-06-25 21:20:52.501 Sunset : 20:06:11
2015-06-25 21:20:52.540 Station type: Undefined
2015-06-25 21:20:52.543 WindUnit=m/s RainUnit=mm TempUnit=°C PressureUnit=mb
2015-06-25 21:20:52.547 YTDRain=0.000 Year=0
2015-06-25 21:20:52.548 RainDayThreshold=-1.000
2015-06-25 21:20:52.548 Offsets and Multipliers:
2015-06-25 21:20:52.548 PO=0.000 TO=0.000 HO=0 WDO=0 ITO=0.000 UVO=0.000
2015-06-25 21:20:52.549 WSM=1.000 WGM=1.000 TM=1.000 TM2=1.000 HM=1.000 RM=1.000 UVM=1.000
2015-06-25 21:20:52.549 Spike removal:
2015-06-25 21:20:52.550 TD=999.000 GD=999.000 WD=999.000 HD=999.000 PD=999.000
2015-06-25 21:20:52.550 MR=999.000 MH=999.000
2015-06-25 21:20:52.550 Cumulus Starting
2015-06-25 21:20:52.552 Opening station
2015-06-25 21:20:52.807 625 web tags initialised
2015-06-25 21:20:52.828 HTML root path = /home/pi/CumulusMX/interface
2015-06-25 21:20:53.197 Starting web socket server on port 8002
2015-06-25 21:21:35.724 Cumulus closing
2015-06-25 21:21:35.774 Writing Cumulus.ini file
Now the numbers are ok, but the dates are not. They are shown with slashes.

Conclusion:
There is no difference (in Cumulus using decimal commas) between the Raspberry PI with mono 3.2.8 and the Raspberry PI 2 with mono 4.0.1.
steve wrote:Could be - it may not be picking up the changed setting, it may just use its built-in settings for the locale.
I think you are right!