feat: Allow changing languages (#1488)

Co-authored-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
Ushie
2024-02-12 02:22:25 +03:00
committed by GitHub
parent c498cff096
commit f82c439b26
64 changed files with 1302 additions and 1488 deletions

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/ui/views/patch_options/patch_options_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.dart';
@ -25,19 +25,16 @@ class PatchOptionsView extends StatelessWidget {
Navigator.pop(context);
}
},
label: I18nText('patchOptionsView.saveOptions'),
label: Text(t.patchOptionsView.saveOptions),
icon: const Icon(Icons.save),
),
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
title: I18nText(
'patchOptionsView.viewTitle',
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.titleLarge!.color,
),
title: Text(
t.patchOptionsView.viewTitle,
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
actions: [
@ -48,10 +45,7 @@ class PatchOptionsView extends StatelessWidget {
icon: const Icon(
Icons.history,
),
tooltip: FlutterI18n.translate(
context,
'patchOptionsView.resetOptionsTooltip',
),
tooltip: t.patchOptionsView.resetOptionsTooltip,
),
],
),
@ -111,7 +105,7 @@ class PatchOptionsView extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.add),
I18nText('patchOptionsView.addOptions'),
Text(t.patchOptionsView.addOptions),
],
),
),

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
@ -137,8 +137,8 @@ class PatchOptionsViewModel extends BaseViewModel {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
I18nText(
'patchOptionsView.addOptions',
Text(
t.patchOptionsView.addOptions,
),
Text(
'',
@ -154,7 +154,7 @@ class PatchOptionsViewModel extends BaseViewModel {
onPressed: () {
Navigator.of(context).pop();
},
child: I18nText('cancelButton'),
child: Text(t.cancelButton),
),
],
contentPadding: const EdgeInsets.all(8),
@ -224,7 +224,7 @@ Future<void> showRequiredOptionNullDialog(
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('notice'),
title: Text(t.notice),
actions: [
TextButton(
onPressed: () async {
@ -248,20 +248,19 @@ Future<void> showRequiredOptionNullDialog(
PatchesSelectorViewModel().showPatchesChangeDialog(context);
}
},
child: I18nText('patchOptionsView.deselectPatch'),
child: Text(t.patchOptionsView.deselectPatch),
),
FilledButton(
onPressed: () {
Navigator.of(context).pop();
},
child: I18nText('okButton'),
child: Text(t.okButton),
),
],
content: I18nText(
'patchOptionsView.requiredOptionNull',
translationParams: {
'options': optionsTitles.join('\n'),
},
content: Text(
t.patchOptionsView.requiredOptionNull(
options: optionsTitles.join('\n'),
),
),
),
);