feat: Added translations, use locales instead of depending on hardcoded strings. (#65)

## Pull Request Description

Single and hopefully only commit so weblate is up-to-date with last
repository

## Special thanks to the translators 🎉 

@kingu - Noors (Bokmål) (nb_NO)
@alison2033  - Portuguese (Brazil) (pt_BR)
@andreasmolnardev - German (de)
@stanol - Ukrainian (uk)

If I forgot someone let me know!

## Checklist

- [x] If a new package was added, did you ensure it works for all
supported platforms? Is the package also well maintained?
- [x] Did you add localization for any text? If yes, did you sort the
.arb file using ```arb_utils sort <INPUT_FILE>```?
- [x] Check that any changes are related to the issue at hand.

---------

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-10-23 18:27:24 +02:00 committed by GitHub
parent 62e046de4a
commit eb231f37cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 6619 additions and 686 deletions

View file

@ -22,7 +22,6 @@ import 'package:fladder/screens/shared/default_alert_dialog.dart';
import 'package:fladder/screens/shared/input_fields.dart';
import 'package:fladder/util/adaptive_layout.dart';
import 'package:fladder/util/custom_color_themes.dart';
import 'package:fladder/util/local_extension.dart';
import 'package:fladder/util/localization_helper.dart';
import 'package:fladder/util/option_dialogue.dart';
import 'package:fladder/util/simple_duration_picker.dart';
@ -234,30 +233,39 @@ class _ClientSettingsPageState extends ConsumerState<ClientSettingsPage> {
SettingsLabelDivider(label: context.localized.settingsVisual),
SettingsListTile(
label: Text(context.localized.displayLanguage),
trailing: EnumBox(
current: ref.watch(
trailing: Localizations.override(
context: context,
locale: ref.watch(
clientSettingsProvider.select(
(value) => (value.selectedLocale ?? currentLocale).label(),
(value) => (value.selectedLocale ?? currentLocale),
),
),
itemBuilder: (context) {
return [
...AppLocalizations.supportedLocales.map(
(entry) => PopupMenuItem(
value: entry,
child: Text(
entry.label(),
style: TextStyle(
fontWeight: currentLocale.languageCode == entry.languageCode ? FontWeight.bold : null,
child: Builder(builder: (context) {
return EnumBox(
current: context.localized.nativeName,
itemBuilder: (context) {
return [
...AppLocalizations.supportedLocales.map(
(entry) => PopupMenuItem(
value: entry,
child: Localizations.override(
context: context,
locale: entry,
child: Builder(builder: (context) {
return Text(
context.localized.nativeName,
);
}),
),
onTap: () => ref
.read(clientSettingsProvider.notifier)
.update((state) => state.copyWith(selectedLocale: entry)),
),
),
onTap: () => ref
.read(clientSettingsProvider.notifier)
.update((state) => state.copyWith(selectedLocale: entry)),
),
)
];
},
)
];
},
);
}),
),
),
SettingsListTile(