Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Launcher/l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
output-class: AppLocalizations
output-dir: lib/gen/l10n
32 changes: 23 additions & 9 deletions Launcher/lib/core/routing/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import 'package:kyber_launcher/features/social/screens/social_home.dart';
import 'package:kyber_launcher/features/stats/providers/stats_cubit.dart';
import 'package:kyber_launcher/features/stats/screens/personal/stats_overview.dart';
import 'package:kyber_launcher/features/stats/screens/stats.dart';
import 'package:kyber_launcher/gen/fonts.gen.dart';
import 'package:kyber_launcher/gen/l10n/app_localizations.dart';
import 'package:kyber_launcher/injection_container.dart';
import 'package:kyber_launcher/main.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Expand Down Expand Up @@ -189,22 +191,33 @@ final router = GoRouter(
initialLocation: '/home',
observers: [SentryNavigatorObserver()],
errorBuilder: (context, state) {
final l10n = AppLocalizations.of(context)!;
final isEn = Localizations.localeOf(context).languageCode == 'en';
final currentFont = isEn ? FontFamily.battlefrontUI : 'BattlefrontGlobal';

return SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Page Not Found',
style: TextStyle(fontWeight: FontWeight.bold),
Text(
l10n.pageNotFoundTitle,
style: TextStyle(
fontFamily: currentFont,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
Text(state.error?.toString() ?? 'page not found'),
Text(
state.error?.toString() ?? l10n.pageNotFoundFallback,
style: TextStyle(fontFamily: currentFont),
),
const SizedBox(height: 16),
Button(
onPressed: () => context.go('/'),
child: const Text(
'Go to home page',
child: Text(
l10n.goToHomePage,
style: TextStyle(fontFamily: currentFont),
),
),
],
Expand Down Expand Up @@ -370,7 +383,8 @@ final router = GoRouter(
//TODO: check for unsaved changes
return true;
},
pageBuilder: (_, state) {
pageBuilder: (context, state) {
final l10n = AppLocalizations.of(context)!;
return buildCustomPage(
state: state,
child: MultiBlocProvider(
Expand All @@ -393,7 +407,7 @@ final router = GoRouter(
if (collectionQuery == 'new') {
collection = ModCollectionMetaData(
localId: const Uuid().v4(),
title: 'New Collection',
title: l10n.newCollectionTitle,
mods: [],
);
} else {
Expand Down Expand Up @@ -522,4 +536,4 @@ final router = GoRouter(
],
),
],
);
);
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:kyber_launcher/features/nexusmods/services/nexusmods_service.dar
import 'package:kyber_launcher/features/settings/dialogs/chromium_download_dialog.dart';
import 'package:kyber_launcher/gen/assets.gen.dart';
import 'package:kyber_launcher/gen/fonts.gen.dart';
import 'package:kyber_launcher/gen/l10n/app_localizations.dart';
import 'package:kyber_launcher/injection_container.dart';
import 'package:kyber_launcher/shared/ui/buttons/custom_icon_button.dart';
import 'package:kyber_launcher/shared/ui/cards/kyber_container.dart';
Expand Down Expand Up @@ -120,16 +121,20 @@ class _DownloadManagerHeader extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final isEn = Localizations.localeOf(context).languageCode == 'en';
final currentFont = isEn ? FontFamily.battlefrontUI : 'BattlefrontGlobal';

return Padding(
padding: const EdgeInsets.all(15),
child: Row(
children: [
const Expanded(
Expanded(
child: Column(
crossAxisAlignment: .start,
children: [
Text(
'DOWNLOAD MANAGER',
const Text(
'DOWNLOAD MANAGER',
style: TextStyle(
fontFamily: FontFamily.aurebesh,
fontSize: 14,
Expand All @@ -138,9 +143,9 @@ class _DownloadManagerHeader extends StatelessWidget {
),
),
Text(
'DOWNLOAD MANAGER',
l10n.downloadManager.toUpperCase(),
style: TextStyle(
fontFamily: FontFamily.battlefrontUI,
fontFamily: currentFont,
fontSize: 24,
height: 1,
),
Expand Down Expand Up @@ -196,15 +201,19 @@ class _PausedDownloadsSection extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final isEn = Localizations.localeOf(context).languageCode == 'en';
final currentFont = isEn ? FontFamily.battlefrontUI : 'BattlefrontGlobal';

return Column(
crossAxisAlignment: .start,
children: [
const Padding(
padding: .symmetric(horizontal: 15, vertical: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
child: Text(
'PAUSED DOWNLOADS',
l10n.pausedDownloads.toUpperCase(),
style: TextStyle(
fontFamily: FontFamily.battlefrontUI,
fontFamily: currentFont,
fontSize: 20,
color: kWhiteColor,
),
Expand Down Expand Up @@ -251,7 +260,7 @@ class _DownloadTaskItem extends StatelessWidget {
children: [
_buildLeadingIcon(),
const VCardSection(),
Expanded(child: _buildTaskInfo()),
Expanded(child: _buildTaskInfo(context)),
if (task.status.isNotFinalState) ...[
const VCardSection(),
_buildCancelButton(),
Expand Down Expand Up @@ -301,7 +310,10 @@ class _DownloadTaskItem extends StatelessWidget {
);
}

Widget _buildTaskInfo() {
Widget _buildTaskInfo(BuildContext context) {
final isEn = Localizations.localeOf(context).languageCode == 'en';
final currentFont = isEn ? FontFamily.battlefrontUI : 'BattlefrontGlobal';

return Stack(
children: [
Positioned.fill(
Expand All @@ -312,8 +324,8 @@ class _DownloadTaskItem extends StatelessWidget {
children: [
Text(
task.task.displayName,
style: const TextStyle(
fontFamily: FontFamily.battlefrontUI,
style: TextStyle(
fontFamily: currentFont,
fontSize: 18,
height: 1,
color: kWhiteColor,
Expand Down Expand Up @@ -426,25 +438,29 @@ class _NexusPremiumBanner extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final isEn = Localizations.localeOf(context).languageCode == 'en';
final currentFont = isEn ? FontFamily.battlefrontUI : 'BattlefrontGlobal';

return Center(
child: Container(
padding: const EdgeInsets.all(15),
child: RichText(
text: TextSpan(
children: [
const TextSpan(
text: 'UN-CAP DOWNLOAD SPEEDS WITH ',
TextSpan(
text: l10n.unCapSpeedPrefix,
style: TextStyle(
color: kGrayColor,
fontFamily: FontFamily.battlefrontUI,
fontFamily: currentFont,
fontSize: 16,
),
),
TextSpan(
text: 'NEXUS MODS PREMIUM',
text: l10n.nexusModsPremium,
style: TextStyle(
color: kActiveColor,
fontFamily: FontFamily.battlefrontUI,
fontFamily: currentFont,
fontSize: 16,
),
recognizer: TapGestureRecognizer()
Expand Down Expand Up @@ -629,4 +645,4 @@ class _DownloadProgressIndicator extends StatelessWidget {
),
);
}
}
}
Loading