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

Create English locale #144

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
fivekmrun_app_flutter/ios/Flutter/.last_build_id
fivekmrun_app_flutter/lib/private/secrets.dart
.idea
3 changes: 3 additions & 0 deletions fivekmrun_app_flutter/l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_bg.arb
output-localization-file: app_localizations.dart
12 changes: 7 additions & 5 deletions fivekmrun_app_flutter/lib/app_rating_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:rate_my_app/rate_my_app.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class AppRatingManager {
AppRatingManager(BuildContext context) {
Expand All @@ -18,12 +20,12 @@ class AppRatingManager {
if (rateMyApp.shouldOpenDialog) {
FirebaseAnalytics.instance.logEvent(name: "review_dialog_open");
rateMyApp.showRateDialog(context,
title: 'Харесвате ли приложението?',
title: AppLocalizations.of(context)!.app_rating_manager_title,
message:
'Помогнете ни да го направим още по-добро, като оставите вашето мнение',
rateButton: 'Да, разбира се',
noButton: 'По-късно',
laterButton: 'Не, благодаря',
AppLocalizations.of(context)!.app_rating_manager_message,
rateButton: AppLocalizations.of(context)!.app_rating_manager_rate_button,
noButton: AppLocalizations.of(context)!.app_rating_manager_no_button,
laterButton: AppLocalizations.of(context)!.app_rating_manager_later_button,
//ignoreIOS: false, // Set to false if you want to show the native Apple app rating dialog on iOS.
listener: (button) {
// The button click listener (useful if you want to cancel the click event).
Expand Down
5 changes: 3 additions & 2 deletions fivekmrun_app_flutter/lib/barcode_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:fivekmrun_flutter/state/user_resource.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:uuid/uuid.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class BarcodePage extends StatelessWidget {
final Uuid uuid = Uuid();
Expand All @@ -20,7 +21,7 @@ class BarcodePage extends StatelessWidget {
final userId = (user?.id != null) ? user?.id : 0;
final userName = (user?.name != null) ? user?.name : "";
final isUserPatron = (userResource.value?.donationsCount ?? 0) > 0;
final userStatus = isUserPatron ? "Патрон" : "Бегач";
final userStatus = isUserPatron ? AppLocalizations.of(context)!.barcode_page_patron : AppLocalizations.of(context)!.barcode_page_runner;

final objectId = uuid.v4();
final pass = """
Expand Down Expand Up @@ -84,7 +85,7 @@ class BarcodePage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
leading: BackButton(color: Colors.white),
title: Text("Баркод"),
title: Text(AppLocalizations.of(context)!.barcode_page_barcode),
centerTitle: true,
),
backgroundColor: Colors.white,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:community_charts_flutter/community_charts_flutter.dart'
as charts;
import '../common/int_extensions.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class BestTimesByRouteChart extends StatelessWidget {
final List<charts.Series<dynamic, String>> seriesList;
Expand All @@ -27,7 +29,7 @@ class BestTimesByRouteChart extends StatelessWidget {
child: Column(
children: <Widget>[
IntrinsicHeight(
child: Text("Рекорди по същински трасета",
child: Text(AppLocalizations.of(context)!.best_time_by_route_chart_widget_records,
style: theme.textTheme.titleSmall)),
Expanded(
child: charts.BarChart(seriesList,
Expand Down
4 changes: 3 additions & 1 deletion fivekmrun_app_flutter/lib/charts/runs_by_route_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
import 'package:community_charts_flutter/community_charts_flutter.dart'
as charts;
import "package:collection/collection.dart";
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class RunsByRouteChart extends StatelessWidget {
final List<charts.Series<dynamic, String>> seriesList;
Expand All @@ -25,7 +27,7 @@ class RunsByRouteChart extends StatelessWidget {
padding: EdgeInsets.all(8.0),
child: Column(children: <Widget>[
IntrinsicHeight(
child: Text("Бягания по същински трасета", style: subTitleStyle)),
child: Text(AppLocalizations.of(context)!.runs_by_route_chart_title, style: subTitleStyle)),
Expanded(
child: new charts.PieChart<String>(seriesList,
animate: animate,
Expand Down
16 changes: 9 additions & 7 deletions fivekmrun_app_flutter/lib/charts/runs_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:community_charts_flutter/community_charts_flutter.dart'
as charts;
import 'package:intl/intl.dart';
import '../common/int_extensions.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class RunsChart extends StatefulWidget {
final List<Run> runs;
Expand Down Expand Up @@ -41,11 +42,12 @@ class _RunsChartState extends State<RunsChart> {
date = selectedDatum.first.datum.date;
time = selectedDatum.first.datum.time;

setState(() => this.dataPointLabel = "Дата: " +
DateFormat(Constants.DATE_FORMAT).format(date) +
"\nВреме: " +
time +
"");
setState(() => this.dataPointLabel =
AppLocalizations.of(context)!.runs_chart_date +
DateFormat(Constants.DATE_FORMAT).format(date) +
AppLocalizations.of(context)!.runs_chart_time +
time +
"");
print("model: time(" + date.toString() + "), value(" + time + ")");
}
}
Expand All @@ -56,9 +58,9 @@ class _RunsChartState extends State<RunsChart> {
children: <Widget>[
IntrinsicHeight(
child: Text(
"Тенденция от последните " +
AppLocalizations.of(context)!.runs_chart_trend +
this.widget.runs.length.toString() +
" бягания",
AppLocalizations.of(context)!.runs_chart_runs,
style: theme.textTheme.titleSmall)),
IntrinsicHeight(child: Text(this.dataPointLabel)),
Expanded(
Expand Down
38 changes: 38 additions & 0 deletions fivekmrun_app_flutter/lib/common/locale_switch.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:fivekmrun_flutter/state/locale_provider.dart';
import 'package:provider/provider.dart';

class LocaleSwitcherWidget extends StatelessWidget {
const LocaleSwitcherWidget({super.key});
@override
Widget build(BuildContext context) {
final provider = Provider.of<LocaleProvider>(context);
final locale = provider.locale;
return DropdownButtonHideUnderline(
child: DropdownButton(
padding: EdgeInsets.symmetric(horizontal: 10),
value: locale,
icon: Container(width: 12),
items: AppLocalizations.supportedLocales.map(
(nextLocale) {
return DropdownMenuItem(
value: nextLocale,
child: Center(
child: Text(nextLocale.toString().toUpperCase(),style: TextStyle(
color: nextLocale == locale ? Theme.of(context).colorScheme.secondary: Colors.grey,
),),

),
);
},
).toList(),
onChanged: (Locale? newLocale) {
if (newLocale != null) {
provider.setLocale(newLocale);
}
},
),
);
}
}
8 changes: 5 additions & 3 deletions fivekmrun_app_flutter/lib/common/results_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:fivekmrun_flutter/state/result_model.dart';
import 'package:flutter/material.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class ResultsList extends StatefulWidget {
final List<Result> results;
Expand Down Expand Up @@ -97,7 +99,7 @@ class _ResultsListState extends State<ResultsList> {
itemBuilder: resultTileBuilder,
)
: Center(
child: Text("Няма резултати"),
child: Text(AppLocalizations.of(context)!.results_list_no_results),
),
),
],
Expand Down Expand Up @@ -214,7 +216,7 @@ class _ResultsListState extends State<ResultsList> {
icon: (res.isPatreon)
? CustomIcons.hand_holding_heart
: Icons.person,
text: (!res.isAnonymous) ? res.name : "Анонимен",
text: (!res.isAnonymous) ? res.name : AppLocalizations.of(context)!.results_list_anonymous,
iconColor: iconColor,
),
if (res.isSelfie)
Expand Down Expand Up @@ -263,7 +265,7 @@ class SearchBox extends StatelessWidget {
child: TextField(
controller: controller,
decoration: new InputDecoration(
hintText: 'Търси по име или номер',
hintText: AppLocalizations.of(context)!.results_list_search_bar,
border: InputBorder.none),
),
),
Expand Down
8 changes: 5 additions & 3 deletions fivekmrun_app_flutter/lib/common/run_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:fivekmrun_flutter/home.dart';
import 'package:fivekmrun_flutter/state/run_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class RunCard extends StatelessWidget {
final Run run;
Expand Down Expand Up @@ -46,7 +48,7 @@ class RunCard extends StatelessWidget {
color: theme.colorScheme
.secondary), //HACK: hide the label if Selfie but bump the space
),
Text("място", style: labelStyle),
Text(AppLocalizations.of(context)!.run_card_widget_place, style: labelStyle),
],
),
),
Expand All @@ -73,11 +75,11 @@ class RunCard extends StatelessWidget {
overflow: TextOverflow.ellipsis),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(run.pace ?? "" + " мин/км",
child: Text(run.pace ?? "" + " ${AppLocalizations.of(context)!.min_km}",
style: valueStyle,
overflow: TextOverflow.ellipsis),
),
Text(run.time ?? "" + " мин",
Text(run.time ?? "" + " ${AppLocalizations.of(context)!.min}",
style: valueStyle,
overflow: TextOverflow.ellipsis),
],
Expand Down
33 changes: 20 additions & 13 deletions fivekmrun_app_flutter/lib/donate/donate_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:fivekmrun_flutter/custom_icons.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class DonatePage extends StatelessWidget {
const DonatePage({Key? key}) : super(key: key);
Expand All @@ -16,7 +17,8 @@ class DonatePage extends StatelessWidget {
));

return Scaffold(
appBar: AppBar(title: Text("Подкрепи ни")),
appBar:
AppBar(title: Text(AppLocalizations.of(context)!.donate_page_title)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
Expand All @@ -26,7 +28,7 @@ class DonatePage extends StatelessWidget {
child: Column(children: [
Center(
child: Text(
"Това приложение и цялата дейност на 5kmRun се издържа изцяло от дарения и доброволен труд. Можете да подкрепите нашите усилия, чрез някой от изброените по-долу начини.",
AppLocalizations.of(context)!.donate_page_description,
textAlign: TextAlign.center,
)),
Padding(
Expand All @@ -37,7 +39,8 @@ class DonatePage extends StatelessWidget {
child: ElevatedButton(
child: Row(
children: [
Text("Стани Патрон"),
Text(AppLocalizations.of(context)!
.donate_page_become_a_patron),
],
),
onPressed: () async {
Expand All @@ -52,7 +55,8 @@ class DonatePage extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Можете да направите годишно дарение на стойност 24лв., което ще ви отреди званието 'Патрон' за следващите 12 месеца. Сумата можете да дарите на място при същинските бягания или по банков път.",
AppLocalizations.of(context)!
.donate_page_patreon_description,
),
),
),
Expand All @@ -66,7 +70,8 @@ class DonatePage extends StatelessWidget {
child: Row(
children: [
Icon(CustomIcons.paypal, size: 16),
Text(" PayPal"),
Text(AppLocalizations.of(context)!
.donate_page_pay_pal),
],
),
onPressed: () async {
Expand All @@ -81,8 +86,8 @@ class DonatePage extends StatelessWidget {
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Можете да направите еднократно или регулярно дарение на сума по ваш избор."),
child: Text(AppLocalizations.of(context)!
.donate_page_pay_pal_description),
),
)
]),
Expand All @@ -95,7 +100,8 @@ class DonatePage extends StatelessWidget {
child: Row(
children: [
Icon(Icons.shopping_bag),
Text(" Фен магазин"),
Text(AppLocalizations.of(context)!
.donate_page_fan_store),
],
),
onPressed: () async {
Expand All @@ -110,8 +116,8 @@ class DonatePage extends StatelessWidget {
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Всяка покупка на артикул на нашия фен магазин подпомага дейностите на 5kmrun и ни помага да стигнем безплатно до хиляди хора в България."),
child: Text(AppLocalizations.of(context)!
.donate_page_fan_store_description),
),
)
],
Expand All @@ -125,7 +131,8 @@ class DonatePage extends StatelessWidget {
child: Row(
children: [
Icon(Icons.directions_run),
Text(" XL бягане"),
Text(AppLocalizations.of(context)!
.donate_page_xl_run),
],
),
onPressed: () async {
Expand All @@ -139,8 +146,8 @@ class DonatePage extends StatelessWidget {
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Всеки месец в района на София организираме предизвикателства в различни дължини, терени и натоварвания. Таксата за участие изцяло подпомага дейностите на 5kmrun."),
child: Text(AppLocalizations.of(context)!
.donate_page_xl_run_description),
),
)
],
Expand Down
4 changes: 3 additions & 1 deletion fivekmrun_app_flutter/lib/events/event_results_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:fivekmrun_flutter/state/event_model.dart';
import 'package:fivekmrun_flutter/state/result_model.dart';
import 'package:fivekmrun_flutter/state/results_resource.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class EventResultsPage extends StatefulWidget {
EventResultsPage({Key? key}) : super(key: key);
Expand All @@ -19,7 +21,7 @@ class _EventResultsPageState extends State<EventResultsPage> {
Event event = ModalRoute.of(context)?.settings.arguments as Event;

return Scaffold(
appBar: AppBar(title: Text("Резултати")),
appBar: AppBar(title: Text(AppLocalizations.of(context)!.events_results_page_results)),
body: FutureBuilder<List<Result>>(
future: results.getAll(event.id),
initialData: [],
Expand Down
Loading
Loading