Commit 8f44d798 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

FilesApp: file list fails to draw due to invalid Hindi translations

util.bytesToString fails with an exception that prevents the file list
from drawing for Hindi language users. The exception is due to invalid
translation console translations of the SIZE_KB, SIZE_MB strings [1].

Mitigation: process these loadTimeData values before use. Convert them
to valid values (prevents the JS exception) and do this once only.

[1] The $1 portion of these message strings should not be touched, but
translation console is effectively converting them to $one in Hindi.

Bug: 908767
Change-Id: Ib5d741e501c3cf00e232b59366050778d732d906
Reviewed-on: https://chromium-review.googlesource.com/c/1353044
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarTatsuhisa Yamaguchi <yamaguchi@chromium.org>
Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612149}
parent 2f286bcd
......@@ -212,6 +212,23 @@ util.bytesToString = function(bytes) {
'SIZE_TB',
'SIZE_PB'];
// TODO(crbug.com/909997): remove this if clause when translations are fixed.
if (window.postProcessedLoadTimeData_ !== true) {
const language = loadTimeData.getString('language');
// Replace invalid Hindi SIZE units translations, crbug.com/908767.
if (language === 'hi') {
loadTimeData.overrideValues({
'SIZE_KB': '$1 केबी',
'SIZE_MB': '$1 एमबी',
});
}
if (typeof language === 'string') {
window.postProcessedLoadTimeData_ = true;
}
}
// Minimum values for the units above.
var STEPS = [0,
Math.pow(2, 10),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment