mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
fff5a1c419
* Add UI and setting logic for subaddresses * Enable auto generate subaddresses * Rename variable * Add comment to unused code * Fix issue with initial state change * Fix observable for isAppSecure * Filter sub account contacts * Fix select account use unused address * Use add address if last address is unused * Fix auto generate wallet issues * Fix button color * Add translation and refactored naming * Fix PR review * Remove unused code * Remove unused overrides in electrum * Fix address info null check * CW-228 Fix ContactListViewModel condition * CW-228 Fix Account Tile; Rework updateAddressesInBox; Fix _getAllUnusedAddresses * CW-228 Fix unintentional address_page.dart regression * CW-228 Fix Merge Conflicts * CW-228 Add more translation Tools * CW-228 More merge conflict fixes * CW-228 Fix Merge Conflicts * CW-228 Auto Translation improvements * CW-228 Resolve requested Changes --------- Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
37 lines
1 KiB
Dart
37 lines
1 KiB
Dart
import 'package:translator/translator.dart';
|
|
|
|
import 'arb_file_utils.dart';
|
|
import 'translation_constants.dart';
|
|
|
|
final translator = GoogleTranslator();
|
|
|
|
Future<void> appendTranslation(String lang, String key, String text) async {
|
|
final fileName = getArbFileName(lang);
|
|
final translation = await getTranslation(text, lang);
|
|
|
|
appendStringToArbFile(fileName, key, translation);
|
|
}
|
|
|
|
Future<void> appendTranslations(String lang, Map<String, String> defaults) async {
|
|
final fileName = getArbFileName(lang);
|
|
final translations = <String, String>{};
|
|
|
|
for (var key in defaults.keys) {
|
|
final value = defaults[key]!;
|
|
|
|
if (value.contains("{")) continue;
|
|
final translation = await getTranslation(value, lang);
|
|
|
|
translations[key] = translation;
|
|
}
|
|
|
|
print(translations);
|
|
|
|
appendStringsToArbFile(fileName, translations);
|
|
}
|
|
|
|
Future<String> getTranslation(String text, String lang) async {
|
|
if (lang == defaultLang) return text;
|
|
return (await translator.translate(text, from: defaultLang, to: lang)).text;
|
|
}
|
|
|