中文翻译

This commit is contained in:
rang 2025-10-29 16:06:12 +08:00
parent e354949cc1
commit 989a28fac0
8 changed files with 922 additions and 770 deletions

View file

@ -4,7 +4,9 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:vaani/api/api_provider.dart';
import 'package:vaani/features/onboarding/view/user_login.dart';
import 'package:vaani/generated/l10n.dart';
import 'package:vaani/settings/api_settings_provider.dart';
import 'package:vaani/settings/constants.dart';
import 'package:vaani/shared/utils.dart';
import 'package:vaani/shared/widgets/add_new_server.dart';
@ -77,7 +79,7 @@ class OnboardingBody extends HookConsumerWidget {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Welcome to Vaani',
S.of(context).loginTitle(AppMetadata.appName),
style: Theme.of(context).textTheme.headlineSmall,
),
),
@ -91,7 +93,7 @@ class OnboardingBody extends HookConsumerWidget {
transitionBuilder: fadeSlideTransitionBuilder,
child: canUserLogin.value
? Text(
'Server connected, please login',
S.of(context).loginServerConnected,
key: const ValueKey('connected'),
style: Theme.of(context).textTheme.bodyMedium,
)
@ -145,7 +147,7 @@ class RedirectToABS extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
// a simple text with hyper link to only the "click here" part
const Text('Do not have a server? '),
Text(S.of(context).loginServerNo),
// a simple text with hyper link to the github page
TextButton(
autofocus: false,
@ -159,16 +161,16 @@ class RedirectToABS extends StatelessWidget {
onPressed: () async {
// open the github page
// ignore: avoid_print
print('Opening the github page');
// print('Opening the github page');
await handleLaunchUrl(
Uri.parse(
'https://www.audiobookshelf.org',
),
);
},
child: const Text('Click here'),
child: Text(S.of(context).loginServerClick),
),
const Text(' to know how to setup a server.'),
Text(S.of(context).loginServerTo),
],
),
);

View file

@ -14,6 +14,7 @@ import 'package:vaani/features/onboarding/view/user_login_with_password.dart'
show UserLoginWithPassword;
import 'package:vaani/features/onboarding/view/user_login_with_token.dart'
show UserLoginWithToken;
import 'package:vaani/generated/l10n.dart';
import 'package:vaani/hacks/fix_autofill_losing_focus.dart'
show InactiveFocusScopeObserver;
import 'package:vaani/models/error_response.dart' show ErrorResponseHandler;
@ -64,7 +65,7 @@ class UserLoginWidget extends HookConsumerWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Server is not reachable: $error'),
Text(S.of(context).loginServerNot('$error')),
ElevatedButton(
onPressed: () {
ref.invalidate(
@ -74,7 +75,7 @@ class UserLoginWidget extends HookConsumerWidget {
),
);
},
child: const Text('Try again'),
child: Text(S.of(context).retry),
),
],
),
@ -154,7 +155,7 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
// a small label to show the user what to do
if (localAvailable)
ChoiceChip(
label: const Text('Local'),
label: Text(S.of(context).loginLocal),
selected: methodChoice.value == AuthMethodChoice.local,
onSelected: (selected) {
if (selected) {
@ -164,7 +165,7 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
),
if (openIDAvailable)
ChoiceChip(
label: const Text('OpenID'),
label: Text(S.of(context).loginOpenID),
selected: methodChoice.value == AuthMethodChoice.openid,
onSelected: (selected) {
if (selected) {
@ -173,7 +174,7 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
},
),
ChoiceChip(
label: const Text('Token'),
label: Text(S.of(context).loginToken),
selected:
methodChoice.value == AuthMethodChoice.authToken,
onSelected: (selected) {

View file

@ -6,6 +6,7 @@ import 'package:lottie/lottie.dart';
import 'package:shelfsdk/audiobookshelf_api.dart';
import 'package:vaani/api/api_provider.dart';
import 'package:vaani/api/authenticated_users_provider.dart';
import 'package:vaani/generated/l10n.dart';
import 'package:vaani/hacks/fix_autofill_losing_focus.dart';
import 'package:vaani/models/error_response.dart';
import 'package:vaani/router/router.dart';
@ -107,7 +108,7 @@ class UserLoginWithPassword extends HookConsumerWidget {
autofillHints: const [AutofillHints.username],
textInputAction: TextInputAction.next,
decoration: InputDecoration(
labelText: 'Username',
labelText: S.of(context).loginUsername,
labelStyle: TextStyle(
color: Theme.of(context)
.colorScheme
@ -127,7 +128,7 @@ class UserLoginWithPassword extends HookConsumerWidget {
loginAndSave();
},
decoration: InputDecoration(
labelText: 'Password',
labelText: S.of(context).loginPassword,
labelStyle: TextStyle(
color: Theme.of(context)
.colorScheme
@ -165,7 +166,7 @@ class UserLoginWithPassword extends HookConsumerWidget {
const SizedBox(height: 30),
ElevatedButton(
onPressed: loginAndSave,
child: const Text('Login'),
child: Text(S.of(context).loginLogin),
),
],
),