2023-08-29 16:11:51 +00:00
|
|
|
import 'utils/translation/arb_file_utils.dart';
|
|
|
|
import 'utils/translation/translation_constants.dart';
|
|
|
|
import 'utils/translation/translation_utils.dart';
|
2023-08-24 13:54:05 +00:00
|
|
|
|
|
|
|
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"');
|
|
|
|
|
2024-02-06 20:12:51 +00:00
|
|
|
// add translation to all languages:
|
2023-08-24 13:54:05 +00:00
|
|
|
for (var lang in langs) {
|
2023-08-29 16:11:51 +00:00
|
|
|
final fileName = getArbFileName(lang);
|
2023-08-24 13:54:05 +00:00
|
|
|
final translation = await getTranslation(text, lang);
|
|
|
|
|
2023-08-29 16:11:51 +00:00
|
|
|
appendStringToArbFile(fileName, name, translation);
|
2023-08-24 13:54:05 +00:00
|
|
|
}
|
2024-02-06 20:12:51 +00:00
|
|
|
|
|
|
|
print('Alphabetizing all files...');
|
|
|
|
|
|
|
|
for (var lang in langs) {
|
|
|
|
final fileName = getArbFileName(lang);
|
|
|
|
alphabetizeArbFile(fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
print('Done!');
|
2023-10-05 01:09:07 +00:00
|
|
|
}
|