DateTimePicker - Change locale

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
riverman
User
Posts: 158
Location: Stockholm/Sweden

DateTimePicker - Change locale

Post by riverman »

Hi,
I couldn't find any thing about DateTimePicker and locale settings. When using the extension I get the DateTimePicker in some other language then the PHPMaker project!

How can I change language/locale settings in DateTimePicker?


mobhar
User
Posts: 11712

Post by mobhar »

What PHPMaker version are you using? Try the latest version, 2018. Mine is working properly so far.

FYI, my web application is using only Indonesian language, and the locale for DateTimePicker is automatically be adjusted to Indonesian, too.


arbei
User
Posts: 9372

Post by arbei »

Update the locale of the DateTimePicker in [Tools] -> [Extensions] -> [Advanced] -> [Options] as below.

For example:
{"locale":"<your locale>"}

Check if your language ID is under <template>\moment\locale.


riverman
User
Posts: 158
Location: Stockholm/Sweden

Post by riverman »

Hi,
Thanks for help and sorry for not giving all information: PHPMaker 2018.0.3, multi-language project

Arbei: Yes it ({"locale":"sv"}) works and it helps me in other projects. But user can change language to English and calendar will of course then be in Swedish. Can this be changed dynamically in some way?


arbei
User
Posts: 9372

Post by arbei »

Make sure the "id" of the language file is corresponding to the "id" of the locale file in "moment/locale", and the corresponding locale will be loaded.


riverman
User
Posts: 158
Location: Stockholm/Sweden

Post by riverman »

Thanks!

You put me on the right direction of the problem. It was the language file that had wrong locale ID (<phrase id="locale" value="sv_SE"/>) it should only be 'sv' to work with moment.

This problem will probably occur again when I move the site from development to production server which is a Linux server. Do you (or anyone else) have a good solution how to handle different locale ids (eg. Windows <-> Linux)?


Webmaster
User
Posts: 9427

Post by Webmaster »

Server OS is irrelevant.


Post Reply