mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Cw 577 translation fixes (#1290)
* pt.1 * alphabetize * alphabetize translation files * revert trailing comma addition * fix translations
This commit is contained in:
parent
39a73b2058
commit
3945a3d7b4
28 changed files with 19385 additions and 19329 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -13,10 +13,20 @@ void main(List<String> args) async {
|
|||
|
||||
print('Appending "$name": "$text"');
|
||||
|
||||
// add translation to all languages:
|
||||
for (var lang in langs) {
|
||||
final fileName = getArbFileName(lang);
|
||||
final translation = await getTranslation(text, lang);
|
||||
|
||||
appendStringToArbFile(fileName, name, translation);
|
||||
}
|
||||
|
||||
print('Alphabetizing all files...');
|
||||
|
||||
for (var lang in langs) {
|
||||
final fileName = getArbFileName(lang);
|
||||
alphabetizeArbFile(fileName);
|
||||
}
|
||||
|
||||
print('Done!');
|
||||
}
|
|
@ -47,9 +47,7 @@ Map<String, dynamic> readArbFile(File file) {
|
|||
}
|
||||
|
||||
String getArbFileName(String lang) {
|
||||
final shortLang = lang
|
||||
.split("-")
|
||||
.first;
|
||||
final shortLang = lang.split("-").first;
|
||||
return "./res/values/strings_$shortLang.arb";
|
||||
}
|
||||
|
||||
|
@ -66,3 +64,25 @@ List<String> getMissingKeysInArbFile(String fileName, Iterable<String> langKeys)
|
|||
|
||||
return results;
|
||||
}
|
||||
|
||||
void alphabetizeArbFile(String fileName) {
|
||||
final file = File(fileName);
|
||||
final arbObj = readArbFile(file);
|
||||
|
||||
final sortedKeys = arbObj.keys.toList()
|
||||
..sort((a, b) => a.toLowerCase().compareTo(b.toLowerCase()));
|
||||
final Map<String, dynamic> sortedArbObj = {};
|
||||
for (var key in sortedKeys) {
|
||||
sortedArbObj[key] = arbObj[key];
|
||||
}
|
||||
|
||||
final outputContent = json
|
||||
.encode(sortedArbObj)
|
||||
.replaceAll('","', '",\n "')
|
||||
.replaceAll('{"', '{\n "')
|
||||
.replaceAll('"}', '"\n}')
|
||||
.replaceAll('":"', '": "')
|
||||
.replaceAll('\$ {', '\${');
|
||||
|
||||
file.writeAsStringSync(outputContent);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue