Skip to content

Commit

Permalink
Project import generated by Copybara
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696715651
  • Loading branch information
jimper authored and copybara-github committed Nov 15, 2024
1 parent 1772e56 commit 7cce01d
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 2 deletions.
25 changes: 25 additions & 0 deletions data/localization/test.xlb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<localizationbundle locale="test">
<messages>
<msg name="sf93d227444bc5687">P̂́âĝ́ê ŝ́êt̂́t̂î́n̂ĝ́ŝ</msg>
<msg name="s7b5fa742d13b462e">Ŝ́l̂ốt̂ ŝ́êt̂́t̂î́n̂ĝ́ŝ</msg>
<msg name="sc907ffeeafb021d1">Ốût̂́p̂û́t̂ ŝ́êt̂́t̂î́n̂ĝ́ŝ</msg>
<msg name="se78c02e9a98a0f47">P̂́r̂î́v̂ấĉŷ́</msg>
<msg name="s267a52c34c200ef0">Ŝ́în̂́ĝl̂́ê R̂́êq̂́ûếŝt̂́ Ấr̂ĉ́ĥî́t̂ếĉt̂́ûr̂́ê (Ŝ́R̂Ấ)</msg>
<msg name="s758d8c59379ea482">P̂́âĝ́ê-l̂́êv̂́êl̂́ t̂́âr̂́ĝết̂î́n̂ĝ́</msg>
<msg name="sd5ac53cfd233dbcb">L̂́îm̂́ît̂́êd̂́ ấd̂ŝ́</msg>
<msg name="s0eb106f4b9813ad3">N̂́ôn̂́-p̂́êr̂́ŝốn̂ấl̂î́ẑếd̂ ấd̂ŝ́</msg>
<msg name="sb457d189f407a5a6">R̂́êŝ́t̂r̂́îĉ́t̂ d̂́ât̂́â p̂́r̂ốĉếŝŝ́în̂́ĝ</msg>
<msg name="s3132d1a0580760bc">Ĉ́ĥî́l̂d̂́-d̂́îr̂́êĉ́t̂ếd̂ t̂́r̂ếât̂́m̂ến̂t̂́</msg>
<msg name="sf915707accde585c">Û́n̂d̂́êr̂́ t̂́ĥế ấĝế ốf̂ ĉ́ôn̂́ŝến̂t̂́</msg>
<msg name="s77b0113eae08368b">Ŝ́âm̂́p̂l̂́ê t̂́êm̂́p̂l̂́ât̂́ê</msg>
<msg name="s4535f519744108bf">Ốût̂́p̂û́t̂ f̂́ôr̂́m̂ất̂</msg>
<msg name="s5bf3f3d517569ebd">Ấn̂ĉ́ĥốr̂ ấd̂ (b̂́ôt̂́t̂ốm̂)</msg>
<msg name="s710f900ef624e363">Ấn̂ĉ́ĥốr̂ ấd̂ (t̂́ôp̂́)</msg>
<msg name="s1163c710c6c9bccf">Ĝ́âm̂́în̂́ĝ î́n̂t̂́êr̂́ŝt̂́ît̂́îấl̂ ấd̂</msg>
<msg name="sefe480470a2c783c">R̂́êŵ́âr̂́d̂ếd̂ ấd̂</msg>
<msg name="s09c694b6602d365d">Ŝ́îd̂́ê r̂́âî́l̂ ấd̂ (l̂́êf̂́t̂)</msg>
<msg name="sccb7f7246c10ecb6">Ŝ́îd̂́ê r̂́âî́l̂ ấd̂ (r̂́îĝ́ĥt̂́)</msg>
<msg name="secff207571282402">Ŵ́êb̂́ î́n̂t̂́êr̂́ŝt̂́ît̂́îấl̂ ấd̂</msg>
</messages>
</localizationbundle>
3 changes: 2 additions & 1 deletion lit-localize.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"tr",
"vi",
"zh-cn",
"zh-tw"
"zh-tw",
"test"
],
"tsConfig": "./tsconfig.json",
"output": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"scripts": {
"build": "npm run build:l10n && npm run fix && npm run build:ts && npm run build:rollup",
"build:l10n": "lit-localize extract && lit-localize build",
"build:l10n": "lit-localize extract && npm run build:l10n-test && lit-localize build",
"build:l10n-test": "npx -y tsx@latest scripts/gen-test-locale.ts",
"build:ts": "tsc",
"build:rollup": "rollup -c",
"fix": "gts fix",
Expand Down
44 changes: 44 additions & 0 deletions scripts/gen-test-locale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as fs from 'fs';
import * as path from 'path';
import {fileURLToPath} from 'url';

const INPUT_LOCALE = 'en';
const OUTPUT_LOCALE = 'test';

const CURRENT_DIR = path.dirname(fileURLToPath(import.meta.url));
const XLB_DIR = path.resolve(CURRENT_DIR, '../data/localization');
const INPUT_XLB = path.join(XLB_DIR, `${INPUT_LOCALE}.xlb`);
const OUTPUT_XLB = path.join(XLB_DIR, `${OUTPUT_LOCALE}.xlb`);

(() => {
const inputContent = fs.readFileSync(INPUT_XLB).toString();

const outputContent = inputContent
.replace(/(<msg.*>)(.+)(<\/msg>)/gim, (match, p1, p2, p3) => {
// Add alternating diacritical marks to each character.
// First regex replaces odd characters, second replaces even.
let accentedStr = p2.replace(/([a-z])([a-z])?/gim, '$1\u0301$2');
accentedStr = accentedStr.replace(/([a-z])/gim, '$1\u0302');
return `${p1}${accentedStr}${p3}`;
})
.replace(`locale="${INPUT_LOCALE}"`, `locale="${OUTPUT_LOCALE}"`);

const output = fs.createWriteStream(OUTPUT_XLB);
output.write(outputContent);
})();
2 changes: 2 additions & 0 deletions src/generated/locale-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const targetLocales = [
'pl',
'pt-br',
'ru',
'test',
'th',
'tr',
'vi',
Expand Down Expand Up @@ -69,6 +70,7 @@ export const allLocales = [
'pl',
'pt-br',
'ru',
'test',
'th',
'tr',
'vi',
Expand Down
44 changes: 44 additions & 0 deletions src/generated/locales/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Do not modify this file by hand!
// Re-generate this file by running lit-localize

/* eslint-disable no-irregular-whitespace */
/* eslint-disable @typescript-eslint/no-explicit-any */

export const templates = {
s09c694b6602d365d: 'Ŝ́îd̂́ê r̂́âî́l̂ ấd̂ (l̂́êf̂́t̂)',
s0eb106f4b9813ad3: 'N̂́ôn̂́-p̂́êr̂́ŝốn̂ấl̂î́ẑếd̂ ấd̂ŝ́',
s1163c710c6c9bccf: 'Ĝ́âm̂́în̂́ĝ î́n̂t̂́êr̂́ŝt̂́ît̂́îấl̂ ấd̂',
s267a52c34c200ef0: 'Ŝ́în̂́ĝl̂́ê R̂́êq̂́ûếŝt̂́ Ấr̂ĉ́ĥî́t̂ếĉt̂́ûr̂́ê (Ŝ́R̂Ấ)',
s3132d1a0580760bc: 'Ĉ́ĥî́l̂d̂́-d̂́îr̂́êĉ́t̂ếd̂ t̂́r̂ếât̂́m̂ến̂t̂́',
s4535f519744108bf: 'Ốût̂́p̂û́t̂ f̂́ôr̂́m̂ất̂',
s5bf3f3d517569ebd: 'Ấn̂ĉ́ĥốr̂ ấd̂ (b̂́ôt̂́t̂ốm̂)',
s710f900ef624e363: 'Ấn̂ĉ́ĥốr̂ ấd̂ (t̂́ôp̂́)',
s758d8c59379ea482: 'P̂́âĝ́ê-l̂́êv̂́êl̂́ t̂́âr̂́ĝết̂î́n̂ĝ́',
s77b0113eae08368b: 'Ŝ́âm̂́p̂l̂́ê t̂́êm̂́p̂l̂́ât̂́ê',
s7b5fa742d13b462e: 'Ŝ́l̂ốt̂ ŝ́êt̂́t̂î́n̂ĝ́ŝ',
sb457d189f407a5a6: 'R̂́êŝ́t̂r̂́îĉ́t̂ d̂́ât̂́â p̂́r̂ốĉếŝŝ́în̂́ĝ',
sc907ffeeafb021d1: 'Ốût̂́p̂û́t̂ ŝ́êt̂́t̂î́n̂ĝ́ŝ',
sccb7f7246c10ecb6: 'Ŝ́îd̂́ê r̂́âî́l̂ ấd̂ (r̂́îĝ́ĥt̂́)',
sd5ac53cfd233dbcb: 'L̂́îm̂́ît̂́êd̂́ ấd̂ŝ́',
se78c02e9a98a0f47: 'P̂́r̂î́v̂ấĉŷ́',
secff207571282402: 'Ŵ́êb̂́ î́n̂t̂́êr̂́ŝt̂́ît̂́îấl̂ ấd̂',
sefe480470a2c783c: 'R̂́êŵ́âr̂́d̂ếd̂ ấd̂',
sf915707accde585c: 'Û́n̂d̂́êr̂́ t̂́ĥế ấĝế ốf̂ ĉ́ôn̂́ŝến̂t̂́',
sf93d227444bc5687: 'P̂́âĝ́ê ŝ́êt̂́t̂î́n̂ĝ́ŝ',
};

0 comments on commit 7cce01d

Please sign in to comment.