Skip to content

Commit

Permalink
shortcuts: Add strings for various parts of the UI throughout the app
Browse files Browse the repository at this point in the history
Bug: b/216049298
Test: browser_tests --gtest_filter=ShortcutCustomizationApp*
Change-Id: I21e7817b44fadbe29c6cdf3f9974d02fec76f397
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4112411
Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Camden Bickel <cambickel@google.com>
Cr-Commit-Position: refs/heads/main@{#1084459}
  • Loading branch information
Cam Bickel authored and Chromium LUCI CQ committed Dec 16, 2022
1 parent d89a2df commit 65e6bd2
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 22 deletions.
Expand Up @@ -70,8 +70,7 @@
<cr-button id="addAcceleratorButton" on-click="onAddAcceleratorClicked_">
<iron-icon id="addIcon" icon="shortcut-customization:add">
</iron-icon>
<!-- TODO(jimmyxgong): Localize this string -->
Add shortcut
[[i18n('addShortcut')]]
</cr-button>
</div>

Expand All @@ -80,15 +79,13 @@
<div>
<cr-button id="restoreDefault" on-click="onRestoreDefaultButtonClicked_"
hidden$="[[isAcceleratorCapturing_]]">
<!-- TODO(jimmyxgong): i18n string -->
Restore defaults
[[i18n('restoreDefaults')]]
</cr-button>
</div>
<div>
<cr-button id="doneButton" on-click="onDoneButtonClicked_"
disabled="[[isAcceleratorCapturing_]]">
<!-- TODO(jimmyxgong): Localize this string -->
Done
[[i18n('editDialogDone')]]
</cr-button>
</div>
</div>
Expand Down
Expand Up @@ -9,6 +9,7 @@ import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js';
import 'chrome://resources/cr_elements/cr_input/cr_input.js';

import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js';
import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js';
import {assert} from 'chrome://resources/js/assert_ts.js';
import {DomRepeat, flush, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

Expand All @@ -35,7 +36,10 @@ declare global {
* a given shortcut. Allows users to edit the accelerators.
* TODO(jimmyxgong): Implement editing accelerators.
*/
export class AcceleratorEditDialogElement extends PolymerElement {
const AcceleratorEditDialogElementBase = I18nMixin(PolymerElement);

export class AcceleratorEditDialogElement extends
AcceleratorEditDialogElementBase {
static get is() {
return 'accelerator-edit-dialog';
}
Expand Down
Expand Up @@ -68,8 +68,7 @@
</div>
<div id="cancelButtonContainer" hidden="[[!showEditView_(viewState)]]">
<cr-button id="cancelButton" on-click="onCancelButtonClicked_">
<!-- TODO(jimmyxgong): Localize string -->
cancel
[[i18n('cancel')]]
</cr-button>
</div>
</template>
Expand Down
Expand Up @@ -9,6 +9,7 @@ import 'chrome://resources/cr_elements/cr_icons.css.js';
import 'chrome://resources/cr_elements/icons.html.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';

import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {getTemplate} from './accelerator_edit_view.html.js';
Expand Down Expand Up @@ -50,7 +51,9 @@ const defaultAcceleratorInfoState: DefaultAcceleratorInfo = {
* responsible for displaying the edit/remove buttons to an accelerator and also
* displaying context or errors strings for an accelerator.
*/
export class AcceleratorEditViewElement extends PolymerElement {
const AcceleratorEditViewElementBase = I18nMixin(PolymerElement);

export class AcceleratorEditViewElement extends AcceleratorEditViewElementBase {
static get is() {
return 'accelerator-edit-view';
}
Expand Down Expand Up @@ -122,9 +125,7 @@ export class AcceleratorEditViewElement extends PolymerElement {

protected onStatusMessageChanged_() {
if (this.statusMessage === '') {
// TODO(jimmyxgong): i18n this string.
this.statusMessage =
'Press 1-4 modifiers and 1 other key on your keyboard';
this.statusMessage = this.i18n('editViewStatusMessage');
}
}

Expand Down
Expand Up @@ -38,14 +38,12 @@
margin-inline-start: 12px;
}
</style>
<!-- TODO(jimmyxgong): Localize this title -->
<navigation-view-panel id="navigationPanel" title="[[i18n('appTitle')]]"
show-tool-bar>
<div slot="bottom-nav-content-panel" id="bottomNavContentPanel">
<cr-button id="restoreAllButton" on-click="onRestoreAllDefaultClicked_"
hidden="[[shouldHideRestoreAllButton_()]]">
<!-- TODO(jimmyxgong): i18n this string-->
Reset all shortcuts
[[i18n('resetAllShortcuts')]]
</cr-button>
<div id="keyboardSettingsLinkContainer">
<a href="chrome://os-settings/keyboard-overlay">
Expand All @@ -69,18 +67,15 @@
<cr-dialog id="restoreDialog" show-on-attach
on-close="closeRestoreAllDialog_">
<div slot="body">
<!-- TODO(jimmyxgong): i18n string -->
Reset all shortcuts to defaults?
[[i18n('confirmResetAllShortcutsTitle')]]
</div>
<div slot="button-container">
<cr-button id="cancelButton" on-click="onCancelRestoreButtonClicked_">
<!-- TODO(jimmyxgong): i18n string -->
Cancel
[[i18n('cancel')]]
</cr-button>
<cr-button class="action-button"
on-click="onConfirmRestoreButtonClicked_">
<!-- TODO(jimmyxgong): i18n string -->
Reset
[[i18n('confirmResetAllShortcutsButton')]]
</cr-button>
</div>
</cr-dialog>
Expand Down
Expand Up @@ -41,6 +41,17 @@ void AddLocalizedStrings(content::WebUIDataSource* source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"appTitle", IDS_SHORTCUT_CUSTOMIZATION_APP_TITLE},
{"keyboardSettings", IDS_SHORTCUT_CUSTOMIZATION_KEYBOARD_SETTINGS},
{"addShortcut", IDS_SHORTCUT_CUSTOMIZATION_ADD_SHORTCUT},
{"restoreDefaults", IDS_SHORTCUT_CUSTOMIZATION_RESTORE_DEFAULTS},
{"editDialogDone", IDS_SHORTCUT_CUSTOMIZATION_EDIT_DIALOG_DONE},
{"cancel", IDS_SHORTCUT_CUSTOMIZATION_CANCEL},
{"editViewStatusMessage",
IDS_SHORTCUT_CUSTOMIZATION_EDIT_VIEW_STATUS_MESSAGE},
{"resetAllShortcuts", IDS_SHORTCUT_CUSTOMIZATION_RESET_ALL_SHORTCUTS},
{"confirmResetAllShortcutsTitle",
IDS_SHORTCUT_CUSTOMIZATION_CONFIRM_RESET_ALL_SHORTCUTS_TITLE},
{"confirmResetAllShortcutsButton",
IDS_SHORTCUT_CUSTOMIZATION_CONFIRM_RESET_SHORTCUTS_BUTTON},
{"categoryTabsAndWindows",
IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_TABS_AND_WINDOWS},
{"categoryPageAndWebBrowser",
Expand Down
24 changes: 24 additions & 0 deletions chromeos/chromeos_strings.grd
Expand Up @@ -3663,6 +3663,30 @@ Try tapping the mic to ask me anything.
<message name="IDS_SHORTCUT_CUSTOMIZATION_KEYBOARD_SETTINGS" desc="Label for link to open keyboard settings in the Settings app." translateable="false">
Keyboard settings
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_ADD_SHORTCUT" desc="Button label to add a new shortcut for a specific action" translateable="false">
Add shortcut
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_RESTORE_DEFAULTS" desc="Button label to restore a specific action to its default shortcuts" translateable="false">
Restore defaults
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_EDIT_DIALOG_DONE" desc="Used to close edit shortcuts modal dialog" translateable="false">
Done
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CANCEL" desc="Used to cancel action in various modals" translateable="false">
Cancel
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_EDIT_VIEW_STATUS_MESSAGE" desc="Instructions to user when they're inputting a new shortcut" translateable="false">
Press 1-4 modifiers and 1 other key on your keyboard
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_RESET_ALL_SHORTCUTS" desc="Button label to reset all shortcuts in the app to their default values" translateable="false">
Reset all shortcuts
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CONFIRM_RESET_ALL_SHORTCUTS_TITLE" desc="Title of the modal shown when user clicks button to reset all shortcuts" translateable="false">
Reset all shortcuts to defaults?
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CONFIRM_RESET_SHORTCUTS_BUTTON" desc="Button label for action that confirms resetting all shortcuts to their default values" translateable="false">
Reset
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_TABS_AND_WINDOWS" desc="Category named 'Tabs and Windows' shown on the navigation sidebar" translateable="false">Tabs &#38; Windows</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_PAGE_AND_WEB_BROWSER" desc="Category named 'Page and Web Browser' shown on the navigation sidebar" translateable="false">Page &#38; Web Browser</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_SYSTEM_AND_DISPLAY_SETTINGS" desc="Category named 'System and Display Settings' shown on the navigation sidebar" translateable="false">System &#38; Display Settings</message>
Expand Down

0 comments on commit 65e6bd2

Please sign in to comment.