Commit 70e6a1c2 authored by Michael Checo's avatar Michael Checo Committed by Chromium LUCI CQ

Diagnostics: Localize remaining strings

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: I857f1c73e17fd2d3899d5c6f978f77e9aa0db32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2565774
Commit-Queue: Michael Checo <michaelcheco@google.com>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832342}
parent fb6cb385
...@@ -121,7 +121,7 @@ export function routineResultEntryTestSuite() { ...@@ -121,7 +121,7 @@ export function routineResultEntryTestSuite() {
assertEquals( assertEquals(
getNameText(), getNameText(),
loadTimeData.getStringF( loadTimeData.getStringF(
'routineNameText', 'routineEntryText',
loadTimeData.getString('cpuStressRoutineText'))); loadTimeData.getString('cpuStressRoutineText')));
// Status should be empty if the test is not started. // Status should be empty if the test is not started.
...@@ -138,7 +138,7 @@ export function routineResultEntryTestSuite() { ...@@ -138,7 +138,7 @@ export function routineResultEntryTestSuite() {
assertEquals( assertEquals(
getNameText(), getNameText(),
loadTimeData.getStringF( loadTimeData.getStringF(
'routineNameText', 'routineEntryText',
loadTimeData.getString('cpuStressRoutineText'))); loadTimeData.getString('cpuStressRoutineText')));
// Status should be running. // Status should be running.
...@@ -158,7 +158,7 @@ export function routineResultEntryTestSuite() { ...@@ -158,7 +158,7 @@ export function routineResultEntryTestSuite() {
assertEquals( assertEquals(
getNameText(), getNameText(),
loadTimeData.getStringF( loadTimeData.getStringF(
'routineNameText', 'routineEntryText',
loadTimeData.getString('cpuStressRoutineText'))); loadTimeData.getString('cpuStressRoutineText')));
// Status should show the passed result. // Status should show the passed result.
...@@ -178,7 +178,7 @@ export function routineResultEntryTestSuite() { ...@@ -178,7 +178,7 @@ export function routineResultEntryTestSuite() {
assertEquals( assertEquals(
getNameText(), getNameText(),
loadTimeData.getStringF( loadTimeData.getStringF(
'routineNameText', 'routineEntryText',
loadTimeData.getString('cpuStressRoutineText'))); loadTimeData.getString('cpuStressRoutineText')));
// Status should show the passed result. // Status should show the passed result.
...@@ -203,7 +203,7 @@ export function routineResultEntryTestSuite() { ...@@ -203,7 +203,7 @@ export function routineResultEntryTestSuite() {
assertEquals( assertEquals(
getNameText(), getNameText(),
loadTimeData.getStringF( loadTimeData.getStringF(
'routineNameText', 'routineEntryText',
loadTimeData.getString('batteryChargeRoutineText'))); loadTimeData.getString('batteryChargeRoutineText')));
// Status should show the passed result. // Status should show the passed result.
......
...@@ -727,6 +727,51 @@ Try tapping the mic to ask me anything. ...@@ -727,6 +727,51 @@ Try tapping the mic to ask me anything.
<message name="IDS_DISCHARGE_TEST_RESULT" desc="The result text for discharging routine." translateable="false"> <message name="IDS_DISCHARGE_TEST_RESULT" desc="The result text for discharging routine." translateable="false">
Discharged <ph name="RATE">$1<ex>10%</ex></ph> in <ph name="NUM_SECONDS">$1<ex>10</ex></ph> seconds. Discharged <ph name="RATE">$1<ex>10%</ex></ph> in <ph name="NUM_SECONDS">$1<ex>10</ex></ph> seconds.
</message> </message>
<message name="IDS_DIAGNOSTICS_TEST_FAILURE_TEXT" desc="The text displayed when a test fails." translateable="true">
Test failed
</message>
<message name="IDS_DIAGNOSTICS_TEST_SUCCESS_TEXT" desc="The text displayed when a test passes." translateable="true">
Test succeeded
</message>
<message name="IDS_DIAGNOSTICS_TEST_RUNNING_BADGE_TEXT" desc="The text displayed to indicate that a test is running." translateable="true">
RUNNING
</message>
<message name="IDS_DIAGNOSTICS_TEST_FAILURE_BADGE_TEXT" desc="The text displayed to indicate that a test failed." translateable="true">
FAILED
</message>
<message name="IDS_DIAGNOSTICS_TEST_SUCCESS_BADGE_TEXT" desc="The text displayed to indicate that a test passed." translateable="true">
SUCCESS
</message>
<message name="IDS_DIAGNOSTICS_TEST_RUNNING_TEXT" desc="The text displayed while a test is running." translateable="true">
Test running
</message>
<message name="IDS_DIAGNOSTICS_HIDE_REPORT_TEXT" desc="The text for the button that closes the test summary report." translateable="true">
Hide Report
</message>
<message name="IDS_DIAGNOSTICS_SEE_REPORT_TEXT" desc="The text for the button that shows the test summary report" translateable="true">
See Report
</message>
<message name="IDS_DIANOSTICS_ROUTINE_ENTRY_TEXT" desc="The text that shows the name of a test." translateable="true">
<ph name="TEST_NAME">$1<ex>Stress</ex></ph> Test
</message>
<message name="IDS_DIAGNOSTICS_CHARGE_RUN_TESTS_BUTTON_TEXT" desc="The text for the button used to run the battery charge test." translateable="true">
Run Charge test
</message>
<message name="IDS_DIAGNOSTICS_DISCHARGE_RUN_TESTS_BUTTON_TEXT" desc="The text for the button used to run the battery discharge test." translateable="true">
Run Discharge test
</message>
<message name="IDS_DIAGNOSTICS_CPU_RUN_TESTS_BUTTON_TEXT" desc="The text for the button used to run the CPU tests." translateable="true">
Run CPU test
</message>
<message name="IDS_DIAGNOSTICS_MEMORY_RUN_TESTS_BUTTON_TEXT" desc="The text for the button used to run the memory test." translateable="true">
Run Memory test
</message>
<message name="IDS_DIAGNOSTICS_RUN_AGAIN_BUTTON_TEXT" desc="The text for the button used to rerun a test." translateable="true">
Run again
</message>
<message name="IDS_DIAGNOSTICS_STOP_TEST_BUTTON_TEXT" desc="The text for the button used to stop a test." translateable="true">
Stop test
</message>
<!-- Quick Answers --> <!-- Quick Answers -->
<message name="IDS_QUICK_ANSWERS_DEFINITION_TITLE_TEXT" desc="The title text format string used for Quick Answers definition result card. The first placeholder contains the source query text and the second placeholder contains the phonetics."> <message name="IDS_QUICK_ANSWERS_DEFINITION_TITLE_TEXT" desc="The title text format string used for Quick Answers definition result card. The first placeholder contains the source query text and the second placeholder contains the phonetics.">
......
48460b87e4f31104b05ed47bcd467b43dc203605
\ No newline at end of file
2272adacc5b8d94ebe466cedb6eacc161aa45086
\ No newline at end of file
c881f00f58577bf59aac45e0998934031b31c1be
\ No newline at end of file
29f7c4c9cd69276dea9875b9963de8f252d7f50b
\ No newline at end of file
2272adacc5b8d94ebe466cedb6eacc161aa45086
\ No newline at end of file
68820f706ca59b90b200be0a0bb4cddcfb9ecf86
\ No newline at end of file
30b792e1ff8f17d862664cee9e14d8f728d0cca2
\ No newline at end of file
3f4504a25fc3b4b712570c0744416217d48c9a60
\ No newline at end of file
29f7c4c9cd69276dea9875b9963de8f252d7f50b
\ No newline at end of file
a05eca9f186972d5185c7e6a9d52358df10fc81a
\ No newline at end of file
c9429a03c4c6ca3db130068cdf88ddd16bf3ce89
\ No newline at end of file
c9429a03c4c6ca3db130068cdf88ddd16bf3ce89
\ No newline at end of file
c9429a03c4c6ca3db130068cdf88ddd16bf3ce89
\ No newline at end of file
2344539e12cd23784212566dca050ee51b5e5be7
\ No newline at end of file
29f7c4c9cd69276dea9875b9963de8f252d7f50b
\ No newline at end of file
...@@ -70,6 +70,7 @@ void AddDiagnosticsStrings(content::WebUIDataSource* html_source) { ...@@ -70,6 +70,7 @@ void AddDiagnosticsStrings(content::WebUIDataSource* html_source) {
{"deviceInfo", IDS_DIAGNOSTICS_DEVICE_INFO_TEXT}, {"deviceInfo", IDS_DIAGNOSTICS_DEVICE_INFO_TEXT},
{"diagnosticsTitle", IDS_DIAGNOSTICS_TITLE}, {"diagnosticsTitle", IDS_DIAGNOSTICS_TITLE},
{"dischargeTestResultText", IDS_DISCHARGE_TEST_RESULT}, {"dischargeTestResultText", IDS_DISCHARGE_TEST_RESULT},
{"hideReportText", IDS_DIAGNOSTICS_HIDE_REPORT_TEXT},
{"learnMore", IDS_DIANOSTICS_LEARN_MORE_LABEL}, {"learnMore", IDS_DIANOSTICS_LEARN_MORE_LABEL},
{"memoryAvailable", IDS_DIAGNOSTICS_MEMORY_AVAILABLE_LABEL}, {"memoryAvailable", IDS_DIAGNOSTICS_MEMORY_AVAILABLE_LABEL},
{"memoryRoutineText", IDS_DIAGNOSTICS_MEMORY_ROUTINE_TEXT}, {"memoryRoutineText", IDS_DIAGNOSTICS_MEMORY_ROUTINE_TEXT},
...@@ -77,8 +78,24 @@ void AddDiagnosticsStrings(content::WebUIDataSource* html_source) { ...@@ -77,8 +78,24 @@ void AddDiagnosticsStrings(content::WebUIDataSource* html_source) {
{"percentageLabel", IDS_DIAGNOSTICS_PERCENTAGE_LABEL}, {"percentageLabel", IDS_DIAGNOSTICS_PERCENTAGE_LABEL},
{"powerTime", IDS_DIAGNOSTICS_POWER_TIME_LABEL}, {"powerTime", IDS_DIAGNOSTICS_POWER_TIME_LABEL},
{"remainingCharge", IDS_DIAGNOSTICS_REMAINING_CHARGE_LABEL}, {"remainingCharge", IDS_DIAGNOSTICS_REMAINING_CHARGE_LABEL},
{"routineEntryText", IDS_DIANOSTICS_ROUTINE_ENTRY_TEXT},
{"routineNameText", IDS_DIANOSTICS_ROUTINE_NAME_TEXT}, {"routineNameText", IDS_DIANOSTICS_ROUTINE_NAME_TEXT},
{"runAgainButtonText", IDS_DIAGNOSTICS_RUN_AGAIN_BUTTON_TEXT},
{"runBatteryChargeTestText",
IDS_DIAGNOSTICS_CHARGE_RUN_TESTS_BUTTON_TEXT},
{"runBatteryDischargeTestText",
IDS_DIAGNOSTICS_DISCHARGE_RUN_TESTS_BUTTON_TEXT},
{"runCpuTestText", IDS_DIAGNOSTICS_CPU_RUN_TESTS_BUTTON_TEXT},
{"runMemoryTestText", IDS_DIAGNOSTICS_MEMORY_RUN_TESTS_BUTTON_TEXT},
{"seeReportText", IDS_DIAGNOSTICS_HIDE_REPORT_TEXT},
{"sessionLog", IDS_DIAGNOSTICS_SESSION_LOG_LABEL}, {"sessionLog", IDS_DIAGNOSTICS_SESSION_LOG_LABEL},
{"stopTestButtonText", IDS_DIAGNOSTICS_STOP_TEST_BUTTON_TEXT},
{"testFailure", IDS_DIAGNOSTICS_TEST_FAILURE_TEXT},
{"testFailedBadgeText", IDS_DIAGNOSTICS_TEST_FAILURE_BADGE_TEXT},
{"testRunning", IDS_DIAGNOSTICS_TEST_RUNNING_TEXT},
{"testRunningBadgeText", IDS_DIAGNOSTICS_TEST_RUNNING_BADGE_TEXT},
{"testSuccess", IDS_DIAGNOSTICS_TEST_SUCCESS_TEXT},
{"testSucceededBadgeText", IDS_DIAGNOSTICS_TEST_SUCCESS_BADGE_TEXT},
{"totalMemory", IDS_DIAGNOSTICS_TOTAL_MEMORY_LABEL}, {"totalMemory", IDS_DIAGNOSTICS_TOTAL_MEMORY_LABEL},
{"usedMemory", IDS_DIAGNOSTICS_USED_MEMORY_LABEL}, {"usedMemory", IDS_DIAGNOSTICS_USED_MEMORY_LABEL},
}; };
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
</data-point> </data-point>
<routine-section slot="routines" routines="[[routines_]]" <routine-section slot="routines" routines="[[routines_]]"
is-test-running="{{isTestRunning}}"> is-test-running="{{isTestRunning}}"
run-tests-button-text="[[getRunTestsButtonText_(
batteryChargeStatus_.powerAdapterStatus
)]]">
</routine-section> </routine-section>
</diagnostics-card> </diagnostics-card>
...@@ -191,4 +191,13 @@ Polymer({ ...@@ -191,4 +191,13 @@ Polymer({
return loadTimeData.getStringF( return loadTimeData.getStringF(
'currentNowText', this.batteryChargeStatus_.currentNowMilliamps); 'currentNowText', this.batteryChargeStatus_.currentNowMilliamps);
}, },
/** @protected */
getRunTestsButtonText_() {
return loadTimeData.getString(
this.batteryChargeStatus_.powerAdapterStatus ===
chromeos.diagnostics.mojom.ExternalPowerSource.kDisconnected ?
'runBatteryDischargeTestText' :
'runBatteryChargeTestText')
}
}); });
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
value=""> value="">
</data-point> </data-point>
<routine-section slot="routines" routines="[[routines_]]" <routine-section slot="routines" routines="[[routines_]]"
is-test-running="{{isTestRunning}}"> is-test-running="{{isTestRunning}}"
run-tests-button-text="[[i18n('runCpuTestText')]]">
</routine-section> </routine-section>
</diagnostics-card> </diagnostics-card>
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
max="[[memoryUsage_.totalMemoryKib]]"> max="[[memoryUsage_.totalMemoryKib]]">
</percent-bar-chart> </percent-bar-chart>
<routine-section slot="routines" routines="[[routines_]]" <routine-section slot="routines" routines="[[routines_]]"
is-test-running="{{isTestRunning}}"> is-test-running="{{isTestRunning}}"
run-tests-button-text="[[i18n('runMemoryTestText')]]">
</routine-section> </routine-section>
</diagnostics-card> </diagnostics-card>
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
</style> </style>
<div class="entryRow"> <div class="entryRow">
<!-- TODO(zentaro): Create mapping to localized strings. -->
<div id="routine">[[routineType_]]</div> <div id="routine">[[routineType_]]</div>
<text-badge id="status" badge-type="[[getBadgeType_(item.progress, item.result)]]" <text-badge id="status" badge-type="[[getBadgeType_(item.progress, item.result)]]"
value="[[getBadgeText_(item.progress, item.result)]]" value="[[getBadgeText_(item.progress, item.result)]]"
......
...@@ -70,7 +70,7 @@ Polymer({ ...@@ -70,7 +70,7 @@ Polymer({
* @return {string} * @return {string}
*/ */
getRunningRoutineString_(routine) { getRunningRoutineString_(routine) {
return loadTimeData.getStringF('routineNameText', getRoutineType(routine)); return loadTimeData.getStringF('routineEntryText', getRoutineType(routine));
}, },
/** /**
...@@ -98,25 +98,23 @@ Polymer({ ...@@ -98,25 +98,23 @@ Polymer({
* @protected * @protected
*/ */
getBadgeText_() { getBadgeText_() {
// TODO(joonbug): Localize this string.
if (this.item.progress === ExecutionProgress.kRunning) { if (this.item.progress === ExecutionProgress.kRunning) {
return 'RUNNING'; return loadTimeData.getString('testRunningBadgeText');
} }
if (this.item.result && if (this.item.result &&
this.getSimpleResult_(this.item.result) === this.getSimpleResult_(this.item.result) ===
chromeos.diagnostics.mojom.StandardRoutineResult.kTestPassed) { chromeos.diagnostics.mojom.StandardRoutineResult.kTestPassed) {
return 'SUCCESS'; return loadTimeData.getString('testSucceededBadgeText');
} }
return 'FAILED'; return loadTimeData.getString('testFailedBadgeText');
}, },
/** /**
* @protected * @protected
*/ */
getBadgeType_() { getBadgeType_() {
// TODO(joonbug): Localize this string.
if (this.item.progress === ExecutionProgress.kRunning) { if (this.item.progress === ExecutionProgress.kRunning) {
return BadgeType.DEFAULT; return BadgeType.DEFAULT;
} }
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
<div id="routineSection"> <div id="routineSection">
<cr-button id="runTestsButton" class="action-button" on-click="onRunTestsClicked_" <cr-button id="runTestsButton" class="action-button" on-click="onRunTestsClicked_"
disabled="[[isTestRunning]]"> disabled="[[isTestRunning]]">
<!-- TODO(zentaro): Localize this string. --> [[runTestsButtonText]]
Run Tests
</cr-button> </cr-button>
<cr-button id="toggleReportButton" class="action-button" on-click="onToggleReportClicked_" <cr-button id="toggleReportButton" class="action-button" on-click="onToggleReportClicked_"
hidden="[[isResultAndStatusHidden_(executionStatus_)]]"> hidden="[[isResultAndStatusHidden_(executionStatus_)]]">
......
...@@ -84,6 +84,12 @@ Polymer({ ...@@ -84,6 +84,12 @@ Polymer({
type: Boolean, type: Boolean,
value: true, value: true,
}, },
/** @type {string} */
runTestsButtonText: {
type: String,
value: '',
},
}, },
/** @private */ /** @private */
...@@ -160,8 +166,8 @@ Polymer({ ...@@ -160,8 +166,8 @@ Polymer({
/** @protected */ /** @protected */
getReportToggleButtonText_() { getReportToggleButtonText_() {
// TODO(joonbug): Localize this string. return loadTimeData.getString(
return this.isReportListHidden_ ? 'See Report' : 'Hide Report'; this.isReportListHidden_ ? 'seeReportText' : 'hideReportText');
}, },
/** @protected */ /** @protected */
...@@ -177,11 +183,12 @@ Polymer({ ...@@ -177,11 +183,12 @@ Polymer({
/** @protected */ /** @protected */
getBadgeText_() { getBadgeText_() {
// TODO(joonbug): Localize this string.
if (this.executionStatus_ === ExecutionProgress.kRunning) { if (this.executionStatus_ === ExecutionProgress.kRunning) {
return 'Test running'; return loadTimeData.getString('testRunning');
} }
return this.hasTestFailure_ ? 'FAILED' : 'SUCCESS'; return loadTimeData.getString(
this.hasTestFailure_ ? 'testFailedBadgeText' :
'testSucceededBadgeText');
}, },
/** @protected */ /** @protected */
...@@ -189,7 +196,8 @@ Polymer({ ...@@ -189,7 +196,8 @@ Polymer({
if (this.executionStatus_ === ExecutionProgress.kRunning) { if (this.executionStatus_ === ExecutionProgress.kRunning) {
return this.currentTestName_; return this.currentTestName_;
} }
return this.hasTestFailure_ ? 'Test failed' : 'Test succeeded'; return loadTimeData.getString(
this.hasTestFailure_ ? 'testFailure' : 'testSuccess');
}, },
/** @override */ /** @override */
......
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