cake_wallet/tool/append_translation.dart
Matthew Fosse 3945a3d7b4
Cw 577 translation fixes (#1290)
* pt.1

* alphabetize

* alphabetize translation files

* revert trailing comma addition

* fix translations
2024-02-06 22:12:51 +02:00

32 lines
No EOL
842 B
Dart

import 'utils/translation/arb_file_utils.dart';
import 'utils/translation/translation_constants.dart';
import 'utils/translation/translation_utils.dart';
void main(List<String> args) async {
if (args.length != 2) {
throw Exception(
'Insufficient arguments!\n\nTry to run `./append_translation.dart greetings "Hello World!"`');
}
final name = args.first;
final text = args.last;
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!');
}