Skip to content

Commit

Permalink
Log a warning if a translation couldn't be loaded in the flutter app
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandgeider committed Dec 6, 2023
1 parent 75b9175 commit 6e8ccf0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wger/core/management/commands/extract-i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ def cleanup_name(text: str) -> str:
/// in English and need to be translated here in the application (there are
/// probably better ways to do this, but that's the way it is right now).
import 'dart:developer';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:logging/logging.dart';
String getTranslation(String value, BuildContext context) {
switch (value) {'''
Expand All @@ -127,8 +130,10 @@ def cleanup_name(text: str) -> str:

out += '''
default:
throw FormatException('Could not translate the server string $value');
}}'''
log('Could not translate the server string $value', level: Level.WARNING.value);
return value;
}
}'''

f.write(out)
self.stdout.write(self.style.SUCCESS('Wrote content to wger/i18n.dart'))

0 comments on commit 6e8ccf0

Please sign in to comment.