I18n: Fix variables not interpolating with pseudo localisation (#59145)

* I18n: Don't pseudolocalise string variables

* clean up
This commit is contained in:
Josh Hunt 2022-11-23 10:32:20 +00:00 committed by GitHub
parent f1ef63791a
commit c02f2321c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -20,8 +20,8 @@
"meta-tab": "Męŧä Đäŧä",
"query-tab": "Qūęřy",
"stats-tab": "Ŝŧäŧş",
"subtitle": "{{qūęřyCőūʼnŧ}} qūęřįęş ŵįŧĥ ŧőŧäľ qūęřy ŧįmę őƒ {{ƒőřmäŧŧęđ}}",
"title": "Ĩʼnşpęčŧ: {{päʼnęľŦįŧľę}}"
"subtitle": "{{queryCount}} qūęřįęş ŵįŧĥ ŧőŧäľ qūęřy ŧįmę őƒ {{formatted}}",
"title": "Ĩʼnşpęčŧ: {{panelTitle}}"
},
"inspect-data": {
"data-options": "Đäŧä őpŧįőʼnş",
@ -51,7 +51,7 @@
"panel-json-description": "Ŧĥę mőđęľ şävęđ įʼn ŧĥę đäşĥþőäřđ ĴŜØŃ ŧĥäŧ čőʼnƒįģūřęş ĥőŵ ęvęřyŧĥįʼnģ ŵőřĸş.",
"panel-json-label": "Päʼnęľ ĴŜØŃ",
"select-source": "Ŝęľęčŧ şőūřčę",
"unknown": "Ůʼnĸʼnőŵʼn Øþĵęčŧ: {{şĥőŵ}}"
"unknown": "Ůʼnĸʼnőŵʼn Øþĵęčŧ: {{show}}"
},
"inspect-meta": {
"no-inspector": "Ńő Męŧäđäŧä Ĩʼnşpęčŧőř"
@ -95,7 +95,7 @@
},
"library-panels": {
"save": {
"error": "Ēřřőř şävįʼnģ ľįþřäřy päʼnęľ: \"{{ęřřőřMşģ}}\"",
"error": "Ēřřőř şävįʼnģ ľįþřäřy päʼnęľ: \"{{errorMsg}}\"",
"success": "Ŀįþřäřy päʼnęľ şävęđ"
}
},
@ -333,7 +333,7 @@
"refresh-picker": {
"aria-label": {
"choose-interval": "Åūŧő řęƒřęşĥ ŧūřʼnęđ őƒƒ. Cĥőőşę řęƒřęşĥ ŧįmę įʼnŧęřväľ",
"duration-selected": "Cĥőőşę řęƒřęşĥ ŧįmę įʼnŧęřväľ ŵįŧĥ čūřřęʼnŧ įʼnŧęřväľ {{đūřäŧįőʼnÅřįäĿäþęľ}} şęľęčŧęđ"
"duration-selected": "Cĥőőşę řęƒřęşĥ ŧįmę įʼnŧęřväľ ŵįŧĥ čūřřęʼnŧ įʼnŧęřväľ {{durationAriaLabel}} şęľęčŧęđ"
},
"live-option": {
"aria-label": "Ŧūřʼn őʼn ľįvę şŧřęämįʼnģ",
@ -474,7 +474,7 @@
},
"range-picker": {
"backwards-time-aria-label": "Mővę ŧįmę řäʼnģę þäčĸŵäřđş",
"current-time-selected": "Ŧįmę řäʼnģę şęľęčŧęđ: {{čūřřęʼnŧŦįmęŖäʼnģę}}",
"current-time-selected": "Ŧįmę řäʼnģę şęľęčŧęđ: {{currentTimeRange}}",
"forwards-time-aria-label": "Mővę ŧįmę řäʼnģę ƒőřŵäřđş",
"to": "ŧő",
"zoom-out-button": "Żőőm őūŧ ŧįmę řäʼnģę",

View File

@ -3,7 +3,10 @@ const pseudoizer = require('pseudoizer');
function pseudoizeJsonReplacer(key, value) {
if (typeof value === 'string') {
return pseudoizer.pseudoize(value);
// Split string on brace-enclosed segments. Odd indices will be {{variables}}
const phraseParts = value.split(/(\{\{[^}]+}\})/g);
const translatedParts = phraseParts.map((str, index) => index % 2 ? str : pseudoizer.pseudoize(str))
return translatedParts.join("")
}
return value;