Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate most of the setting pages #1802

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
// SPDX-License-Identifier: EUPL-1.2

import 'package:flutter/material.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';

enum NavigationExperimentOption {
/// Current Navigation (Drawer + BNB)
drawerAndBnb,
Expand All @@ -19,14 +22,14 @@ enum NavigationExperimentOption {
}

extension ToReadableString on NavigationExperimentOption {
String toReadableString() {
switch (this) {
case NavigationExperimentOption.drawerAndBnb:
return 'Aktuelle Navigation';
case NavigationExperimentOption.extendableBnb:
return 'Neue Navigation - Ohne Mehr-Button';
case NavigationExperimentOption.extendableBnbWithMoreButton:
return 'Neue Navigation - Mit Mehr-Button';
}
String getDisplayName(BuildContext context) {
return switch (this) {
NavigationExperimentOption.drawerAndBnb =>
context.l10n.navigationExperimentOptionDrawerAndBnb,
NavigationExperimentOption.extendableBnb =>
context.l10n.navigationExperimentOptionExtendableBnb,
NavigationExperimentOption.extendableBnbWithMoreButton =>
context.l10n.navigationExperimentOptionExtendableBnbWithMoreButton,
};
}
}
48 changes: 25 additions & 23 deletions app/lib/settings/src/subpages/about/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';
import 'package:sharezone_utils/launch_link.dart';
import 'package:sharezone/util/platform_information_manager/get_platform_information_retreiver.dart';
import 'package:sharezone/util/platform_information_manager/platform_information_retreiver.dart';
Expand Down Expand Up @@ -35,7 +36,8 @@ class AboutPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Über uns"), centerTitle: true),
appBar:
AppBar(title: Text(context.l10n.aboutPageTitle), centerTitle: true),
body: SingleChildScrollView(
padding: const EdgeInsets.all(12),
child: SafeArea(
Expand Down Expand Up @@ -68,30 +70,34 @@ class _AboutHeader extends StatelessWidget {
avatarBackgroundColor: Colors.white,
children: <Widget>[
Text(
"Sharezone",
context.l10n.aboutPageHeaderTitle,
style: TextStyle(
color:
Theme.of(context).isDarkTheme ? Colors.white : Colors.black54,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const Text(
"Der vernetzte Schulplaner",
style: TextStyle(
Text(
context.l10n.aboutPageHeaderSubtitle,
style: const TextStyle(
color: Colors.grey,
fontSize: 15,
),
),
FutureBuilder<PlatformInformationRetriever>(
future: getPlatformInformationRetrieverWithInit(),
builder: (context, snapshot) {
if (!snapshot.hasData) return const Text("Version wird geladen...");
if (!snapshot.hasData) {
return Text(context.l10n.aboutPageLoadingVersion);
}
if (snapshot.hasError) {
return Text("Fehler: ${snapshot.error.toString()}");
return Text(context.l10n.commonDisplayError('${snapshot.error}'));
}
final buildNumber = snapshot.data?.versionNumber;
final version = snapshot.data?.version;
return Text(
"Version: ${snapshot.data?.version} (${snapshot.data?.versionNumber})",
context.l10n.aboutPageVersion(version, buildNumber),
style: TextStyle(
color: Colors.grey[400],
fontSize: 14,
Expand All @@ -108,23 +114,24 @@ class _FollowUs extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AboutSection(
title: 'Folge uns',
title: context.l10n.aboutPageFollowUsTitle,
child: CustomCard(
padding: const EdgeInsets.all(12),
child: Column(
children: <Widget>[
Text(
"Folge uns auf unseren Kanälen, um immer auf dem neusten Stand zu bleiben.",
context.l10n.aboutPageFollowUsSubtitle,
style: _greyTextStyle(context),
),
const SizedBox(height: 8),
const Row(
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
SocialButton.instagram("https://sharezone.net/instagram"),
SocialButton.twitter("https://sharezone.net/twitter"),
SocialButton.discord("https://sharezone.net/discord"),
SocialButton.github("https://sharezone.net/github"),
SocialButton.instagram(
context, "https://sharezone.net/instagram"),
SocialButton.twitter(context, "https://sharezone.net/twitter"),
SocialButton.discord(context, "https://sharezone.net/discord"),
SocialButton.github(context, "https://sharezone.net/github"),
],
)
],
Expand All @@ -138,25 +145,20 @@ class _AboutSharezone extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AboutSection(
title: 'Was ist Sharezone?',
title: context.l10n.aboutPageAboutSectionTitle,
child: CustomCard(
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SelectableText(
"Sharezone ist ein vernetzter Schulplaner, welcher die Organisation von Schülern, Lehrkräften und Eltern aus der"
" Steinzeit in das digitale Zeitalter katapultiert. Das Hausaufgabenheft, der Terminplaner, die Dateiablage "
"und vieles weitere wird direkt mit der kompletten Klasse geteilt. Dabei ist keine Registrierung der Schule und "
"die Leitung einer Lehrkraft notwendig, so dass du direkt durchstarten und deinen Schulalltag bequem und "
"einfach gestalten kannst.",
context.l10n.aboutPageAboutSectionDescription,
style: _greyTextStyle(context),
),
const SizedBox(height: 8),
MarkdownBody(
data:
"Besuche für weitere Informationen einfach https://www.sharezone.net.",
data: context.l10n.aboutPageAboutSectionVisitWebsite,
selectable: true,
styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context))
.copyWith(
Expand Down
10 changes: 6 additions & 4 deletions app/lib/settings/src/subpages/about/widgets/member_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ class _MemberCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
if (isNotEmptyOrNull(socialMediaLinks?.instagram))
SocialButton.instagram(socialMediaLinks!.instagram!),
SocialButton.instagram(
context, socialMediaLinks!.instagram!),
if (isNotEmptyOrNull(socialMediaLinks?.twitter))
SocialButton.twitter(socialMediaLinks!.twitter!),
SocialButton.twitter(context, socialMediaLinks!.twitter!),
if (isNotEmptyOrNull(socialMediaLinks?.linkedIn))
SocialButton.linkedIn(socialMediaLinks!.linkedIn!),
if (isNotEmptyOrNull(email)) SocialButton.email(email!),
SocialButton.linkedIn(context, socialMediaLinks!.linkedIn!),
if (isNotEmptyOrNull(email))
SocialButton.email(context, email!),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:flutter/material.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';
import 'package:sharezone_utils/launch_link.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'package:url_launcher/url_launcher.dart';
Expand All @@ -28,33 +29,33 @@ class SocialButton extends StatelessWidget {
required this.socialButtonTypes,
});

const SocialButton.instagram(this.link, {super.key})
: tooltip = 'Instagram',
SocialButton.instagram(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.instagram,
svgPath = 'assets/icons/instagram.svg',
socialButtonTypes = SocialButtonTypes.instagram;

const SocialButton.twitter(this.link, {super.key})
: tooltip = 'Twitter',
SocialButton.twitter(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.twitter,
svgPath = 'assets/icons/twitter.svg',
socialButtonTypes = SocialButtonTypes.twitter;

const SocialButton.linkedIn(this.link, {super.key})
: tooltip = 'LinkedIn',
SocialButton.linkedIn(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.linkedIn,
svgPath = 'assets/icons/linkedin.svg',
socialButtonTypes = SocialButtonTypes.linkedIn;

const SocialButton.discord(this.link, {super.key})
: tooltip = 'Discord',
SocialButton.discord(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.discord,
svgPath = 'assets/icons/discord.svg',
nilsreichardt marked this conversation as resolved.
Show resolved Hide resolved
socialButtonTypes = SocialButtonTypes.linkedIn;

const SocialButton.email(this.link, {super.key})
: tooltip = 'E-Mail',
SocialButton.email(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.email,
svgPath = 'assets/icons/email.svg',
socialButtonTypes = SocialButtonTypes.email;

const SocialButton.github(this.link, {super.key})
: tooltip = 'GitHub',
SocialButton.github(BuildContext context, this.link, {super.key})
: tooltip = context.l10n.gitHub,
svgPath = 'assets/icons/github.svg',
socialButtonTypes = SocialButtonTypes.linkedIn;

Expand All @@ -72,7 +73,7 @@ class SocialButton extends StatelessWidget {
} on Exception catch (_) {
if (!context.mounted) return;
showSnackSec(
text: "E-Mail: $link",
text: context.l10n.aboutPageEmailCopiedConfirmation(link),
context: context,
);
}
Expand Down
3 changes: 2 additions & 1 deletion app/lib/settings/src/subpages/about/widgets/team.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import 'package:flutter/material.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'about_section.dart';
import 'social_media_button.dart';
Expand All @@ -27,7 +28,7 @@ class TeamList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AboutSection(
title: 'Über uns',
title: context.l10n.aboutPageTeamSectionTitle,
child: Column(
children: <Widget>[
const SizedBox(height: 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:legal/legal.dart';
import 'package:sharezone/groups/src/widgets/contact_support.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';
import 'package:sharezone_utils/launch_link.dart';

class ImprintPage extends StatelessWidget {
Expand All @@ -20,7 +21,7 @@ class ImprintPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Impressum")),
appBar: AppBar(title: Text(context.l10n.imprintPageTitle)),
body: SingleChildScrollView(
padding: const EdgeInsets.all(12),
child: SafeArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class ChangeDataPasswordField extends StatefulWidget {
const ChangeDataPasswordField({
super.key,
required this.onEditComplete,
required this.labelText,
this.focusNode,
this.labelText = "Passwort",
this.autofocus = false,
});

Expand Down
32 changes: 19 additions & 13 deletions app/lib/settings/src/subpages/my_profile/change_email.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone/account/change_data_bloc.dart';
import 'package:sharezone/settings/src/subpages/my_profile/submit_method.dart';
import 'package:sharezone/settings/src/subpages/my_profile/change_data.dart';
import 'package:sharezone_localizations/sharezone_localizations.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

const snackBarText = 'Neue E-Mail Adresse wird an die Zentrale geschickt...';
Expand All @@ -32,7 +33,10 @@ class ChangeEmailPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("E-Mail ändern"), centerTitle: true),
appBar: AppBar(
title: Text(context.l10n.changeEmailAddressPageTitle),
centerTitle: true,
),
body: ChangeEmailPageBody(),
floatingActionButton: const ChangeEmailFab(),
);
Expand All @@ -46,7 +50,7 @@ class ChangeEmailFab extends StatelessWidget {
Widget build(BuildContext context) {
return FloatingActionButton(
onPressed: () => submit(context, snackBarText, changeType),
tooltip: "Speichern",
tooltip: context.l10n.commonActionsSave,
child: const Icon(Icons.check),
);
}
Expand Down Expand Up @@ -74,13 +78,15 @@ class ChangeEmailPageBody extends StatelessWidget {
currentEmail: currentEmail, passwordNode: passwordNode),
const SizedBox(height: 8),
ChangeDataPasswordField(
labelText:
context.l10n.changeEmailAddressPageNewEmailTextfieldLabel,
focusNode: passwordNode,
onEditComplete: () async =>
await submit(context, snackBarText, changeType)),
const SizedBox(height: 16),
const Text(
"Hinweis: Wenn deine E-Mail geändert wurde, wirst du automatisch kurz ab- und sofort wieder angemeldet - also nicht wundern 😉",
style: TextStyle(color: Colors.grey, fontSize: 11),
Text(
context.l10n.changeEmailAddressPageNoteOnAutomaticSignOutSignIn,
style: const TextStyle(color: Colors.grey, fontSize: 11),
),
const Divider(height: 42),
const _WhyWeNeedTheEmail(),
Expand All @@ -97,12 +103,9 @@ class _WhyWeNeedTheEmail extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const InfoMessage(
title: "Wozu brauchen wir deine E-Mail?",
message:
"Die E-Mail benötigst du um dich anzumelden. Solltest du zufällig mal dein Passwort vergessen haben, "
"können wir dir an diese E-Mail-Adresse einen Link zum Zurücksetzen des Passworts schicken. Deine E-Mail Adresse "
"ist nur für dich sichtbar, und sonst niemanden.",
return InfoMessage(
title: context.l10n.changeEmailAddressPageWhyWeNeedTheEmailInfoTitle,
message: context.l10n.changeEmailAddressPageWhyWeNeedTheEmailInfoContent,
withPrivacyStatement: true,
);
}
Expand All @@ -117,7 +120,9 @@ class _CurrentEmailField extends StatelessWidget {
Widget build(BuildContext context) {
return TextField(
controller: TextEditingController(text: currentEmail),
decoration: const InputDecoration(labelText: "Aktuell"),
decoration: InputDecoration(
labelText:
context.l10n.changeEmailAddressPageCurrentEmailTextfieldLabel),
enabled: false,
style: const TextStyle(color: Colors.grey, fontSize: 16),
);
Expand Down Expand Up @@ -160,7 +165,8 @@ class __NewEmailFieldState extends State<_NewEmailField> {
FocusManager.instance.primaryFocus?.unfocus(),
textInputAction: TextInputAction.next,
decoration: InputDecoration(
labelText: "Neu",
labelText:
context.l10n.changeEmailAddressPageNewEmailTextfieldLabel,
errorText: snapshot.error?.toString(),
),
onChanged: (newEmail) => bloc.changeEmail(newEmail.trim()),
Expand Down
Loading
Loading