プロジェクト

全般

プロフィール

Vote #80099

未完了

Detect browser locale and offer choice for datepicker

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
I18n_37
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
37
version_id:
0
issue_org_id:
31470
author_id:
5107
assigned_to_id:
0
comments:
2
status_id:
1
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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):
!screenshot-localhost-3000-2019.05.29-10-33-05.png!

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.


journals

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]]
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0