mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
Merge remote-tracking branch 'origin/master'
* origin/master: feat: add script to update missing i18n keys from en.json feat: add missing Turkish translations
This commit is contained in:
commit
6b7f6a698b
2 changed files with 105 additions and 2 deletions
|
|
@ -24,6 +24,11 @@
|
|||
"UPDATE_MAIN_MODEL_NO_UPDATE": "Hiçbir model güncellemesi seçilmedi. Model yükseltmesini gerçekleştirmek istemiyorsanız, son sürüme geçmek zorunda olduğunuzu lütfen unutmayın.",
|
||||
"UPDATE_WEB_APP": "Yeni sürüm mevcut. Yeni Sürüm Yüklensin Mi?"
|
||||
},
|
||||
"BN": {
|
||||
"SHOW_ISSUE_PANEL": "Sorun Panelini Göster",
|
||||
"SHOW_NOTES": "Proje Notlarını Göster",
|
||||
"SHOW_TASK_VIEW_CUSTOMIZER_PANEL": "Filtre/Grup/Sırala Panelini Göster"
|
||||
},
|
||||
"BL": {
|
||||
"NO_TASKS": "Birikmiş işler günlüğünüzde şu anda görev yok"
|
||||
},
|
||||
|
|
@ -126,7 +131,7 @@
|
|||
"ASSIGNEE": "Atanan",
|
||||
"AT": "üzerinde",
|
||||
"ATTACHMENTS": "Ekler",
|
||||
"CHANGED": "Değiştirildi",
|
||||
"CHANGED": "değiştirildi",
|
||||
"COMMENTS": "Yorumlar",
|
||||
"COMPONENTS": "Bileşenler",
|
||||
"DESCRIPTION": "Açıklama",
|
||||
|
|
@ -1398,7 +1403,11 @@
|
|||
"THURSDAY": "Perşembe",
|
||||
"TITLE": "Görevin Başlığı",
|
||||
"TUESDAY": "Salı",
|
||||
"WEDNESDAY": "Çarşamba"
|
||||
"WEDNESDAY": "Çarşamba",
|
||||
"INHERIT_SUBTASKS": "Alt görevleri devral",
|
||||
"INHERIT_SUBTASKS_DESCRIPTION": "Etkinleştirildiğinde, en son görev örneğindeki alt görevler tekrarlayan görevle birlikte yeniden oluşturulur",
|
||||
"DISABLE_AUTO_UPDATE_SUBTASKS": "Alt görevlerin otomatik güncellenmesini devre dışı bırak",
|
||||
"DISABLE_AUTO_UPDATE_SUBTASKS_DESCRIPTION": "En yeni örnek değiştiğinde devralınan alt görevleri otomatik olarak güncelleme"
|
||||
}
|
||||
},
|
||||
"TASK_VIEW": {
|
||||
|
|
|
|||
94
tools/add-missing-i18n-variables.js
Normal file
94
tools/add-missing-i18n-variables.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const i18nDir = path.resolve(__dirname, '../src/assets/i18n');
|
||||
const enPath = path.join(i18nDir, 'en.json');
|
||||
|
||||
function mergeInOrder(enObj, langObj) {
|
||||
if (typeof enObj !== 'object' || enObj === null) return langObj;
|
||||
const result = Array.isArray(enObj) ? [] : {};
|
||||
for (const key of Object.keys(enObj)) {
|
||||
if (
|
||||
typeof enObj[key] === 'object' &&
|
||||
enObj[key] !== null &&
|
||||
!Array.isArray(enObj[key])
|
||||
) {
|
||||
result[key] = mergeInOrder(enObj[key], langObj && langObj[key] ? langObj[key] : {});
|
||||
} else {
|
||||
result[key] = langObj && key in langObj ? langObj[key] : enObj[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(enPath)) {
|
||||
console.error('en.json not found in src/assets/i18n/');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(i18nDir)) {
|
||||
console.error('i18n directory not found at src/assets/i18n/');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Read the English reference file
|
||||
const en = JSON.parse(fs.readFileSync(enPath, 'utf8'));
|
||||
|
||||
// Get all i18n files except en.json
|
||||
const i18nFiles = fs
|
||||
.readdirSync(i18nDir)
|
||||
.filter((file) => file.endsWith('.json') && file !== 'en.json')
|
||||
.sort();
|
||||
|
||||
console.log(`Found ${i18nFiles.length} language files to update:`);
|
||||
console.log(i18nFiles.map((file) => ` - ${file}`).join('\n'));
|
||||
console.log('');
|
||||
|
||||
let updatedFiles = 0;
|
||||
let errors = 0;
|
||||
|
||||
// Process each language file
|
||||
for (const file of i18nFiles) {
|
||||
const langPath = path.join(i18nDir, file);
|
||||
const langCode = file.replace('.json', '');
|
||||
|
||||
try {
|
||||
// Read existing language file or create empty object if it doesn't exist
|
||||
let langObj = {};
|
||||
if (fs.existsSync(langPath)) {
|
||||
const content = fs.readFileSync(langPath, 'utf8');
|
||||
if (content.trim()) {
|
||||
langObj = JSON.parse(content);
|
||||
}
|
||||
}
|
||||
|
||||
// Merge with English structure, preserving existing translations
|
||||
const merged = mergeInOrder(en, langObj);
|
||||
|
||||
// Write the updated file
|
||||
fs.writeFileSync(langPath, JSON.stringify(merged, null, 2), 'utf8');
|
||||
|
||||
console.log(`✓ Updated ${file}`);
|
||||
updatedFiles++;
|
||||
} catch (error) {
|
||||
console.error(`✗ Error processing ${file}:`, error.message);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log(`Summary:`);
|
||||
console.log(` - Updated files: ${updatedFiles}`);
|
||||
console.log(` - Errors: ${errors}`);
|
||||
console.log(` - Total files processed: ${i18nFiles.length}`);
|
||||
|
||||
if (errors === 0) {
|
||||
console.log('');
|
||||
console.log(
|
||||
'All language files updated successfully with missing keys in the same order as en.json.',
|
||||
);
|
||||
} else {
|
||||
console.log('');
|
||||
console.log('Some files had errors. Please check the output above.');
|
||||
process.exit(1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue