Skip to content

Commit

Permalink
script: tr.dart intent adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Nov 12, 2023
1 parent b5eb426 commit 36fdda5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ Future<bool> _addKey(String argKey, String argValue) async {
await file.writeAsString("""
// ignore_for_file: non_constant_identifier_names
// AUTO GENERATED FILE
abstract class LanguageKeys {
Map<String, String> get languageMap;
Map<String, String> get languageMapDefault;
String _getKey(String key) => languageMap[key] ?? languageMapDefault[key] ?? '';
${keys.map((e) => " String get $e => _getKey('$e');").join('\n')}
}""");
}
""");

// -- Controller file
// final langFile = File(_controllerFilePath);
Expand Down Expand Up @@ -112,7 +113,7 @@ Future<bool> _removeKey(String keyToRemove) async {
final lines = await file.readAsLines();
final indToRemove = lines.indexWhere((element) => element.contains("String get $keyToRemove => _getKey('$keyToRemove');"));
lines.removeAt(indToRemove);
await file.writeAsString(lines.join('\n'));
await file.writeAsString('${lines.join('\n')}\n');

// -- Controller file
// final langFile = File(_controllerFilePath);
Expand Down

0 comments on commit 36fdda5

Please sign in to comment.