Author Topic: Using locale.js in countries with multiple official languages  (Read 227 times)

0 Members and 1 Guest are viewing this topic.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1520
    • My PWS at Leuven Belgium Europe
Using locale.js in countries with multiple official languages
« on: September 15, 2019, 07:00:35 AM »
Background:
For the next release of PWS_Dashboard (AKA another HWS template) 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
Support for Leuven-Template & Scripts  at this forum
Support for the PWS_Dashboard (HWS-template) for WD a.o.  http://pwsdashboard.com/
Script sponsors https://support.leuven-template.eu/userlistScripts.php
Template sponsors https://support.leuven-template.eu/userlist.php

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 4581
    • KomokaWeather
Re: Using locale.js in countries with multiple official languages
« Reply #1 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



Davis Vantage Pro 2 Plus 24-FARS Wireless
Envoy/USB DataLogger/Cumulus v.1.9.4   -   Vue Console/WiFiLogger/CumulusMX
Komoka, ON  Canada
www.komokaweather.ca   www.komokaweather.com   www.komokaweather.com/weather28/  
www.komokaweather.com/pws/index.php
Blitzortung Station #1076 www.lightningmaps.org/blitzortung7/america/index.php?bo_page=statistics&bo_show=network&lang=en&bo_station_id=969


Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1520
    • My PWS at Leuven Belgium Europe
Re: Using locale.js in countries with multiple official languages
« Reply #2 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
Support for Leuven-Template & Scripts  at this forum
Support for the PWS_Dashboard (HWS-template) for WD a.o.  http://pwsdashboard.com/
Script sponsors https://support.leuven-template.eu/userlistScripts.php
Template sponsors https://support.leuven-template.eu/userlist.php