Commit 3077cbf6 authored by Mandy Chen's avatar Mandy Chen Committed by Commit Bot

DevTools: Localize lighthouse strings when running audits

Currently lighthouse strings that are shown in the pop-up dialog when
running audits are not localized. This CL wraps them in ls and removes
the unnecessary localization calls.

Bug: 941561
Change-Id: I6296ecebaf46b216cb0259051065d1795303ba71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1785500Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#694611}
parent b5a0a970
...@@ -143,7 +143,7 @@ Audits.StatusView = class { ...@@ -143,7 +143,7 @@ Audits.StatusView = class {
*/ */
_getMessageForPhase(phase) { _getMessageForPhase(phase) {
if (phase.message) if (phase.message)
return Common.UIString(phase.message); return phase.message;
const deviceType = Audits.RuntimeSettings.find(item => item.setting.name === 'audits.device_type').setting.get(); const deviceType = Audits.RuntimeSettings.find(item => item.setting.name === 'audits.device_type').setting.get();
const throttling = Audits.RuntimeSettings.find(item => item.setting.name === 'audits.throttling').setting.get(); const throttling = Audits.RuntimeSettings.find(item => item.setting.name === 'audits.throttling').setting.get();
...@@ -151,7 +151,7 @@ Audits.StatusView = class { ...@@ -151,7 +151,7 @@ Audits.StatusView = class {
return item.deviceType === deviceType && item.throttling === throttling; return item.deviceType === deviceType && item.throttling === throttling;
}); });
return match ? ls`${match.message}` : ls`Lighthouse is loading your page`; return match ? match.message : ls`Lighthouse is loading your page`;
} }
/** /**
...@@ -297,14 +297,14 @@ Audits.StatusView.StatusPhases = [ ...@@ -297,14 +297,14 @@ Audits.StatusView.StatusPhases = [
{ {
id: 'gathering', id: 'gathering',
progressBarClass: 'gathering', progressBarClass: 'gathering',
message: 'Lighthouse is gathering information about the page to compute your score.', message: ls`Lighthouse is gathering information about the page to compute your score.`,
statusMessagePrefix: 'Gathering', statusMessagePrefix: 'Gathering',
order: 20, order: 20,
}, },
{ {
id: 'auditing', id: 'auditing',
progressBarClass: 'auditing', progressBarClass: 'auditing',
message: 'Almost there! Lighthouse is now generating your report.', message: ls`Almost there! Lighthouse is now generating your report.`,
statusMessagePrefix: 'Auditing', statusMessagePrefix: 'Auditing',
order: 30, order: 30,
} }
...@@ -315,42 +315,42 @@ Audits.StatusView.LoadingMessages = [ ...@@ -315,42 +315,42 @@ Audits.StatusView.LoadingMessages = [
{ {
deviceType: 'mobile', deviceType: 'mobile',
throttling: 'on', throttling: 'on',
message: 'Lighthouse is loading your page with throttling to measure performance on a mobile device on 3G.', message: ls`Lighthouse is loading your page with throttling to measure performance on a mobile device on 3G.`,
}, },
{ {
deviceType: 'desktop', deviceType: 'desktop',
throttling: 'on', throttling: 'on',
message: 'Lighthouse is loading your page with throttling to measure performance on a slow desktop on 3G.', message: ls`Lighthouse is loading your page with throttling to measure performance on a slow desktop on 3G.`,
}, },
{ {
deviceType: 'mobile', deviceType: 'mobile',
throttling: 'off', throttling: 'off',
message: 'Lighthouse is loading your page with mobile emulation.', message: ls`Lighthouse is loading your page with mobile emulation.`,
}, },
{ {
deviceType: 'desktop', deviceType: 'desktop',
throttling: 'off', throttling: 'off',
message: 'Lighthouse is loading your page.', message: ls`Lighthouse is loading your page.`,
}, },
]; ];
Audits.StatusView.FastFacts = [ Audits.StatusView.FastFacts = [
'1MB takes a minimum of 5 seconds to download on a typical 3G connection [Source: WebPageTest and DevTools 3G definition].', ls`1MB takes a minimum of 5 seconds to download on a typical 3G connection [Source: WebPageTest and DevTools 3G definition].`,
'Rebuilding Pinterest pages for performance increased conversion rates by 15% [Source: WPO Stats]', ls`Rebuilding Pinterest pages for performance increased conversion rates by 15% [Source: WPO Stats]`,
'BBC has seen a loss of 10% of their users for every extra second of page load [Source: WPO Stats]', ls`BBC has seen a loss of 10% of their users for every extra second of page load [Source: WPO Stats]`,
'By reducing the response size of JSON needed for displaying comments, Instagram saw increased impressions [Source: WPO Stats]', ls`By reducing the response size of JSON needed for displaying comments, Instagram saw increased impressions [Source: WPO Stats]`,
'Walmart saw a 1% increase in revenue for every 100ms improvement in page load [Source: WPO Stats]', ls`Walmart saw a 1% increase in revenue for every 100ms improvement in page load [Source: WPO Stats]`,
'If a site takes >1 second to become interactive, users lose attention, and their perception of completing the page task is broken [Source: Google Developers Blog]', ls`If a site takes >1 second to become interactive, users lose attention, and their perception of completing the page task is broken [Source: Google Developers Blog]`,
'75% of global mobile users in 2016 were on 2G or 3G [Source: GSMA Mobile]', ls`75% of global mobile users in 2016 were on 2G or 3G [Source: GSMA Mobile]`,
'The average user device costs less than 200 USD. [Source: International Data Corporation]', ls`The average user device costs less than 200 USD. [Source: International Data Corporation]`,
'53% of all site visits are abandoned if page load takes more than 3 seconds [Source: Google DoubleClick blog]', ls`53% of all site visits are abandoned if page load takes more than 3 seconds [Source: Google DoubleClick blog]`,
'19 seconds is the average time a mobile web page takes to load on a 3G connection [Source: Google DoubleClick blog]', ls`19 seconds is the average time a mobile web page takes to load on a 3G connection [Source: Google DoubleClick blog]`,
'14 seconds is the average time a mobile web page takes to load on a 4G connection [Source: Google DoubleClick blog]', ls`14 seconds is the average time a mobile web page takes to load on a 4G connection [Source: Google DoubleClick blog]`,
'70% of mobile pages take nearly 7 seconds for the visual content above the fold to display on the screen. [Source: Think with Google]', ls`70% of mobile pages take nearly 7 seconds for the visual content above the fold to display on the screen. [Source: Think with Google]`,
'As page load time increases from one second to seven seconds, the probability of a mobile site visitor bouncing increases 113%. [Source: Think with Google]', ls`As page load time increases from one second to seven seconds, the probability of a mobile site visitor bouncing increases 113%. [Source: Think with Google]`,
'As the number of elements on a page increases from 400 to 6,000, the probability of conversion drops 95%. [Source: Think with Google]', ls`As the number of elements on a page increases from 400 to 6,000, the probability of conversion drops 95%. [Source: Think with Google]`,
'70% of mobile pages weigh over 1MB, 36% over 2MB, and 12% over 4MB. [Source: Think with Google]', ls`70% of mobile pages weigh over 1MB, 36% over 2MB, and 12% over 4MB. [Source: Think with Google]`,
'Lighthouse only simulates mobile performance; to measure performance on a real device, try WebPageTest.org [Source: Lighthouse team]', ls`Lighthouse only simulates mobile performance; to measure performance on a real device, try WebPageTest.org [Source: Lighthouse team]`,
]; ];
/** @const */ /** @const */
......
...@@ -121,6 +121,9 @@ Click the reload button <ph name="RELOADBUTTON">$3s<ex>reload</ex></ph> or hit < ...@@ -121,6 +121,9 @@ Click the reload button <ph name="RELOADBUTTON">$3s<ex>reload</ex></ph> or hit <
<message name="IDS_DEVTOOLS_1b2c363066d5912ae8b27a1527f3d45e" desc="Text in Timeline Tree View of the Performance panel"> <message name="IDS_DEVTOOLS_1b2c363066d5912ae8b27a1527f3d45e" desc="Text in Timeline Tree View of the Performance panel">
Group by Domain Group by Domain
</message> </message>
<message name="IDS_DEVTOOLS_1c481aa99d081c32182011a758f73d33" desc="Duration text in the Performance panel">
<ph name="DURATIONTEXT">$1s<ex>100ms (at 200ms)</ex></ph>
</message>
<message name="IDS_DEVTOOLS_1e3eaaac8d3c9cffea8ee7f03a8a6121" desc="Text in Timeline UIUtils of the Performance panel"> <message name="IDS_DEVTOOLS_1e3eaaac8d3c9cffea8ee7f03a8a6121" desc="Text in Timeline UIUtils of the Performance panel">
DOMContentLoaded Event DOMContentLoaded Event
</message> </message>
......
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