Commit 1e559554 authored by Lorne Mitchell's avatar Lorne Mitchell Committed by Commit Bot

DevTools: Localize strings in the command menu

The commands that were added to the command menu (i.e. ctrl+shift+p) were not calling ls().

This fix does two things:
1. Adds a call to ls() for Action.title, Action.category
2. Adds an ls call for title and category arguments for CommandMenu.createCommand, CommandMenu.createRevealViewCommand, and CommandMenu.createSettingCommand

Before:
https://imgur.com/sWQWAqK

After:
https://imgur.com/2O4xq3k

Bug: 941561
Change-Id: I82944ecf2a9eeb47bb7824336b6ac49283829e42
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789843Reviewed-by: default avatarJeff Fisher <jeffish@microsoft.com>
Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#700310}
parent 023e6975
......@@ -42,7 +42,7 @@ QuickOpen.CommandMenu = class {
const tags = extension.descriptor()['tags'] || '';
const setting = Common.settings.moduleSetting(extension.descriptor()['settingName']);
return QuickOpen.CommandMenu.createCommand(
category, tags, title, '', setting.set.bind(setting, value), availableHandler);
ls(category), tags, title, '', setting.set.bind(setting, value), availableHandler);
/**
* @return {boolean}
......@@ -87,7 +87,7 @@ QuickOpen.CommandMenu = class {
for (const extension of viewExtensions) {
const category = locations.get(extension.descriptor()['location']);
if (category)
this._commands.push(QuickOpen.CommandMenu.createRevealViewCommand(extension, category));
this._commands.push(QuickOpen.CommandMenu.createRevealViewCommand(extension, ls(category)));
}
// Populate whitelisted settings.
......@@ -97,7 +97,7 @@ QuickOpen.CommandMenu = class {
if (!options || !extension.descriptor()['category'])
continue;
for (const pair of options)
this._commands.push(QuickOpen.CommandMenu.createSettingCommand(extension, pair['title'], pair['value']));
this._commands.push(QuickOpen.CommandMenu.createSettingCommand(extension, ls(pair['title']), pair['value']));
}
}
......
......@@ -155,7 +155,7 @@ UI.Action = class extends Common.Object {
* @return {string}
*/
category() {
return this._extension.descriptor()['category'] || '';
return ls(this._extension.descriptor()['category'] || '');
}
/**
......@@ -176,7 +176,7 @@ UI.Action = class extends Common.Object {
* @return {string}
*/
title() {
let title = this._extension.title();
let title = this._extension.title() || '';
const options = this._extension.descriptor()['options'];
if (options) {
for (const pair of options) {
......@@ -184,7 +184,7 @@ UI.Action = class extends Common.Object {
title = pair['title'];
}
}
return title;
return ls(title);
}
/**
......
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