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

i18n: perf-budget and res-summary column headers #9127

Merged
merged 5 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion lighthouse-core/audits/network-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class NetworkRequests extends Audit {
itemType: 'bytes',
displayUnit: 'kb',
granularity: 1,
text: 'Transfer Size',
text: 'Transfer Size', // TODO(exterkamp): i18n this when i18n'ing this file
},
{
key: 'resourceSize',
Expand Down
10 changes: 6 additions & 4 deletions lighthouse-core/audits/performance-budget.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const UIStrings = {
=1 {1 request}
other {# requests}
}`,
/** Table column header for how displaying how much larger the size of network requests were than a predetermined budget. */
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/** Table column header for how displaying how much larger the size of network requests were than a predetermined budget. */
/** Table column header displaying: how much greater the quantity of network requests were than a predetermined budget, how much larger the size of network requests were than a predetermined budget. */

Copy link
Member Author

Choose a reason for hiding this comment

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

Integrated this with the column format from i18n.js

columnOverBudget: 'Over Budget',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
Expand Down Expand Up @@ -130,11 +132,11 @@ class ResourceBudget extends Audit {

/** @type { LH.Audit.Details.Table['headings'] } */
const headers = [
{key: 'label', itemType: 'text', text: 'Resource Type'},
{key: 'requestCount', itemType: 'numeric', text: 'Requests'},
{key: 'size', itemType: 'bytes', text: 'Transfer Size'},
{key: 'label', itemType: 'text', text: str_(i18n.UIStrings.columnResourceType)},
{key: 'requestCount', itemType: 'numeric', text: str_(i18n.UIStrings.columnRequests)},
{key: 'size', itemType: 'bytes', text: str_(i18n.UIStrings.columnTransferSize)},
{key: 'countOverBudget', itemType: 'text', text: ''},
{key: 'sizeOverBudget', itemType: 'bytes', text: 'Over Budget'},
{key: 'sizeOverBudget', itemType: 'bytes', text: str_(UIStrings.columnOverBudget)},
];

return {
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/audits/resource-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class ResourceSummary extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'label', itemType: 'text', text: 'Resource Type'},
{key: 'requestCount', itemType: 'numeric', text: 'Requests'},
{key: 'size', itemType: 'bytes', text: 'Transfer Size'},
{key: 'label', itemType: 'text', text: str_(i18n.UIStrings.columnResourceType)},
{key: 'requestCount', itemType: 'numeric', text: str_(i18n.UIStrings.columnRequests)},
{key: 'size', itemType: 'bytes', text: str_(i18n.UIStrings.columnTransferSize)},
];


Expand Down
16 changes: 16 additions & 0 deletions lighthouse-core/lib/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,10 @@
"message": "Server Backend Latencies",
"description": "Descriptive title of a Lighthouse audit that tells the user the server latencies observed from each origin the page connected to. This is displayed in a list of audit titles that Lighthouse generates."
},
"lighthouse-core/audits/performance-budget.js | columnOverBudget": {
"message": "Over Budget",
"description": "Table column header for how displaying how much larger the size of network requests were than a predetermined budget."
},
"lighthouse-core/audits/performance-budget.js | description": {
"message": "Keep the quantity and size of network requests under the targets set by the provided performance budget. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/budgets).",
"description": "Description of a Lighthouse audit where a user sets budgets for the quantity and size of page resources. No character length limits. 'Learn More' becomes link text to additional documentation."
Expand Down Expand Up @@ -1243,6 +1247,14 @@
"message": "Cache TTL",
"description": "Label for the TTL column in data tables, entries will be the time to live value of the cache header on a web resource"
},
"lighthouse-core/lib/i18n/i18n.js | columnRequests": {
"message": "Requests",
"description": "Label for the count of network requests column in data tables, entries will be the number of network requests done by a webpage."
},
"lighthouse-core/lib/i18n/i18n.js | columnResourceType": {
"message": "Resource Type",
"description": "Label for the type of network resource column in data tables, entries will be enumerated kinds of network requests e.g. \"Scripts\", \"Third-Party\", \"Stylesheet\"."
},
"lighthouse-core/lib/i18n/i18n.js | columnSize": {
"message": "Size",
"description": "Label for the size column in data tables, entries will be the size of a web resource in kilobytes"
Expand All @@ -1251,6 +1263,10 @@
"message": "Time Spent",
"description": "Label for the time spent column in data tables, entries will be the number of milliseconds spent during a particular activity"
},
"lighthouse-core/lib/i18n/i18n.js | columnTransferSize": {
"message": "Transfer Size",
"description": "Label for the transfer size of network requests column in data tables, entries will be the total bytes transferred of a group of network requests."
},
"lighthouse-core/lib/i18n/i18n.js | columnURL": {
"message": "URL",
"description": "Label for the URL column in data tables, entries will be the URL of a web resource"
Expand Down
6 changes: 6 additions & 0 deletions lighthouse-core/lib/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ const UIStrings = {
columnWastedMs: 'Potential Savings',
/** Label for the time spent column in data tables, entries will be the number of milliseconds spent during a particular activity */
columnTimeSpent: 'Time Spent',
/** Label for the type of network resource column in data tables, entries will be enumerated kinds of network requests e.g. "Scripts", "Third-Party", "Stylesheet".*/
Copy link
Member

Choose a reason for hiding this comment

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

not sure when these descriptions switched formats above, but the ones below (like totalResourceType) seem like they'd read a lot clearer to someone with no context (like, what's a "type of network resource column in data tables"?).

e.g.
Label for a row in a data table; entries will be types of resources loaded over the network, e.g. "Scripts", "Third-Party", "Stylesheet".
seems better

Copy link
Member Author

Choose a reason for hiding this comment

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

The ones below are different. Those are rows in the perf-budgets table, not the columns. That's why they're different. But I agree they're more clear.

columnResourceType: 'Resource Type',
/** Label for the count of network requests column in data tables, entries will be the number of network requests done by a webpage.*/
columnRequests: 'Requests',
/** Label for the transfer size of network requests column in data tables, entries will be the total bytes transferred of a group of network requests.*/
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
columnTransferSize: 'Transfer Size',
/** Label for a row in a data table; entries will be the total number and byte size of all resources loaded by a web page. */
totalResourceType: 'Total',
/** Label for a row in a data table; entries will be the total number and byte size of all 'Document' resources loaded by a web page. */
Expand Down
15 changes: 15 additions & 0 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5268,6 +5268,21 @@
"lighthouse-core/audits/performance-budget.js | description": [
"audits[performance-budget].description"
],
"lighthouse-core/lib/i18n/i18n.js | columnResourceType": [
"audits[performance-budget].details.headings[0].text",
"audits[resource-summary].details.headings[0].text"
],
"lighthouse-core/lib/i18n/i18n.js | columnRequests": [
"audits[performance-budget].details.headings[1].text",
"audits[resource-summary].details.headings[1].text"
],
"lighthouse-core/lib/i18n/i18n.js | columnTransferSize": [
"audits[performance-budget].details.headings[2].text",
"audits[resource-summary].details.headings[2].text"
],
"lighthouse-core/audits/performance-budget.js | columnOverBudget": [
"audits[performance-budget].details.headings[4].text"
],
"lighthouse-core/lib/i18n/i18n.js | scriptResourceType": [
"audits[performance-budget].details.items[0].label",
"audits[resource-summary].details.items[1].label"
Expand Down