Skip to content

Commit

Permalink
remove createPsuedoLocaleStrings since TC provides them now
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jul 25, 2018
1 parent 804d88d commit de7623d
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions lighthouse-core/scripts/i18n/collect-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,6 @@ function collectAllStringsInDir(dir, strings = {}) {
return strings;
}

/**
* @param {Record<string, string>} strings
*/
function createPsuedoLocaleStrings(strings) {
const psuedoLocalizedStrings = {};
for (const [key, string] of Object.entries(strings)) {
const psuedoLocalizedString = [];
let braceCount = 0;
let useHatForAccentMark = true;
for (let i = 0; i < string.length; i++) {
const char = string.substr(i, 1);
psuedoLocalizedString.push(char);
// Don't touch the characters inside braces
if (char === '{') {
braceCount++;
} else if (char === '}') {
braceCount--;
} else if (braceCount === 0) {
if (/[a-z]/i.test(char)) {
psuedoLocalizedString.push(useHatForAccentMark ? `\u0302` : `\u0301`);
useHatForAccentMark = !useHatForAccentMark;
}
}
}

psuedoLocalizedStrings[key] = psuedoLocalizedString.join('');
}

return psuedoLocalizedStrings;
}

/**
* @param {LH.Locale} locale
* @param {Record<string, string>} strings
Expand All @@ -95,9 +64,7 @@ function writeStringsToLocaleFormat(locale, strings) {
}

const strings = collectAllStringsInDir(path.join(LH_ROOT, 'lighthouse-core'));
const psuedoLocalizedStrings = createPsuedoLocaleStrings(strings);
console.log('Collected!');

writeStringsToLocaleFormat('en-US', strings);
writeStringsToLocaleFormat('en-XA', psuedoLocalizedStrings);
console.log('Written to disk!');

0 comments on commit de7623d

Please sign in to comment.