feat: Migrated strings, and translations to native flutter l10n plugin

This commit is contained in:
Anton Stubenbord
2023-02-17 00:00:13 +01:00
parent 7b55a96164
commit 14ab604118
90 changed files with 1661 additions and 683 deletions

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:paperless_mobile/features/settings/cubit/application_settings_cubit.dart';
import 'package:paperless_mobile/features/settings/view/widgets/radio_settings_dialog.dart';
import 'package:paperless_mobile/generated/l10n.dart';
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
class ThemeModeSetting extends StatelessWidget {
const ThemeModeSetting({super.key});
@@ -12,13 +12,13 @@ class ThemeModeSetting extends StatelessWidget {
return BlocBuilder<ApplicationSettingsCubit, ApplicationSettingsState>(
builder: (context, settings) {
return ListTile(
title: Text(S.of(context).appearance),
title: Text(S.of(context)!.appearance),
subtitle: Text(_mapThemeModeToLocalizedString(
settings.preferredThemeMode, context)),
onTap: () => showDialog<ThemeMode>(
context: context,
builder: (_) => RadioSettingsDialog<ThemeMode>(
titleText: S.of(context).appearance,
titleText: S.of(context)!.appearance,
initialValue: context
.read<ApplicationSettingsCubit>()
.state
@@ -26,15 +26,15 @@ class ThemeModeSetting extends StatelessWidget {
options: [
RadioOption(
value: ThemeMode.system,
label: S.of(context).systemTheme,
label: S.of(context)!.systemTheme,
),
RadioOption(
value: ThemeMode.light,
label: S.of(context).lightTheme,
label: S.of(context)!.lightTheme,
),
RadioOption(
value: ThemeMode.dark,
label: S.of(context).darkTheme,
label: S.of(context)!.darkTheme,
)
],
),
@@ -51,11 +51,11 @@ class ThemeModeSetting extends StatelessWidget {
String _mapThemeModeToLocalizedString(ThemeMode theme, BuildContext context) {
switch (theme) {
case ThemeMode.system:
return S.of(context).system;
return S.of(context)!.system;
case ThemeMode.light:
return S.of(context).light;
return S.of(context)!.light;
case ThemeMode.dark:
return S.of(context).dark;
return S.of(context)!.dark;
}
}
}