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

0 Members and 1 Guest are viewing this topic.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1684
    • 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 via https://support.leuven-template.eu/
Script sponsors support.leuven-template.eu/userlistScripts.php
Template sponsors support.leuven-template.eu/userlist.php

Support for the PWS_Dashboard  pwsdashboard.com

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 4703
    • 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




Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1684
    • 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 via https://support.leuven-template.eu/
Script sponsors support.leuven-template.eu/userlistScripts.php
Template sponsors support.leuven-template.eu/userlist.php

Support for the PWS_Dashboard  pwsdashboard.com

 

anything