Skip to content

Commit ee7f300

Browse files
authored
fix(build): escape quotes in translation texts (#1511)
**Background** The Translation Delivery pull request fails and I found out that one of the new texts in messagebundle_en.properties has has quoted word `Drop files to upload them or use the "Upload" button `. **Issue:** Later when building the i18n-defaults.js, the following fails: ```js // effectiveValue has double quotes itself and a word inside with double quotes in addition return `const ${key} = {key: "${key}", defaultText: "${effectiveValue}"};`; ``` **Solution**: escaping those quotes.
1 parent 727819d commit ee7f300

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/tools/lib/i18n/defaults.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ catch (e) {}
3333
* };
3434
*/
3535
const getTextInfo = (key, value, defaultLanguageValue) => {
36-
const effectiveValue = defaultLanguageValue || value;
36+
let effectiveValue = defaultLanguageValue || value;
37+
effectiveValue.replace(/"/g, "\\\""); // escape double quotes in translations
38+
3739
return `const ${key} = {key: "${key}", defaultText: "${effectiveValue}"};`;
3840
};
3941

0 commit comments

Comments
 (0)