Commit 47fe01c8 authored by Vidal Diazleal's avatar Vidal Diazleal Committed by Commit Bot

Devtools: Tab titles are not localizable

Tab titles in the devtools are not localizable, this PR makes the title function to actually use l10n tagged templates and fixes the following comment on the code:

third_party\blink\renderer\devtools\front_end\Runtime.js
// FIXME: should be Common.UIString() but runtime is not l10n aware yet.

Change-Id: I4a651e2f1b4ef0e0e6d07b54d52e44c17aeda057
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1554648
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: default avatarJoel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652717}
parent 21aaa18d
......@@ -378,6 +378,13 @@ var Runtime = class { // eslint-disable-line
return '\n/*# sourceURL=' + sourceURL + ' */';
}
/**
* @param {function(string):string} localizationFunction
*/
static setL10nCallback(localizationFunction) {
Runtime._l10nCallback = localizationFunction;
}
useTestBase() {
Runtime._remoteBase = 'http://localhost:8000/inspector-sources/';
if (Runtime.queryParam('debugFrontend'))
......@@ -890,8 +897,10 @@ Runtime.Extension = class {
* @return {string}
*/
title() {
// FIXME: should be Common.UIString() but runtime is not l10n aware yet.
return this._descriptor['title-' + Runtime._platform] || this._descriptor['title'];
const title = this._descriptor['title-' + Runtime._platform] || this._descriptor['title'];
if (title && Runtime._l10nCallback)
return Runtime._l10nCallback(title);
return title;
}
/**
......@@ -1071,6 +1080,10 @@ Runtime.experiments = new Runtime.ExperimentsSupport();
/** @type {Function} */
Runtime._appStartedPromiseCallback;
Runtime._appStartedPromise = new Promise(fulfil => Runtime._appStartedPromiseCallback = fulfil);
/** @type {function(string):string} */
Runtime._l10nCallback;
/**
* @type {?string}
*/
......
......@@ -62,6 +62,7 @@ Main.Main = class {
console.timeStamp('Main._loaded');
await Runtime.appStarted();
Runtime.setPlatform(Host.platform());
Runtime.setL10nCallback(ls);
InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this));
}
......
......@@ -733,7 +733,7 @@ SourceFrame.SourceFrame = class extends UI.SimpleView {
let textRange = selections[0];
if (textRange.isEmpty()) {
const location = this._prettyToRawLocation(textRange.endLine, textRange.endColumn);
this._sourcePosition.setText(`Line ${location[0] + 1}, Column ${location[1] + 1}`);
this._sourcePosition.setText(ls`Line ${location[0] + 1}, Column ${location[1] + 1}`);
return;
}
textRange = textRange.normalize();
......
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