WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: wvdkuil on September 15, 2019, 07:00:35 AM

Title: Using locale.js in countries with multiple official languages
Post by: wvdkuil on September 15, 2019, 07:00:35 AM
Background:
For the next release of PWS_Dashboard (AKA another HWS template (https://pwsdashboard.com/pwsWD/)) I use canvasJS  for the graphs and moment.js+locale.js  for date and time formatting in the graphs.

It works as "advertised".  Change the language to "en-us" and the times are in "1:26 pm" format. Select "de-at" (German in Austria) prints  "13:26"

Question(s):
If you can check the languages used in your country and tell me if there are improvements needed for locale.js,  it would really help.
You can test your country/languages at their startpage https://momentjs.com/  scroll to the bottom.

Example: I thought that the date/time-display for a country was the same for all official languages spoken in that country.
For Belgium, where I live: three official languages, everyone uses 24 hour time format and  day-month.
Canada I thought uses always 24 hour but locales.js sets all times for Canada-English to am/pm time and Canada-French to 24 hour format.  Is that correct?

Why:
I want to use 1 setting where you select the default locale during setup.
And when selecting another language the time/date-formats  should be the changed the same for the php scripts (server-side) and the  javascripts (browser). 

Wim
Title: Re: Using locale.js in countries with multiple official languages
Post by: PaulMy on September 15, 2019, 09:32:10 AM
Quote
Canada I thought uses always 24 hour but locales.js sets all times for Canada-English to am/pm time and Canada-French to 24 hour format.  Is that correct?
Hi Wim,
Yes the common usage in English is am/pm and in French (primarily Quebec and parts of other provinces) as 24 hour.
Environment Canada for example  https://weather.gc.ca/city/pages/ab-52_metric_e.html and https://meteo.gc.ca/city/pages/ab-52_metric_f.html

Enjoy,
Paul



Title: Re: Using locale.js in countries with multiple official languages
Post by: wvdkuil on September 15, 2019, 09:49:41 AM
Quote
Canada I thought uses always 24 hour but locales.js sets all times for Canada-English to am/pm time and Canada-French to 24 hour format.  Is that correct?
Hi Wim,
Yes the common usage in English is am/pm and in French (primarily Quebec and parts of other provinces) as 24 hour.
Environment Canada for example  https://weather.gc.ca/city/pages/ab-52_metric_e.html and https://meteo.gc.ca/city/pages/ab-52_metric_f.html

Enjoy,
Paul
Thanks for the info.   [tup]  I will program it that way then for Canada.

Wim