mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Cw 397 chatwoot live support (#1011)
* initial button refactor and gradient background * CW-397 Use a separate Hive instance to avoid Issues with plugins using Hive * CW-397 Add Support Page Strings * CW-397 Add new Support Page * CW-397 Add Support Live Chat Page * CW-397 Add Hive Type Ids Doc * CW-397 Use Newer Chatwoot SDK Version and add new Images * CW-397 Update pubspec_base.yaml * CW-397 Add own Chatwoot Widget * Lowercase `s` skip-ci * CW-397 Fix WebMessageListener * CW-397 Fix Merge conflicts * CW-397 Add Erc20 Hive Type ID * CW-397 Fix Ethereum Hive Error * CW-397 Revert to Restore Button * CW-397 Only use In App chat on mobile * CW-397 Move Chatwoot Website Token to secrets * CW-397 Add Chatwoot Website Token to workflow * CW-397 Move Chatwoot fetchUrl to Support View Model --------- Co-authored-by: Rafael Saes <git@saes.io> Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
This commit is contained in:
parent
e348f12491
commit
af9b5ff10c
63 changed files with 762 additions and 260 deletions
66
tool/append_translation.dart
Normal file
66
tool/append_translation.dart
Normal file
|
@ -0,0 +1,66 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:translator/translator.dart';
|
||||
|
||||
const defaultLang = "en";
|
||||
const langs = [
|
||||
"ar", "bg", "cs", "de", "en", "es", "fr", "ha", "hi", "hr", "id", "it",
|
||||
"ja", "ko", "my", "nl", "pl", "pt", "ru", "th", "tr", "uk", "ur", "yo",
|
||||
"zh-cn" // zh, but Google Translate uses zh-cn for Chinese (Simplified)
|
||||
];
|
||||
final translator = GoogleTranslator();
|
||||
|
||||
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"');
|
||||
|
||||
for (var lang in langs) {
|
||||
final fileName = getFileName(lang);
|
||||
final translation = await getTranslation(text, lang);
|
||||
|
||||
appendArbFile(fileName, name, translation);
|
||||
}
|
||||
}
|
||||
|
||||
void appendArbFile(String fileName, String name, String text) {
|
||||
final file = File(fileName);
|
||||
final inputContent = file.readAsStringSync();
|
||||
final arbObj = json.decode(inputContent) as Map<String, dynamic>;
|
||||
|
||||
if (arbObj.containsKey(name)) {
|
||||
print("String $name already exists in $fileName!");
|
||||
return;
|
||||
}
|
||||
|
||||
arbObj.addAll({name: text});
|
||||
|
||||
final outputContent = json
|
||||
.encode(arbObj)
|
||||
.replaceAll('","', '",\n "')
|
||||
.replaceAll('{"', '{\n "')
|
||||
.replaceAll('"}', '"\n}')
|
||||
.replaceAll('":"', '": "');
|
||||
|
||||
file.writeAsStringSync(outputContent);
|
||||
}
|
||||
|
||||
|
||||
Future<String> getTranslation(String text, String lang) async {
|
||||
if (lang == defaultLang) return text;
|
||||
return (await translator.translate(text, from: defaultLang, to: lang)).text;
|
||||
}
|
||||
|
||||
String getFileName(String lang) {
|
||||
final shortLang = lang
|
||||
.split("-")
|
||||
.first;
|
||||
return "./res/values/strings_$shortLang.arb";
|
||||
}
|
|
@ -33,8 +33,7 @@ Future<void> updateSecretsConfig(List<String> args) async {
|
|||
});
|
||||
|
||||
final fileConfig =
|
||||
json.decode(configFile.readAsStringSync()) as Map<String, dynamic> ??
|
||||
<String, dynamic>{};
|
||||
json.decode(configFile.readAsStringSync()) as Map<String, dynamic>;
|
||||
fileConfig.forEach((key, dynamic value) {
|
||||
if (secrets[key] == null) {
|
||||
secrets[key] = value;
|
||||
|
|
|
@ -31,6 +31,7 @@ class SecretKey {
|
|||
SecretKey('anonPayReferralCode', () => ''),
|
||||
SecretKey('fiatApiKey', () => ''),
|
||||
SecretKey('payfuraApiKey', () => ''),
|
||||
SecretKey('chatwootWebsiteToken', () => ''),
|
||||
];
|
||||
|
||||
static final ethereumSecrets = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue