Feature #31470

Detect browser locale and offer choice for datepicker

Added by Aleksandar Pavic over 3 years ago. Updated about 3 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:I18n
Target version:-
Resolution:

Description

There is lot's of datepicker translations in /public/javascripts/i18n/

they are ignored, if browser supports input type = date, and displays browser built-in datepicker dropdown, then date locale (for datepicker language) is displayed in browser's language, instead of using translation.

Browser locale can't be changed from within page's javascript, take a look at:
[[https://stackoverflow.com/questions/3753999/how-do-i-change-the-browser-language-with-javascript]]

My suggestion is to offer admins or maybe even to user choice if they want to use browser locale, or Redmine's locale.

In case that they want to use Redmine's locale, then input type=date should not be used, but input type=text
there is such feature to detect it on datepickerFallback...

However if it's supported, then input type must be text, or following problem occurs (calendar over calendar):

So there should be peace of code which detects browser locale, and offers that choice, like

langs = request.env['HTTP_ACCEPT_LANGUAGE'].to_s.split(",").map do |lang| 
  l, q = lang.split(";q=")
  [l, (q || '1').to_f]
end
if(langs[0].first != current_language.to_s)
#offer choice for Redmine setting..


in application_helper

and if user chooses to use redmine's locale then on date fields, if that setting is choosen, input type = text...

Maybe somebody can write patch for this.

screenshot-localhost-3000-2019.05.29-10-33-05.png (25.2 KB) Aleksandar Pavic, 2019-05-29 10:34

History

#1 Updated by Aleksandar Pavic over 3 years ago

Update:

According to:

[[http://html5doctor.com/the-woes-of-date-input/]]

Built-in datepicker can be disabled on some browsers
[[http://trac.webkit.org/wiki/Styling%20Form%20Controls#Dateinputtype]]

#2 Updated by Go MAEDA about 3 years ago

  • Category changed from Translations to I18n

Also available in: Atom PDF