* test add lint as separate action
* nicer logging
* only detect changes in dart files
* fix printV warnings being displayed when editing printV

---------

Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
This commit is contained in:
malik1004x
2026-07-14 12:50:19 +02:00
committed by GitHub
co-authored by Czarek Nakamoto
parent 031a117f2e
commit 01c977e82b
37 changed files with 587 additions and 199 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ void main(List<String> args) async {
final text = args[1];
final force = args.last == "--force";
printV('Appending "$name": "$text"');
print('Appending "$name": "$text"');
// add translation to all languages:
for (var lang in langs) {
@@ -25,12 +25,12 @@ void main(List<String> args) async {
appendStringToArbFile(fileName, name, translation, force: force);
}
printV('Alphabetizing all files...');
print('Alphabetizing all files...');
for (var lang in langs) {
final fileName = getArbFileName(lang);
alphabetizeArbFile(fileName);
}
printV('Done!');
print('Done!');
}
+5 -5
View File
@@ -31,7 +31,7 @@ Future<void> main() async {
final resp = await _dio.get("https://api.github.com/repos/mrcyjanek/monero_c/releases");
final data = resp.data[0];
final tagName = data['tag_name'];
printV("Downloading artifacts for: ${tagName}");
print("Downloading artifacts for: ${tagName}");
final assets = data['assets'] as List<dynamic>;
for (var i = 0; i < assets.length; i++) {
for (var triplet in triplets) {
@@ -42,10 +42,10 @@ Future<void> main() async {
String localFilename = filename.replaceAll("${coin}_${triplet}_", "");
localFilename = "scripts/monero_c/release/${coin}/${triplet}_${localFilename}";
final url = asset["browser_download_url"] as String;
printV("- downloading $localFilename");
print("- downloading $localFilename");
await _dio.download(url, localFilename);
if (localFilename.endsWith(".xz")) {
printV(" extracting $localFilename");
print(" extracting $localFilename");
final inputStream = InputFileStream(localFilename);
final archive = XZDecoder().decodeBytes(inputStream.toUint8List());
final outputStream = OutputFileStream(localFilename.replaceAll(".xz", ""));
@@ -54,11 +54,11 @@ Future<void> main() async {
}
}
if (Platform.isMacOS) {
printV("Generating ios framework");
print("Generating ios framework");
final result = Process.runSync("bash", [
"-c",
"cd scripts/ios && ./gen_framework.sh && cd ../.."
]);
printV((result.stdout+result.stderr).toString().trim());
print((result.stdout+result.stderr).toString().trim());
}
}
+7 -7
View File
@@ -76,7 +76,7 @@ void main() {
// --- B. Run App in a Zone to Capture Prints ---
runZoned(
() async {
printV('--- Starting Verified Price Check ---');
print('--- Starting Verified Price Check ---');
final Map<String, List<String>> workingPairs = {};
final Map<String, List<String>> failedPairs = {};
@@ -130,7 +130,7 @@ void main() {
}
// Print immediate status (Captured by Zone)
printV('$logPrefix $logMessage');
print('$logPrefix $logMessage');
// Aggregate
if (isSuccess) {
@@ -148,25 +148,25 @@ void main() {
}
// --- FINAL SUMMARY ---
printV('\n\n=== SUMMARY ===\n');
print('\n\n=== SUMMARY ===\n');
// Print Successful
workingPairs.forEach((crypto, fiats) {
if (fiats.isNotEmpty) {
printV('✅ ${crypto.toUpperCase()}: ${fiats.join(", ")}');
print('✅ ${crypto.toUpperCase()}: ${fiats.join(", ")}');
}
});
printV('\n--------------------------------------------------\n');
print('\n--------------------------------------------------\n');
// Print Failed
failedPairs.forEach((crypto, fiats) {
if (fiats.isNotEmpty) {
printV('❌ ${crypto.toUpperCase()}: ${fiats.join(", ")}');
print('❌ ${crypto.toUpperCase()}: ${fiats.join(", ")}');
}
});
printV('\n=== DONE ===');
print('\n=== DONE ===');
},
// --- C. The Interceptor ---
+5 -5
View File
@@ -37,7 +37,7 @@ Future<void> main(List<String> args) async {
extraInfo.forEach((key, dynamic value) async {
if (key != srcDir) {
printV('Wrong key: $key');
print('Wrong key: $key');
return;
}
@@ -45,7 +45,7 @@ Future<void> main(List<String> args) async {
final dir = Directory(dirPath);
if (!await dir.exists()) {
printV('Wrong directory path: $dirPath');
print('Wrong directory path: $dirPath');
return;
}
@@ -55,7 +55,7 @@ Future<void> main(List<String> args) async {
// normalizing the case so keys match LanguageService.supportedLocales.
final fileName = element.uri.pathSegments.last;
if (!fileName.startsWith('strings_') || !fileName.endsWith('.arb')) {
printV('Wrong file: ${element.path}');
print('Wrong file: ${element.path}');
return;
}
final parts =
@@ -67,7 +67,7 @@ Future<void> main(List<String> args) async {
});
if (!localePath.keys.contains(defaultLocale)) {
printV("Locale list doesn't contain $defaultLocale");
print("Locale list doesn't contain $defaultLocale");
return;
}
@@ -124,7 +124,7 @@ Future<void> main(List<String> args) async {
await File(outputPath + localeListFileName).writeAsString(locales);
} catch (e) {
printV(e.toString());
print(e.toString());
}
});
}
-1
View File
@@ -1 +0,0 @@
void printV(dynamic content) => print(content);
+1 -1
View File
@@ -46,7 +46,7 @@ void main() async {
});
currentItem++;
printV(
print(
"\r$currentLang/${langs.length} langs done, $currentItem/${defaultLangChangelog.length} items done");
}
currentLang++;
+29 -29
View File
@@ -25,18 +25,18 @@ class TranslationChecker {
final sourceMap = json.decode(sourceContent) as Map<String, dynamic>;
final destinationMap = json.decode(destinationContent) as Map<String, dynamic>;
printV('Found ${sourceMap.length} keys in source, ${destinationMap.length} in destination');
print('Found ${sourceMap.length} keys in source, ${destinationMap.length} in destination');
final keysToProcess = specificKey != null
? (sourceMap.containsKey(specificKey) ? [specificKey] : <String>[])
: sourceMap.keys.toList();
if (specificKey != null && keysToProcess.isEmpty) {
printV('Error: Key "$specificKey" not found in source file');
print('Error: Key "$specificKey" not found in source file');
return;
}
printV('Processing ${keysToProcess.length} translations...');
print('Processing ${keysToProcess.length} translations...');
int processed = 0;
int corrected = 0;
@@ -57,16 +57,16 @@ class TranslationChecker {
if (correctedTranslation != destinationValue) {
destinationMap[key] = correctedTranslation;
corrected++;
printV('Processed: "$key" -> CORRECTED');
printV(' - eng : "$sourceValue"');
printV(' - dst orig: "$destinationValue"');
printV(' - dst new : "$correctedTranslation"');
print('Processed: "$key" -> CORRECTED');
print(' - eng : "$sourceValue"');
print(' - dst orig: "$destinationValue"');
print(' - dst new : "$correctedTranslation"');
await _writeArbFile(destinationArbPath, destinationMap);
} else {
printV('Processed: "$key" -> VERIFIED');
print('Processed: "$key" -> VERIFIED');
}
} else {
printV('Processed: "$key" -> SKIPPED (non-string)');
print('Processed: "$key" -> SKIPPED (non-string)');
}
processed++;
@@ -74,11 +74,11 @@ class TranslationChecker {
await _writeArbFile(destinationArbPath, destinationMap);
printV('');
printV('Summary:');
printV('Processed: $processed keys');
printV('Corrected: $corrected keys');
printV('Updated: $destinationArbPath');
print('');
print('Summary:');
print('Processed: $processed keys');
print('Corrected: $corrected keys');
print('Updated: $destinationArbPath');
}
Future<String> _checkSingleTranslation({
@@ -108,7 +108,7 @@ class TranslationChecker {
return currentTranslation;
} catch (e) {
printV('Error checking translation for key "$key": $e');
print('Error checking translation for key "$key": $e');
return currentTranslation;
}
}
@@ -186,7 +186,7 @@ IMPORTANT: Respond with a JSON object in the exact format, you must think about
final jsonEnd = response.lastIndexOf('}');
if (jsonStart == -1 || jsonEnd == -1 || jsonStart >= jsonEnd) {
printV('No valid JSON found in LLM response');
print('No valid JSON found in LLM response');
return null;
}
@@ -195,7 +195,7 @@ IMPORTANT: Respond with a JSON object in the exact format, you must think about
return parsed['corrected_translation'] as String?;
} catch (e) {
printV('Error extracting JSON from LLM response: $e');
print('Error extracting JSON from LLM response: $e');
return null;
}
}
@@ -228,7 +228,7 @@ void main(List<String> args) async {
final results = parser.parse(args);
if (results['help'] as bool) {
printV(parser.usage);
print(parser.usage);
return;
}
@@ -239,24 +239,24 @@ void main(List<String> args) async {
final model = results['model'] as String;
if (!File(sourcePath).existsSync()) {
printV('Error: Source ARB file not found: $sourcePath');
print('Error: Source ARB file not found: $sourcePath');
exit(1);
}
if (!File(destinationPath).existsSync()) {
printV('Error: Destination ARB file not found: $destinationPath');
print('Error: Destination ARB file not found: $destinationPath');
exit(1);
}
printV('Translation Checker');
printV('Source: $sourcePath');
printV('Destination: $destinationPath');
printV('Ollama URL: $ollamaUrl');
printV('Model: $model');
print('Translation Checker');
print('Source: $sourcePath');
print('Destination: $destinationPath');
print('Ollama URL: $ollamaUrl');
print('Model: $model');
if (specificKey != null) {
printV('Key: $specificKey');
print('Key: $specificKey');
}
printV('');
print('');
final checker = TranslationChecker(
ollamaBaseUrl: ollamaUrl,
@@ -270,8 +270,8 @@ void main(List<String> args) async {
);
} catch (e) {
printV('Error: $e');
printV('Run with --help for more information.');
print('Error: $e');
print('Run with --help for more information.');
exit(1);
}
}
+1 -1
View File
@@ -34,5 +34,5 @@ void main(List<String> args) async {
}
appendStringsToArbFile(targetFileName, translations);
printV("Success! Please add your Language Code to lib/entities/language_service.dart");
print("Success! Please add your Language Code to lib/entities/language_service.dart");
}
+4 -4
View File
@@ -7,14 +7,14 @@ import 'utils/translation/translation_constants.dart';
import 'utils/translation/translation_utils.dart';
void main(List<String> args) async {
printV('Checking Consistency of all arb-files. Default: $defaultLang');
print('Checking Consistency of all arb-files. Default: $defaultLang');
final doFix = args.contains("--fix");
if (doFix)
printV('Auto fixing enabled!\n');
print('Auto fixing enabled!\n');
else
printV('Auto fixing disabled!\nRun with arg "--fix" to enable autofix\n');
print('Auto fixing disabled!\nRun with arg "--fix" to enable autofix\n');
final fileName = getArbFileName(defaultLang);
final file = File(fileName);
@@ -27,7 +27,7 @@ void main(List<String> args) async {
final missingDefaults = <String, String>{};
missingKeys.forEach((key) {
printV('Missing in "$lang": "$key"');
print('Missing in "$lang": "$key"');
if (doFix)
missingDefaults[key] = arbObj[key] as String;
});
+1 -1
View File
@@ -8,7 +8,7 @@ void appendStringToArbFile(String fileName, String name, String text, {bool forc
final arbObj = readArbFile(file);
if (arbObj.containsKey(name) && !force) {
printV("String $name already exists in $fileName!");
print("String $name already exists in $fileName!");
return;
}
@@ -38,7 +38,7 @@ Future<String> getTranslation(String text, String lang) async {
try {
translation = (await translator.translate(text, from: defaultLang, to: lang)).text;
} catch (e) {
printV("$lang, $text, $e");
print("$lang, $text, $e");
}
placeholder.forEach((index, value) {
final translatedPlaceholder = regExp.allMatches(translation).toList()[index];