Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report: translate newly added report strings #13308

Merged
merged 7 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8052,6 +8052,7 @@
"i18n": {
"rendererFormattedStrings": {
"calculatorLink": "See calculator.",
"collapseView": "Collapse view",
"crcInitialNavigation": "Initial Navigation",
"crcLongestDurationLabel": "Maximum critical path latency:",
"dropdownCopyJSON": "Copy JSON",
Expand All @@ -8064,7 +8065,9 @@
"dropdownViewer": "Open in Viewer",
"errorLabel": "Error!",
"errorMissingAuditInfo": "Report error: no audit information",
"expandView": "Expand view",
"footerIssue": "File an issue",
"hide": "Hide",
"labDataTitle": "Lab Data",
"lsPerformanceCategoryDescription": "[Lighthouse](https://developers.google.com/web/tools/lighthouse/) analysis of the current page on an emulated mobile network. Values are estimated and may vary.",
"manualAuditsGroupTitle": "Additional items to manually check",
Expand All @@ -8073,6 +8076,7 @@
"opportunitySavingsColumnLabel": "Estimated Savings",
"passedAuditsGroupTitle": "Passed audits",
"runtimeAnalysisWindow": "Initial page load",
"runtimeCustom": "Custom throttling",
"runtimeDesktopEmulation": "Emulated Desktop",
"runtimeMobileEmulation": "Emulated Moto G4",
"runtimeNoEmulation": "No emulation",
Expand All @@ -8084,7 +8088,9 @@
"runtimeSettingsUANetwork": "User agent (network)",
"runtimeSingleLoad": "Single page load",
"runtimeSingleLoadTooltip": "This data is taken from a single page load, as opposed to field data summarizing many sessions.",
"runtimeSlow4g": "Slow 4G throttling",
"runtimeUnknown": "Unknown",
"show": "Show",
"showRelevantAudits": "Show audits relevant to:",
"snippetCollapseButtonLabel": "Collapse snippet",
"snippetExpandButtonLabel": "Expand snippet",
Expand Down
16 changes: 14 additions & 2 deletions lighthouse-core/util-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class Util {
throttling.downloadThroughputKbps === 1.6 * 1024 * 0.9 &&
throttling.uploadThroughputKbps === 750 * 0.9;
};
summary = `${isSlow4G() ? 'Slow 4G' : 'Custom'} throttling by DevTools`;
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
break;
}
case 'simulate': {
Expand All @@ -432,7 +432,7 @@ class Util {
const isSlow4G = () => {
return rttMs === 150 && throughputKbps === 1.6 * 1024;
};
summary = isSlow4G() ? 'Simulated slow 4G' : 'Custom simulated throttling';
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
break;
}
default:
Expand Down Expand Up @@ -664,6 +664,18 @@ Util.UIStrings = {

/** Descriptive explanation for environment throttling that was provided by the runtime environment instead of provided by Lighthouse throttling. */
throttlingProvided: 'Provided by environment',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
show: 'Show',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
hide: 'Hide',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
expandView: 'Expand view',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
collapseView: 'Collapse view',
/** Label indicating that Lighthouse throttled the page to emulate a slow 4G network connection. */
runtimeSlow4g: 'Slow 4G throttling',
/** Label indicating that Lighthouse throttled the page using custom throttling settings. */
runtimeCustom: 'Custom throttling',
};


Expand Down
22 changes: 22 additions & 0 deletions proto/lighthouse-result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,28 @@ message I18n {
// Descriptive label that this analysis only considers the initial load of the page,
// and no interaction beyond when the page had "fully loaded"
string runtime_analysis_window = 51;

// Label for an interactive control that will reveal or hide a group of content.
// This control toggles between the text 'Show' and 'Hide'.
string show = 52;

// Label for an interactive control that will reveal or hide a group of content.
// This control toggles between the text 'Show' and 'Hide'.
string hide = 53;

// Label for an interactive control that will reveal or hide a group of content.
// This control toggles between the text 'Expand view' and 'Collapse view'.
string expand_view = 54;

// Label for an interactive control that will reveal or hide a group of content.
// This control toggles between the text 'Expand view' and 'Collapse view'.
string collapse_view = 55;

// Label indicating that Lighthouse throttled the page to emulate a slow 4G network connection.
string runtime_slow_4g = 56;

// Label indicating that Lighthouse throttled the page using custom throttling settings.
string runtime_custom = 57;
}

// The message holding all formatted strings used in the renderer.
Expand Down
14 changes: 10 additions & 4 deletions report/assets/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion report/assets/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
<!-- .lh-audit-group__description will be added here -->
<!-- .lh-metrics-toggle will be added here -->
</div>
<div class="lh-clump-toggle"></div>
<div class="lh-clump-toggle">
<span class="lh-clump-toggletext--show"></span>
<span class="lh-clump-toggletext--hide"></span>
</div>
</div>
</summary>
</details>
Expand Down
3 changes: 3 additions & 0 deletions report/renderer/category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ export class CategoryRenderer {
el.appendChild(descriptionEl);
}

this.dom.find('.lh-clump-toggletext--show', el).textContent = Util.i18n.strings.show;
this.dom.find('.lh-clump-toggletext--hide', el).textContent = Util.i18n.strings.hide;

clumpElement.classList.add(`lh-clump--${clumpId.toLowerCase()}`);
return el;
}
Expand Down
5 changes: 4 additions & 1 deletion report/renderer/components.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions report/renderer/performance-category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
const metricHeaderEl = this.dom.find('.lh-audit-group__header', metricsGroupEl);
const labelEl = this.dom.createChildOf(metricHeaderEl, 'label', 'lh-metrics-toggle__label');
labelEl.htmlFor = checkboxId;
const showEl = this.dom.createChildOf(labelEl, 'span', 'lh-metrics-toggle__labeltext--show');
const hideEl = this.dom.createChildOf(labelEl, 'span', 'lh-metrics-toggle__labeltext--hide');
showEl.textContent = Util.i18n.strings.expandView;
hideEl.textContent = Util.i18n.strings.collapseView;

const metricAudits = category.auditRefs.filter(audit => audit.group === 'metrics');
const metricsBoxesEl = this.dom.createElement('div', 'lh-metrics-container');
Expand Down
16 changes: 14 additions & 2 deletions report/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export class Util {
throttling.downloadThroughputKbps === 1.6 * 1024 * 0.9 &&
throttling.uploadThroughputKbps === 750 * 0.9;
};
summary = `${isSlow4G() ? 'Slow 4G' : 'Custom'} throttling by DevTools`;
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah perfect, now I can use this util function directly in #13305!

break;
}
case 'simulate': {
Expand All @@ -429,7 +429,7 @@ export class Util {
const isSlow4G = () => {
return rttMs === 150 && throughputKbps === 1.6 * 1024;
};
summary = isSlow4G() ? 'Simulated slow 4G' : 'Custom simulated throttling';
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
break;
}
default:
Expand Down Expand Up @@ -661,6 +661,18 @@ Util.UIStrings = {

/** Descriptive explanation for environment throttling that was provided by the runtime environment instead of provided by Lighthouse throttling. */
throttlingProvided: 'Provided by environment',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
show: 'Show',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
hide: 'Hide',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
expandView: 'Expand view',
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
collapseView: 'Collapse view',
/** Label indicating that Lighthouse throttled the page to emulate a slow 4G network connection. */
runtimeSlow4g: 'Slow 4G throttling',
/** Label indicating that Lighthouse throttled the page using custom throttling settings. */
runtimeCustom: 'Custom throttling',
};

export const UIStrings = Util.UIStrings;
18 changes: 18 additions & 0 deletions shared/localization/locales/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions shared/localization/locales/en-XL.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.