Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate translation #171

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
220 changes: 217 additions & 3 deletions assets/l10n/l10n_de.arb

Large diffs are not rendered by default.

222 changes: 218 additions & 4 deletions assets/l10n/l10n_en.arb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion l10n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ arb-dir: assets/l10n
template-arb-file: l10n_en.arb
output-localization-file: l10n.dart
output-dir: lib/l10n
synthetic-package: true
synthetic-package: false
6 changes: 6 additions & 0 deletions lib/core/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SettingsHandler with ChangeNotifier {
}

class Settings {
final Locale locale;
final bool useSystemDarkmode;
final bool useDarkmode;
final List<Publisher> feedFilter;
Expand All @@ -69,6 +70,7 @@ class Settings {
final List<Map<String, dynamic>>? mensaRestaurantConfig;

Settings({
this.locale = const Locale('de'),
this.useSystemDarkmode = true,
this.useDarkmode = false,
this.feedFilter = const [],
Expand All @@ -93,6 +95,7 @@ class Settings {
});

Settings copyWith({
Locale? locale,
bool? useSystemDarkmode,
bool? useDarkmode,
List<Publisher>? feedFilter,
Expand All @@ -116,6 +119,7 @@ class Settings {
double? lastMensaTransaction,
}) =>
Settings(
locale: locale ?? this.locale,
useSystemDarkmode: useSystemDarkmode ?? this.useSystemDarkmode,
useDarkmode: useDarkmode ?? this.useDarkmode,
feedFilter: feedFilter ?? this.feedFilter,
Expand All @@ -141,6 +145,7 @@ class Settings {

factory Settings.fromJson(Map<String, dynamic> json) {
return Settings(
locale: Locale(json['locale'] ?? 'de'),
useSystemDarkmode: json['useSystemDarkmode'] ?? true,
useDarkmode: json['useDarkmode'] ?? false,
feedFilter: json['newFeedFilter'] != null
Expand Down Expand Up @@ -190,6 +195,7 @@ class Settings {

Map<String, dynamic> toJson() {
return {
'locale': locale.languageCode.toLowerCase(),
'useSystemDarkmode': useSystemDarkmode,
'useDarkmode': useDarkmode,
'newFeedFilter': feedFilter.map((p) => p.toInternalJson()).toList(),
Expand Down
Loading