mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 13:05:37 +02:00
feat: Allow changing languages (#1488)
Co-authored-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
parent
c498cff096
commit
f82c439b26
64 changed files with 1302 additions and 1488 deletions
|
@ -1,8 +1,8 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
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/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
|
||||
|
@ -32,7 +32,7 @@ class SManageSources extends BaseViewModel {
|
|||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
I18nText('settingsView.sourcesLabel'),
|
||||
Text(t.settingsView.sourcesLabel),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.manage_history_outlined),
|
||||
|
@ -58,10 +58,7 @@ class SManageSources extends BaseViewModel {
|
|||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: FlutterI18n.translate(
|
||||
context,
|
||||
'settingsView.hostRepositoryLabel',
|
||||
),
|
||||
labelText: t.settingsView.hostRepositoryLabel,
|
||||
hintText: hostRepository,
|
||||
),
|
||||
),
|
||||
|
@ -77,10 +74,7 @@ class SManageSources extends BaseViewModel {
|
|||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: FlutterI18n.translate(
|
||||
context,
|
||||
'settingsView.orgPatchesLabel',
|
||||
),
|
||||
labelText: t.settingsView.orgPatchesLabel,
|
||||
hintText: patchesRepo.split('/')[0],
|
||||
),
|
||||
),
|
||||
|
@ -96,10 +90,7 @@ class SManageSources extends BaseViewModel {
|
|||
color: Colors.transparent,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: FlutterI18n.translate(
|
||||
context,
|
||||
'settingsView.sourcesPatchesLabel',
|
||||
),
|
||||
labelText: t.settingsView.sourcesPatchesLabel,
|
||||
hintText: patchesRepo.split('/')[1],
|
||||
),
|
||||
),
|
||||
|
@ -115,10 +106,7 @@ class SManageSources extends BaseViewModel {
|
|||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: FlutterI18n.translate(
|
||||
context,
|
||||
'settingsView.orgIntegrationsLabel',
|
||||
),
|
||||
labelText: t.settingsView.orgIntegrationsLabel,
|
||||
hintText: integrationsRepo.split('/')[0],
|
||||
),
|
||||
),
|
||||
|
@ -134,15 +122,12 @@ class SManageSources extends BaseViewModel {
|
|||
color: Colors.transparent,
|
||||
),
|
||||
border: const OutlineInputBorder(),
|
||||
labelText: FlutterI18n.translate(
|
||||
context,
|
||||
'settingsView.sourcesIntegrationsLabel',
|
||||
),
|
||||
labelText: t.settingsView.sourcesIntegrationsLabel,
|
||||
hintText: integrationsRepo.split('/')[1],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
I18nText('settingsView.sourcesUpdateNote'),
|
||||
Text(t.settingsView.sourcesUpdateNote),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -155,7 +140,7 @@ class SManageSources extends BaseViewModel {
|
|||
_intSourceController.clear();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('cancelButton'),
|
||||
child: Text(t.cancelButton),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
|
@ -168,10 +153,10 @@ class SManageSources extends BaseViewModel {
|
|||
);
|
||||
_managerAPI.setCurrentPatchesVersion('0.0.0');
|
||||
_managerAPI.setCurrentIntegrationsVersion('0.0.0');
|
||||
_toast.showBottom('settingsView.restartAppForChanges');
|
||||
_toast.showBottom(t.settingsView.restartAppForChanges);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: I18nText('okButton'),
|
||||
child: Text(t.okButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -182,12 +167,12 @@ class SManageSources extends BaseViewModel {
|
|||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||
content: I18nText('settingsView.sourcesResetDialogText'),
|
||||
title: Text(t.settingsView.sourcesResetDialogTitle),
|
||||
content: Text(t.settingsView.sourcesResetDialogText),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: I18nText('noButton'),
|
||||
child: Text(t.noButton),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
|
@ -196,12 +181,12 @@ class SManageSources extends BaseViewModel {
|
|||
_managerAPI.setIntegrationsRepo('');
|
||||
_managerAPI.setCurrentPatchesVersion('0.0.0');
|
||||
_managerAPI.setCurrentIntegrationsVersion('0.0.0');
|
||||
_toast.showBottom('settingsView.restartAppForChanges');
|
||||
_toast.showBottom(t.settingsView.restartAppForChanges);
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..pop();
|
||||
},
|
||||
child: I18nText('yesButton'),
|
||||
child: Text(t.yesButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -218,8 +203,8 @@ class SManageSourcesUI extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return SettingsTileDialog(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: 'settingsView.sourcesLabel',
|
||||
subtitle: 'settingsView.sourcesLabelHint',
|
||||
title: t.settingsView.sourcesLabel,
|
||||
subtitle: t.settingsView.sourcesLabelHint,
|
||||
onTap: () => sManageSources.showSourcesDialog(context),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue