mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: Allow changing languages (#1488)
Co-authored-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
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/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
@ -51,19 +51,15 @@ class InstalledAppsCard extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
I18nText(
|
||||
'homeView.noInstallations',
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
t.homeView.noInstallations,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -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/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
|
||||
@ -39,13 +39,13 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
children: <Widget>[
|
||||
FutureBuilder<String?>(
|
||||
future: model.getLatestManagerReleaseTime(),
|
||||
builder: (context, snapshot) => snapshot.hasData &&
|
||||
snapshot.data!.isNotEmpty
|
||||
? I18nText(
|
||||
'latestCommitCard.timeagoLabel',
|
||||
translationParams: {'time': snapshot.data!},
|
||||
)
|
||||
: I18nText('latestCommitCard.loadingLabel'),
|
||||
builder: (context, snapshot) =>
|
||||
snapshot.hasData && snapshot.data!.isNotEmpty
|
||||
? Text(
|
||||
t.latestCommitCard
|
||||
.timeagoLabel(time: snapshot.data!),
|
||||
)
|
||||
: Text(t.latestCommitCard.loadingLabel),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -62,8 +62,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
!snapshot.data!,
|
||||
),
|
||||
child: (snapshot.hasData && !snapshot.data!)
|
||||
? I18nText('showChangelogButton')
|
||||
: I18nText('showUpdateButton'),
|
||||
? Text(t.showChangelogButton)
|
||||
: Text(t.showUpdateButton),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -89,15 +89,9 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
future: model.getLatestPatchesReleaseTime(),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.hasData && snapshot.data!.isNotEmpty
|
||||
? FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.timeagoLabel',
|
||||
translationParams: {'time': snapshot.data!},
|
||||
)
|
||||
: FlutterI18n.translate(
|
||||
context,
|
||||
'latestCommitCard.loadingLabel',
|
||||
),
|
||||
? t.latestCommitCard
|
||||
.timeagoLabel(time: snapshot.data!)
|
||||
: t.latestCommitCard.loadingLabel,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -115,8 +109,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
!snapshot.data!,
|
||||
),
|
||||
child: (snapshot.hasData && !snapshot.data!)
|
||||
? I18nText('showChangelogButton')
|
||||
: I18nText('showUpdateButton'),
|
||||
? Text(t.showChangelogButton)
|
||||
: Text(t.showUpdateButton),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/gen/strings.g.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
|
||||
class UpdateConfirmationSheet extends StatelessWidget {
|
||||
@ -51,16 +51,13 @@ class UpdateConfirmationSheet extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
I18nText(
|
||||
Text(
|
||||
isPatches
|
||||
? 'homeView.updatePatchesSheetTitle'
|
||||
: 'homeView.updateSheetTitle',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
? t.homeView.updatePatchesSheetTitle
|
||||
: t.homeView.updateSheetTitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4.0),
|
||||
@ -94,40 +91,36 @@ class UpdateConfirmationSheet extends StatelessWidget {
|
||||
? model.updatePatches(context)
|
||||
: model.updateManager(context);
|
||||
},
|
||||
child: I18nText('updateButton'),
|
||||
child: Text(t.updateButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12.0, left: 24.0, bottom: 12.0),
|
||||
child: I18nText(
|
||||
'homeView.updateChangelogTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
child: Text(
|
||||
t.homeView.updateChangelogTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Markdown(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
data: snapshot.data!['body'] ?? '',
|
||||
),
|
||||
),
|
||||
child: Markdown(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
data: snapshot.data!['body'] ?? '',
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
Reference in New Issue
Block a user