Page MenuHomePhabricator

Fact application's chart library doesn't honour accept language browser setting.
Open, LowPublic

Description

In fact charts like https://secure.phabricator.com/fact/chart/?y1=N%3A* dates are wrongly localized, without respect for browser configuration.

Browser configuration:
Firefox returned "en,en-us;q=0.8,fr;q=0.6,fr-be;q=0.4,fr-fr;q=0.2" as HTTP_ACCEPT_LANGUAGE.
Keyboard and OS languages are french.

Expected behavior:
English l10n

Current behavior:
French l10n

Event Timeline

dereckson added a project: Phabricator.
dereckson added a subscriber: dereckson.

We're using .toLocaleDateString() in JS ourselves, here:

https://secure.phabricator.com/diffusion/P/browse/master/webroot/rsrc/js/application/maniphest/behavior-line-chart.js;8798d2189efcd2e2$34

So I guess your browser isn't respecting its own configuration. :)

There's some discussion of allowing users to specify date formats in {T1202}.

Once that's implemented we should probably do the date rendering on the server, although that could get kind of messy...

Indeed, according https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString .toLocaleDateString() follows system l10n parameters, not language user preference.

That's more annoying and could lead to some incoherence, but I guess this is fine for the majority of the users (who should have similar preferences in their OS and browser).

I guess to use the CLDR - http://cldr.unicode.org/ - could be a solution to have a coherent application localization but according my Wikimedia experience, this is rather hard to implement correctly.

chad changed the visibility from "All Users" to "Public (No Login Required)".Oct 5 2015, 8:49 PM
eadler added a project: Restricted Project.Jan 9 2016, 12:46 AM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jan 9 2016, 12:47 AM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 4 2016, 9:15 PM