Skip to content

Commit a6dc735

Browse files
authored
i18n: remove translated messages when ICU arguments change (GoogleChrome#9598)
1 parent ce38dd7 commit a6dc735

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+298
-283
lines changed

lighthouse-core/lib/i18n/i18n.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function lookupLocale(locale) {
145145
function _preformatValues(icuMessage, messageFormatter, values = {}) {
146146
const clonedValues = JSON.parse(JSON.stringify(values));
147147

148-
const elements = _collectAllCustomElementsFromICU(messageFormatter.getAst().elements);
148+
const elements = collectAllCustomElementsFromICU(messageFormatter.getAst().elements);
149149

150150
return _processParsedElements(icuMessage, Array.from(elements.values()), clonedValues);
151151
}
@@ -165,10 +165,10 @@ function _preformatValues(icuMessage, messageFormatter, values = {}) {
165165
* thus they are stored via a Map keyed on the "id" which is the ICU varName.
166166
*
167167
* @param {Array<MessageElement>} icuElements
168-
* @param {Map<string, ArgumentElement>} seenElementsById
168+
* @param {Map<string, ArgumentElement>} [seenElementsById]
169169
* @return {Map<string, ArgumentElement>}
170170
*/
171-
function _collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map()) {
171+
function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map()) {
172172
for (const el of icuElements) {
173173
// We are only interested in elements that need ICU formatting (argumentElements)
174174
if (el.type !== 'argumentElement') continue;
@@ -180,7 +180,7 @@ function _collectAllCustomElementsFromICU(icuElements, seenElementsById = new Ma
180180
// Look at all options of the plural (=1{} =other{}...)
181181
for (const option of el.format.options) {
182182
// Run collections on each option's elements
183-
_collectAllCustomElementsFromICU(option.value.elements, seenElementsById);
183+
collectAllCustomElementsFromICU(option.value.elements, seenElementsById);
184184
}
185185
}
186186

@@ -473,4 +473,5 @@ module.exports = {
473473
getFormattedFromIdAndValues,
474474
replaceIcuMessageInstanceIds,
475475
isIcuMessage,
476+
collectAllCustomElementsFromICU,
476477
};

lighthouse-core/lib/i18n/locales/ar-XB.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "‏‮Tap‬‏ ‏‮targets‬‏ ‏‮are‬‏ ‏‮sized‬‏ ‏‮appropriately‬‏"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "‏‮Main‬‏ ‏‮Thread‬‏ ‏‮Time‬‏"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "‏‮Third‬‏-‏‮Party‬‏"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "‏‮Third‬‏-‏‮party‬‏ ‏‮code‬‏ ‏‮can‬‏ ‏‮significantly‬‏ ‏‮impact‬‏ ‏‮load‬‏ ‏‮performance‬‏. ‏‮Limit‬‏ ‏‮the‬‏ ‏‮number‬‏ ‏‮of‬‏ ‏‮redundant‬‏ ‏‮third‬‏-‏‮party‬‏ ‏‮providers‬‏ ‏‮and‬‏ ‏‮try‬‏ ‏‮to‬‏ ‏‮load‬‏ ‏‮third‬‏-‏‮party‬‏ ‏‮code‬‏ ‏‮after‬‏ ‏‮your‬‏ ‏‮page‬‏ ‏‮has‬‏ ‏‮primarily‬‏ ‏‮finished‬‏ ‏‮loading‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{1 ‏‮Third‬‏-‏‮Party‬‏ ‏‮Found‬‏}zero{# ‏‮Third‬‏-‏‮Parties‬‏ ‏‮Found‬‏}two{# ‏‮Third‬‏-‏‮Parties‬‏ ‏‮Found‬‏}few{# ‏‮Third‬‏-‏‮Parties‬‏ ‏‮Found‬‏}many{# ‏‮Third‬‏-‏‮Parties‬‏ ‏‮Found‬‏}other{# ‏‮Third‬‏-‏‮Parties‬‏ ‏‮Found‬‏}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "‏‮Third‬‏-‏‮Party‬‏ ‏‮Usage‬‏"
988982
},

lighthouse-core/lib/i18n/locales/ar.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "يتم تحديد حجم أهداف النقر بشكل مناسب"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "وقت سلسلة المحادثات الأساسية"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "الجهة الخارجية"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "يمكن أن يؤثر رمز الجهة الخارجية بشكل كبير في أداء التحميل. يمكنك تحديد عدد مقدِّمي الخدمة للجهات الخارجية المتكرّرين ومحاولة تحميل رمز الجهة الخارجية بعد انتهاء تحميل صفحتك بشكل أساسي. [مزيد من المعلومات](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)"
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{تم العثور على جهة خارجية واحدة}zero{تم العثور على # جهة خارجية}two{تم العثور على جهتين خارجيتين (#)}few{تم العثور على # جهات خارجية}many{تم العثور على # جهة خارجية}other{تم العثور على # جهة خارجية}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "استخدام الجهات الخارجية"
988982
},

lighthouse-core/lib/i18n/locales/bg.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Целевите зони за докосване са оразмерени правилно"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Време на основната нишка"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Трета страна"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Кодът от трети страни може сериозно да повлияе върху скоростта на зареждане. Ограничете броя на излишните доставчици трети страни и опитайте да зареждате кода от трети страни, след като основното зареждане на страницата ви е приключило. [Научете повече](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{Открит е 1 фрагмент с код от трета страна}other{Открити са # фрагмента с код от трета страна}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Използване на код от трети страни"
988982
},

lighthouse-core/lib/i18n/locales/ca.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "La mida dels elements tàctils és correcta"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Durada del fil principal"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Tercers"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "El codi de tercers pot afectar significativament el rendiment de la càrrega. Limita el nombre de proveïdors externs redundants i prova de carregar codi de tercers quan la càrrega principal de la pàgina ha finalitzat. [Obtén més informació](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{S'ha trobat 1 tercer}other{S'han trobat # tercers}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Ús de tercers"
988982
},

lighthouse-core/lib/i18n/locales/cs.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Dotykové prvky jsou dostatečně velké"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Doba hlavního podprocesu"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Třetí strana"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Kód třetích stran může mít významný dopad na rychlost načítání. Omezte počet redundantních externích poskytovatelů a snažte se kód třetích stran načítat až poté, co se dokončí načtení vaší stránky. [Další informace](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)"
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{Byla nalezena 1 třetí strana}few{Byly nalezeny # třetí strany}many{Bylo nalezeno # třetí strany}other{Bylo nalezeno # třetích stran}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Použití zdrojů od třetích stran"
988982
},

lighthouse-core/lib/i18n/locales/da.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Trykbare elementer har en passende størrelse"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Tid for primær tråd"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Tredjepart"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Kode fra tredjeparter kan have en væsentlig indvirkning på indlæsningen. Begræns antallet af overflødige tredjepartsudbydere, og prøv at indlæse kode fra tredjeparter, når indlæsningen af siden næsten er færdig. [Få flere oplysninger](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{1 tredjepart blev fundet}one{# tredjepart blev fundet}other{# tredjeparter blev fundet}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Tredjepartsbrug"
988982
},

lighthouse-core/lib/i18n/locales/de.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Größe von Tippzielen ist richtig eingestellt"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Dauer des Hauptthreads"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Drittanbieter"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Code von Drittanbietern kann die Ladegeschwindigkeit erheblich beeinträchtigen. Beschränken Sie die Zahl redundanter Drittanbieter und versuchen Sie, solchen Code erst nachträglich zu laden. [Weitere Informationen.](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)"
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{1 Drittanbieter gefunden}other{# Drittanbieter gefunden}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Nutzung von Drittanbieter-Code"
988982
},

lighthouse-core/lib/i18n/locales/el.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Τα στοιχεία που επιλέγονται με πάτημα έχουν το κατάλληλο μέγεθος"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Χρόνος κύριου νήματος"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Τρίτο μέρος"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Ο κώδικας τρίτων παρόχων μπορεί να επηρεάσει σημαντικά την απόδοση φόρτωσης. Περιορίστε τον αριθμό των περιττών τρίτων παρόχων και προσπαθήστε η φόρτωση του κώδικα τρίτων παρόχων να γίνεται αφού πρώτα έχει ολοκληρωθεί η φόρτωση της σελίδας σας. [Μάθετε περισσότερα](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{Βρέθηκε 1 τρίτο μέρος}other{Βρέθηκαν # τρίτα μέρη}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Χρήση κώδικα τρίτου"
988982
},

lighthouse-core/lib/i18n/locales/en-GB.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,18 +971,12 @@
971971
"lighthouse-core/audits/seo/tap-targets.js | title": {
972972
"message": "Tap targets are sized appropriately"
973973
},
974-
"lighthouse-core/audits/third-party-summary.js | columnMainThreadTime": {
975-
"message": "Main thread time"
976-
},
977974
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": {
978975
"message": "Third-party"
979976
},
980977
"lighthouse-core/audits/third-party-summary.js | description": {
981978
"message": "Third-party code can significantly impact load performance. Limit the number of redundant third-party providers and try to load third-party code after your page has primarily finished loading. [Learn more](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/)."
982979
},
983-
"lighthouse-core/audits/third-party-summary.js | displayValue": {
984-
"message": "{itemCount,plural, =1{1 third-party found}other{# third-parties found}}"
985-
},
986980
"lighthouse-core/audits/third-party-summary.js | title": {
987981
"message": "Third-party usage"
988982
},

0 commit comments

Comments
 (0)