mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
feat: Allow changing languages (#1488)
Co-authored-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.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/services/toast.dart';
|
||||
@ -162,7 +162,7 @@ class _PatchItemState extends State<PatchItem> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('warning'),
|
||||
label: Text(t.warning),
|
||||
icon: const Icon(
|
||||
Icons.warning_amber_outlined,
|
||||
size: 20.0,
|
||||
@ -215,19 +215,18 @@ class _PatchItemState extends State<PatchItem> {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('warning'),
|
||||
content: I18nText(
|
||||
'patchItem.unsupportedDialogText',
|
||||
translationParams: {
|
||||
'packageVersion': widget.packageVersion,
|
||||
'supportedVersions':
|
||||
title: Text(t.warning),
|
||||
content: Text(
|
||||
t.patchItem.unsupportedDialogText(
|
||||
packageVersion: widget.packageVersion,
|
||||
supportedVersions:
|
||||
'• ${widget.supportedPackageVersions.reversed.join('\n• ')}',
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
child: Text(t.okButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -238,14 +237,14 @@ class _PatchItemState extends State<PatchItem> {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('notice'),
|
||||
content: I18nText(
|
||||
'patchItem.unsupportedRequiredOption',
|
||||
title: Text(t.notice),
|
||||
content: Text(
|
||||
t.patchItem.unsupportedRequiredOption,
|
||||
),
|
||||
actions: <Widget>[
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('okButton'),
|
||||
child: Text(t.okButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/gen/strings.g.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
@ -93,13 +93,10 @@ class IntAndStringPatchOption extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
I18nText(
|
||||
'patchOptionsView.requiredOption',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
Text(
|
||||
t.patchOptionsView.requiredOption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -240,14 +237,11 @@ class IntStringLongListPatchOption extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.add, size: 20),
|
||||
I18nText(
|
||||
'add',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
Text(
|
||||
t.add,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -279,13 +273,10 @@ class UnsupportedPatchOption extends StatelessWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: I18nText(
|
||||
'patchOptionsView.unsupportedOption',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
child: Text(
|
||||
t.patchOptionsView.unsupportedOption,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -452,13 +443,10 @@ class _TextFieldForPatchOptionState extends State<TextFieldForPatchOption> {
|
||||
..add(
|
||||
DropdownMenuItem(
|
||||
value: '',
|
||||
child: I18nText(
|
||||
'patchOptionsView.customValue',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
child: Text(
|
||||
t.patchOptionsView.customValue,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -491,25 +479,22 @@ class _TextFieldForPatchOptionState extends State<TextFieldForPatchOption> {
|
||||
isStringOption ? TextInputType.text : TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: PopupMenuButton(
|
||||
tooltip: FlutterI18n.translate(
|
||||
context,
|
||||
'patchOptionsView.tooltip',
|
||||
),
|
||||
tooltip: t.patchOptionsView.tooltip,
|
||||
itemBuilder: (BuildContext context) {
|
||||
return [
|
||||
if (isArrayOption)
|
||||
PopupMenuItem(
|
||||
value: 'remove',
|
||||
child: I18nText('remove'),
|
||||
value: t.remove,
|
||||
child: Text(t.remove),
|
||||
),
|
||||
if (isStringOption) ...[
|
||||
PopupMenuItem(
|
||||
value: 'patchOptionsView.selectFilePath',
|
||||
child: I18nText('patchOptionsView.selectFilePath'),
|
||||
value: t.patchOptionsView.selectFilePath,
|
||||
child: Text(t.patchOptionsView.selectFilePath),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'patchOptionsView.selectFolder',
|
||||
child: I18nText('patchOptionsView.selectFolder'),
|
||||
value: t.patchOptionsView.selectFolder,
|
||||
child: Text(t.patchOptionsView.selectFolder),
|
||||
),
|
||||
],
|
||||
];
|
||||
|
Reference in New Issue
Block a user