Skip to content
Merged
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
3 changes: 2 additions & 1 deletion lib/core/settings/domain/settings_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ enum Language {
russian('ru', 'RU', 'Русский'),
german('de', 'DE', 'Deutsch'),
italian('it', 'IT', 'Italiano'),
portuguese('pt', 'PT', 'Português');
portuguese('pt', 'PT', 'Português'),
simplifiedChinese('zh', 'CN', '简体中文');

final String languageCode;
final String? countryCode;
Expand Down
12 changes: 10 additions & 2 deletions lib/features/bip329_labels/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@ class Bip329LabelsPage extends StatelessWidget {
exportSuccess: (labelsCount) {
SnackBarUtils.showSnackBar(
context,
context.loc.bip329LabelsExportSuccess(labelsCount),
labelsCount == 1
? context.loc.bip329LabelsExportSuccessSingular
: context.loc.bip329LabelsExportSuccessPlural(
labelsCount,
),
);
},
importSuccess: (labelsCount) {
SnackBarUtils.showSnackBar(
context,
context.loc.bip329LabelsImportSuccess(labelsCount),
labelsCount == 1
? context.loc.bip329LabelsImportSuccessSingular
: context.loc.bip329LabelsImportSuccessPlural(
labelsCount,
),
);
},
error: (message) {
Expand Down
4 changes: 4 additions & 0 deletions lib/features/onboarding/ui/screens/advanced_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:bb_mobile/core/widgets/settings_entry_item.dart';
import 'package:bb_mobile/features/electrum_settings/frameworks/ui/routing/electrum_settings_router.dart';
import 'package:bb_mobile/features/recoverbull/ui/pages/settings_page.dart';
import 'package:bb_mobile/features/settings/presentation/bloc/settings_cubit.dart';
import 'package:bb_mobile/features/settings/ui/widgets/translation_warning_bottom_sheet.dart';
import 'package:bb_mobile/features/tor_settings/presentation/bloc/tor_settings_cubit.dart';
import 'package:bb_mobile/features/tor_settings/ui/widgets/tor_proxy_widget.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -102,6 +103,9 @@ class _AdvancedOptionsState extends State<AdvancedOptions> {
context.read<SettingsCubit>().changeLanguage(
newLanguage,
);
if (newLanguage != Language.unitedStatesEnglish) {
TranslationWarningBottomSheet.show(context);
}
}
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:bb_mobile/core/widgets/settings_entry_item.dart';
import 'package:bb_mobile/features/settings/presentation/bloc/settings_cubit.dart';
import 'package:bb_mobile/features/settings/ui/settings_router.dart';
import 'package:bb_mobile/features/settings/ui/widgets/dev_mode_switch.dart';
import 'package:bb_mobile/features/settings/ui/widgets/translation_warning_bottom_sheet.dart';
import 'package:bb_mobile/features/tor_settings/ui/tor_settings_router.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -49,6 +50,9 @@ class AppSettingsScreen extends StatelessWidget {
context.read<SettingsCubit>().changeLanguage(
newLanguage,
);
if (newLanguage != Language.unitedStatesEnglish) {
TranslationWarningBottomSheet.show(context);
}
}
},
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/utils/build_context_x.dart';
import 'package:bb_mobile/core/widgets/bottom_sheet/x.dart';
import 'package:bb_mobile/core/widgets/buttons/button.dart';
import 'package:bb_mobile/core/widgets/text/text.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class TranslationWarningBottomSheet extends StatelessWidget {
const TranslationWarningBottomSheet({super.key});

static const String _weblateUrl = 'https://hosted.weblate.org/engage/bull/';
static bool _hasBeenShown = false;

static Future<void> show(BuildContext context) {
if (_hasBeenShown) return Future.value();
_hasBeenShown = true;

return BlurredBottomSheet.show(
context: context,
child: const TranslationWarningBottomSheet(),
);
}

Future<void> _openWeblate() async {
final url = Uri.parse(_weblateUrl);
await launchUrl(url, mode: LaunchMode.externalApplication);
}

@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: context.appColors.outline.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(2),
),
),
const SizedBox(height: 24),
Icon(Icons.translate, size: 48, color: context.appColors.primary),
const SizedBox(height: 16),
BBText(
context.loc.translationWarningTitle,
style: context.font.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
BBText(
context.loc.translationWarningDescription,
style: context.font.bodyMedium?.copyWith(
color: context.appColors.secondary.withValues(alpha: 0.7),
),
textAlign: TextAlign.center,
maxLines: 6,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 24),

BBButton.big(
label: context.loc.translationWarningContributeButton,
onPressed: () async {
Navigator.of(context).pop();
await _openWeblate();
},
bgColor: context.appColors.secondary,
textColor: context.appColors.onSecondary,
),
],
),
),
),
);
}
}
Loading