mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'dart:io';
|
|
|
|
import './print_verbose_dummy.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 != 1) {
|
|
throw Exception('Insufficient arguments!\n\nTry to run `./translation_add_lang.dart langCode`');
|
|
}
|
|
|
|
final targetLang = args.first;
|
|
|
|
final fileName = getArbFileName(defaultLang);
|
|
final file = File(fileName);
|
|
final arbObj = readArbFile(file);
|
|
|
|
final targetFileName = getArbFileName(targetLang);
|
|
final targetKeys = arbObj.keys;
|
|
|
|
final targetFile = File(targetFileName);
|
|
targetFile.createSync(exclusive: true);
|
|
targetFile.writeAsStringSync("{}");
|
|
|
|
final translations = Map<String, String>();
|
|
for (var targetKey in targetKeys) {
|
|
final srcString = arbObj[targetKey] as String;
|
|
final translation = await getTranslation(srcString, targetLang);
|
|
|
|
translations[targetKey] = translation;
|
|
}
|
|
|
|
appendStringsToArbFile(targetFileName, translations);
|
|
print("Success! Please add your Language Code to lib/entities/language_service.dart");
|
|
}
|