New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 656922 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 0
Type: Bug



Sign in to add a comment

Page translation does not for German locale

Reported by yastrebo...@gmail.com, Oct 18 2016

Issue description

Chrome Version       : 54.0.2840.59 (64-bit)
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox:
         IE:

What steps will reproduce the problem?
(1) Go to http://www.berlin.de/ 
(2) Click translate icon in searchbar

What is the expected result?

Page is translated to english 

What happens instead?

Message appears "This page could not be translated"

Please provide any additional information below. Attach a screenshot if
possible.

The issue was introduced within https://codereview.chromium.org/2251273002
by commit 22e782e1834f4bbd7e12835210488c97f264951a

In components/translate/core/browser/translate_script.cc JSON is formed by use of printf %f format specifier:

var gtTimeInfo = {'fetchStart': %f, 'fetchEnd': %f};\n

which produces comma as decimal separator in de_DE.UTF-8 locale (and possibly other non en_US) and results in console error "VM167:2 Uncaught SyntaxError: Unexpected token ,"

Running chrome in en_US.UTF-8 locale fixes this.

Suggested solution is to form JSON via dedicated library or format floating point numbers manually according to JSON standard where decimal separator is dot.
 
Please correct title to "Page translation does not work for German locale"

Comment 2 by ftang@chromium.org, Oct 18 2016

Cc: groby@chromium.org zkoch@chromium.org juliecattiau@google.com
Labels: -Pri-3 Pri-0
Owner: ftang@chromium.org
Status: Assigned (was: Unconfirmed)
This looks like a P0 to me since it break a major feature. 

Comment 3 by ftang@chromium.org, Oct 18 2016

Could you reproduce this? I have hard time to reproduce this. Which OS are you running? 

Comment 4 by ftang@chromium.org, Oct 18 2016

I was not aware that StringAppendF is locale sensitive formatting when I wrote the code. This is actually scary. Implicit Locale model is so evil and cause so many problems in the last 30 years :( . patch is in https://codereview.chromium.org/2429873002/

The bug was landed in "Fri Aug 19 22:18:22 2016" before M54 branch off. It could be too late to cherrypick into M54 but we should for sure cherrypick this asap
I am running Ubuntu 14.04.5 LTS on x86_64

You can reproduce this by running
:~$ LC_NUMERIC="de_DE.UTF-8" google-chrome
I believe correct format specifier is "%.0f" since you want to express zero precision.

Comment 7 by ftang@chromium.org, Oct 18 2016

http://en.cppreference.com/w/cpp/io/c/fprintf

"%0.f" also mean 0 precision.

(optional) . followed by integer number or *, or neither that specifies precision of the conversion. In the case when * is used, the precision is specified by an additional argument of type int. If the value of this argument is negative, it is ignored. If neither a number nor * is used, the precision is taken as zero. 


Project Member

Comment 8 by bugdroid1@chromium.org, Oct 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b9d0a55329d102f77806a432896795e24b2bb916

commit b9d0a55329d102f77806a432896795e24b2bb916
Author: ftang <ftang@chromium.org>
Date: Tue Oct 25 21:46:28 2016

fix translate breakage under de_DE.UTF8 and other locale by avoiding locale sensitve formatting for float point

BUG= 656922 

Review-Url: https://codereview.chromium.org/2429873002
Cr-Commit-Position: refs/heads/master@{#427492}

[modify] https://crrev.com/b9d0a55329d102f77806a432896795e24b2bb916/components/translate/core/browser/translate_script.cc

Comment 9 by ftang@chromium.org, Oct 25 2016

Labels: Merge-Request-55
Is this change applicable to all os or any specific os?
Labels: M-55 M-54

Comment 12 by ftang@chromium.org, Oct 26 2016

The change is for all OS. I am not 100% sure it is needed for all OS (in other words, we only know at least in some OS under some locale it break, I am not sure all OS will have that issue unless I test it under all locale, which could be too hard to figure out). It break on Linux for sure. Not sure about Mac and Windows.

Comment 13 by groby@chromium.org, Oct 26 2016

FWIW, I spent some time digging (because it seemed weird to me you should need a format string), and the "standard" way to convert numbers to strings is DoubleToString. Or IntToString if you don't want precision anyways.

All OS's will format strings locale-specific if you use printf and friends.

I'd suggest changing the code to use DoubleToString and avoiding printf in general.
Labels: OS-All

Comment 15 by dimu@chromium.org, Oct 26 2016

Labels: -Merge-Request-55 Merge-Approved-55 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M55 (branch: 2883)

Comment 16 by ftang@chromium.org, Oct 26 2016

got the msg from Srinivasarao Mummareddy

"If possible could you please merge your change to M55 branch 2883 before tomorrow 4 PM PST." 

groby- Could you merge it into M55?
Project Member

Comment 17 by bugdroid1@chromium.org, Oct 26 2016

Labels: -merge-approved-55 merge-merged-2883
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/57799b8e472b0f97da2672d672530fc8c2b288ae

commit 57799b8e472b0f97da2672d672530fc8c2b288ae
Author: Rachel Blum <groby@google.com>
Date: Wed Oct 26 23:52:39 2016

[Merge to M55] Fix broken translation, remove local-dependent format

Was:
fix translate breakage under de_DE.UTF8 and other locale by avoiding locale sensitve formatting for float point

BUG= 656922 

Review-Url: https://codereview.chromium.org/2429873002
Cr-Commit-Position: refs/heads/master@{#427492}
(cherry picked from commit b9d0a55329d102f77806a432896795e24b2bb916)

Review URL: https://codereview.chromium.org/2454013002 .

Cr-Commit-Position: refs/branch-heads/2883@{#326}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[modify] https://crrev.com/57799b8e472b0f97da2672d672530fc8c2b288ae/components/translate/core/browser/translate_script.cc

Cc: bustamante@google.com ligim...@chromium.org
+ ligimole@, bustamante@ - FYI for M54
I'm not able to reproduce this on Linux, are there specific steps?  I don't think this meets the bar for merging into M54 (we're only taking critical fixes right now, like Chrome hangs or doesn't launch or a security vulnerability).
Project Member

Comment 20 by bugdroid1@chromium.org, Oct 27 2016

Labels: merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/57799b8e472b0f97da2672d672530fc8c2b288ae

commit 57799b8e472b0f97da2672d672530fc8c2b288ae
Author: Rachel Blum <groby@google.com>
Date: Wed Oct 26 23:52:39 2016

[Merge to M55] Fix broken translation, remove local-dependent format

Was:
fix translate breakage under de_DE.UTF8 and other locale by avoiding locale sensitve formatting for float point

BUG= 656922 

Review-Url: https://codereview.chromium.org/2429873002
Cr-Commit-Position: refs/heads/master@{#427492}
(cherry picked from commit b9d0a55329d102f77806a432896795e24b2bb916)

Review URL: https://codereview.chromium.org/2454013002 .

Cr-Commit-Position: refs/branch-heads/2883@{#326}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[modify] https://crrev.com/57799b8e472b0f97da2672d672530fc8c2b288ae/components/translate/core/browser/translate_script.cc

Verified on Chrome 55.0.2883.29/CrOS 8872.27.0 - Candy, Daisy, reks
Verified that the fix is working fine on CrOS bEta build # 8872.27.0/55.0.2883.29 - Paine, Blaze & Peppy.
Project Member

Comment 23 by sheriffbot@chromium.org, Nov 1 2016

Pri-0 bugs are critical regressions or serious emergencies, and this bug has not been updated in three days. Could you please provide an update, or adjust the priority to a more appropriate level if applicable?

If a fix is in active development, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Fixed (was: Assigned)

Comment 25 by dimu@google.com, Nov 4 2016

[Automated comment] removing mislabelled merge-merged-2840

Comment 26 by dimu@google.com, Nov 4 2016

Labels: -merge-merged-2840
[Automated comment] removing mislabelled merge-merged-2840
Bought Surface (Win 10 Pro) in January 2017. Installed Chrome and Translate extensions, but does nothing to translate French or German pages in Facebook. See for example, https://www.facebook.com/FRANCE24/app/121241974571942/

Nothing happens. Does FB block Chrome extensions on its pages? This wasn't the case  in the past.

Comment 29 by ftang@google.com, Mar 13 2017

this is a linux only bug, nothing to do with Win

Sign in to add a comment