mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-18 01:27:25 +00:00
feat: make the EN version just use the source translation
This commit is contained in:
parent
543123b5e7
commit
8860770356
@ -18,6 +18,7 @@ tsFiles.forEach(file => {
|
|||||||
|
|
||||||
const doctype = json["_doctype"];
|
const doctype = json["_doctype"];
|
||||||
const language = json[doctype]._attributes.language;
|
const language = json[doctype]._attributes.language;
|
||||||
|
const isEn = language === 'en_US'
|
||||||
|
|
||||||
let translations;
|
let translations;
|
||||||
try {
|
try {
|
||||||
@ -25,7 +26,6 @@ tsFiles.forEach(file => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// No translation file for the exact match, let's use the file name instead
|
// No translation file for the exact match, let's use the file name instead
|
||||||
const fileParts = file.split('_');
|
const fileParts = file.split('_');
|
||||||
console.log('Filep', fileParts);
|
|
||||||
let langString = fileParts[fileParts.length - 1];
|
let langString = fileParts[fileParts.length - 1];
|
||||||
// Remove the .ts
|
// Remove the .ts
|
||||||
langString = langString.substring(0, langString.length - 3)
|
langString = langString.substring(0, langString.length - 3)
|
||||||
@ -39,10 +39,18 @@ tsFiles.forEach(file => {
|
|||||||
|
|
||||||
const messages = json[doctype].context.message;
|
const messages = json[doctype].context.message;
|
||||||
|
|
||||||
|
console.log(`Modying ${language}...`)
|
||||||
messages.forEach(message => {
|
messages.forEach(message => {
|
||||||
if (!message._attributes || !message._attributes.id) {
|
if (!message._attributes || !message._attributes.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isEn) {
|
||||||
|
// We just put the source string in the tranlsation
|
||||||
|
message.translation = {
|
||||||
|
"_text": message.source._text
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
const messageId = message._attributes.id;
|
const messageId = message._attributes.id;
|
||||||
if (!translations[messageId]) {
|
if (!translations[messageId]) {
|
||||||
// Skip this message, as we have no translation
|
// Skip this message, as we have no translation
|
||||||
@ -58,3 +66,5 @@ tsFiles.forEach(file => {
|
|||||||
|
|
||||||
fs.writeFileSync(file, xml);
|
fs.writeFileSync(file, xml);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('All done!')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user