~repos /only-bible-app
git clone https://pyrossh.dev/repos/only-bible-app.git
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
2ce332ce
—
pyrossh 2 years ago
improve localizations
- lib/l10n/app_en.arb +13 -0
- lib/l10n/app_hi.arb +15 -2
- lib/l10n/app_kn.arb +13 -0
- lib/providers/app_model.dart +5 -1
- lib/screens/bible_select_screen.dart +4 -2
- lib/screens/book_select_screen.dart +4 -2
- lib/utils.dart +5 -0
- lib/widgets/settings_sheet.dart +18 -19
lib/l10n/app_en.arb
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"languageTitle": "English",
|
|
3
|
+
"localeLanguageTitle": "English",
|
|
4
|
+
"oldTestamentTitle": "Old Testament",
|
|
5
|
+
"newTestamentTitle": "New Testament",
|
|
6
|
+
"bibleSelectTitle": "Please select a bible",
|
|
3
7
|
"settingsTitle": "Settings",
|
|
4
8
|
"bibleTitle": "Bible",
|
|
9
|
+
"themeTitle": "Theme",
|
|
10
|
+
"incrementFontTitle": "Increase font size",
|
|
11
|
+
"decrementFontTitle": "Decrease font size",
|
|
12
|
+
"boldFontTitle": "Bold font",
|
|
13
|
+
"engTitles": "Use English Titles",
|
|
14
|
+
"privacyPolicyTitle": "Privacy Policy",
|
|
15
|
+
"shareAppTitle": "Share the app",
|
|
16
|
+
"rateAppTitle": "Rate the app",
|
|
17
|
+
"aboutUsTitle": "About us",
|
|
5
18
|
"genesis": "Genesis",
|
|
6
19
|
"exodus": "Exodus",
|
|
7
20
|
"leviticus": "Leviticus",
|
lib/l10n/app_hi.arb
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"languageTitle": "Hindi",
|
|
3
|
+
"localeLanguageTitle": "हिंदी",
|
|
4
|
+
"oldTestamentTitle": "पुराना नियम",
|
|
5
|
+
"newTestamentTitle": "नया नियम",
|
|
6
|
+
"bibleSelectTitle": "कृपया एक बाइबिल चुनें",
|
|
3
|
-
"settingsTitle": "
|
|
7
|
+
"settingsTitle": "समायोजन",
|
|
4
|
-
"bibleTitle": "
|
|
8
|
+
"bibleTitle": "बाइबिल",
|
|
9
|
+
"themeTitle": "रंग",
|
|
10
|
+
"incrementFontTitle": "पढ़ने का माप बढ़ाएँ",
|
|
11
|
+
"decrementFontTitle": "पढ़ने का माप कम करें",
|
|
12
|
+
"boldFontTitle": "बोल्ड साइज़",
|
|
13
|
+
"engTitles": "अंग्रेजी शीर्षकों का प्रयोग करें",
|
|
14
|
+
"privacyPolicyTitle": "गोपनीयता नीति",
|
|
15
|
+
"shareAppTitle": "ऐप साझा करें",
|
|
16
|
+
"rateAppTitle": "एप्लिकेशन की श्रेणी बताओ",
|
|
17
|
+
"aboutUsTitle": "हमारे बारे में",
|
|
5
18
|
"genesis": "उत्पत्ति",
|
|
6
19
|
"exodus": "निर्गमन",
|
|
7
20
|
"leviticus": "लैव्यवस्था",
|
lib/l10n/app_kn.arb
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"languageTitle": "Kannada",
|
|
3
|
+
"localeLanguageTitle": "ಕನ್ನಡ",
|
|
4
|
+
"oldTestamentTitle": "ಹಳೆಯ ಒಡಂಬಡಿಕೆ",
|
|
5
|
+
"newTestamentTitle": "ಹೊಸ ಒಡಂಬಡಿಕೆಯು",
|
|
6
|
+
"bibleSelectTitle": "ದಯವಿಟ್ಟು ಬೈಬಲ್ ಆಯ್ಕೆಮಾಡಿ",
|
|
3
7
|
"settingsTitle": "ಸಂಯೋಜನೆಗಳು",
|
|
4
8
|
"bibleTitle": "ಬೈಬಲ್",
|
|
9
|
+
"themeTitle": "ಬಣ್ಣಗಳು",
|
|
10
|
+
"incrementFontTitle": "ಪಠ್ಯದ ಗಾತ್ರವನ್ನು ಹೆಚ್ಚಿಸಿ",
|
|
11
|
+
"decrementFontTitle": "ಪಠ್ಯದ ಗಾತ್ರವನ್ನು ಕಡಿಮೆ ಮಾಡಿ",
|
|
12
|
+
"boldFontTitle": "ದಪ್ಪ ಪಠ್ಯ",
|
|
13
|
+
"engTitles": "ಇಂಗ್ಲಿಷ್ ಶೀರ್ಷಿಕೆಗಳನ್ನು ಬಳಸಿ",
|
|
14
|
+
"privacyPolicyTitle": "ಗೌಪ್ಯತಾ ನೀತಿ",
|
|
15
|
+
"shareAppTitle": "ಅಪ್ಲಿಕೇಶನ್ ಹಂಚಿಕೊಳ್ಳಿ",
|
|
16
|
+
"rateAppTitle": "ಅಪ್ಲಿಕೇಶನ್ ಅನ್ನು ರೇಟ್ ಮಾಡಿ",
|
|
17
|
+
"aboutUsTitle": "ನಮ್ಮ ಬಗ್ಗೆ",
|
|
5
18
|
"genesis": "ಆದಿಕಾಂಡ",
|
|
6
19
|
"exodus": "ವಿಮೋಚನಕಾಂಡ",
|
|
7
20
|
"leviticus": "ಯಾಜಕಕಾಂಡ",
|
lib/providers/app_model.dart
CHANGED
|
@@ -47,6 +47,10 @@ class AppModel extends ChangeNotifier {
|
|
|
47
47
|
return Provider.of(context, listen: false);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
static AppLocalizations getLocalizations(BuildContext context) {
|
|
51
|
+
return AppModel.of(context).engTitles ? lookupAppLocalizations(const Locale("en")) : AppLocalizations.of(context)!;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
save() async {
|
|
51
55
|
final prefs = await SharedPreferences.getInstance();
|
|
52
56
|
await prefs.setString("bibleName", bible.name);
|
|
@@ -89,7 +93,7 @@ class AppModel extends ChangeNotifier {
|
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
List<String> getBookNames(BuildContext context) {
|
|
92
|
-
final l =
|
|
96
|
+
final l = getLocalizations(context);
|
|
93
97
|
return [
|
|
94
98
|
l.genesis,
|
|
95
99
|
l.exodus,
|
lib/screens/bible_select_screen.dart
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "package:flutter/material.dart";
|
|
2
2
|
import "package:flutter_gen/gen_l10n/app_localizations.dart";
|
|
3
3
|
import "package:only_bible_app/providers/app_model.dart";
|
|
4
|
+
import "package:only_bible_app/utils.dart";
|
|
4
5
|
import "package:only_bible_app/widgets/scaffold_menu.dart";
|
|
5
6
|
import "package:only_bible_app/widgets/sliver_heading.dart";
|
|
6
7
|
import "package:only_bible_app/widgets/sliver_tile_grid.dart";
|
|
@@ -10,15 +11,16 @@ class BibleSelectScreen extends StatelessWidget {
|
|
|
10
11
|
|
|
11
12
|
@override
|
|
12
13
|
Widget build(BuildContext context) {
|
|
14
|
+
final locales = AppLocalizations.supportedLocales.sortedBy((e) => e.languageCode);
|
|
13
15
|
return ScaffoldMenu(
|
|
14
16
|
child: CustomScrollView(
|
|
15
17
|
physics: const BouncingScrollPhysics(),
|
|
16
18
|
slivers: [
|
|
17
|
-
|
|
19
|
+
SliverHeading(title: AppLocalizations.of(context)!.bibleSelectTitle, showClose: true),
|
|
18
20
|
SliverTileGrid(
|
|
19
21
|
listType: ListType.large,
|
|
20
22
|
children: List.of(
|
|
21
|
-
|
|
23
|
+
locales.map((l) {
|
|
22
24
|
return Localizations.override(
|
|
23
25
|
context: context,
|
|
24
26
|
locale: Locale(l.languageCode),
|
lib/screens/book_select_screen.dart
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "package:flutter/material.dart";
|
|
2
|
+
import "package:only_bible_app/providers/app_model.dart";
|
|
2
3
|
import "package:only_bible_app/widgets/scaffold_menu.dart";
|
|
3
4
|
import "package:only_bible_app/screens/chapter_select_screen.dart";
|
|
4
5
|
import "package:only_bible_app/widgets/sliver_heading.dart";
|
|
@@ -26,11 +27,12 @@ class BookSelectScreen extends StatelessWidget {
|
|
|
26
27
|
|
|
27
28
|
@override
|
|
28
29
|
Widget build(BuildContext context) {
|
|
30
|
+
final localizations = AppModel.getLocalizations(context);
|
|
29
31
|
return ScaffoldMenu(
|
|
30
32
|
child: CustomScrollView(
|
|
31
33
|
physics: const BouncingScrollPhysics(),
|
|
32
34
|
slivers: [
|
|
33
|
-
|
|
35
|
+
SliverHeading(title: localizations.oldTestamentTitle, showClose: true),
|
|
34
36
|
SliverTileGrid(
|
|
35
37
|
children: List.of(
|
|
36
38
|
bible.getOldBooks().map((book) {
|
|
@@ -41,7 +43,7 @@ class BookSelectScreen extends StatelessWidget {
|
|
|
41
43
|
}),
|
|
42
44
|
),
|
|
43
45
|
),
|
|
44
|
-
|
|
46
|
+
SliverHeading(title: localizations.newTestamentTitle, top: 30, bottom: 20),
|
|
45
47
|
SliverTileGrid(
|
|
46
48
|
children: List.of(
|
|
47
49
|
bible.getNewBooks().map((book) {
|
lib/utils.dart
CHANGED
|
@@ -6,6 +6,11 @@ import "package:flutter/material.dart";
|
|
|
6
6
|
import "package:flutter/services.dart";
|
|
7
7
|
import "package:only_bible_app/models.dart";
|
|
8
8
|
|
|
9
|
+
extension MyIterable<E> on Iterable<E> {
|
|
10
|
+
Iterable<E> sortedBy(Comparable Function(E e) key) =>
|
|
11
|
+
toList()..sort((a, b) => key(a).compareTo(key(b)));
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
bool isDesktop() {
|
|
10
15
|
return defaultTargetPlatform == TargetPlatform.macOS ||
|
|
11
16
|
defaultTargetPlatform == TargetPlatform.windows ||
|
lib/widgets/settings_sheet.dart
CHANGED
|
@@ -2,7 +2,6 @@ import "package:flutter/material.dart";
|
|
|
2
2
|
import "package:only_bible_app/providers/app_model.dart";
|
|
3
3
|
import "package:only_bible_app/utils.dart";
|
|
4
4
|
import "package:settings_ui/settings_ui.dart";
|
|
5
|
-
import "package:flutter_gen/gen_l10n/app_localizations.dart";
|
|
6
5
|
|
|
7
6
|
class SettingsSheet extends StatelessWidget {
|
|
8
7
|
const SettingsSheet({super.key});
|
|
@@ -10,7 +9,7 @@ class SettingsSheet extends StatelessWidget {
|
|
|
10
9
|
@override
|
|
11
10
|
Widget build(BuildContext context) {
|
|
12
11
|
final app = AppModel.of(context);
|
|
13
|
-
final localizations =
|
|
12
|
+
final localizations = AppModel.getLocalizations(context);
|
|
14
13
|
final iconColor = Theme.of(context).textTheme.bodyMedium!.color;
|
|
15
14
|
return SettingsList(
|
|
16
15
|
contentPadding: EdgeInsets.zero,
|
|
@@ -28,13 +27,13 @@ class SettingsSheet extends StatelessWidget {
|
|
|
28
27
|
tiles: [
|
|
29
28
|
SettingsTile.navigation(
|
|
30
29
|
leading: const Icon(Icons.book_outlined, color: Colors.blueAccent),
|
|
31
|
-
title:
|
|
30
|
+
title: Text(localizations.bibleTitle),
|
|
32
31
|
value: Text(app.bible.name),
|
|
33
32
|
onPressed: app.changeBible,
|
|
34
33
|
),
|
|
35
34
|
SettingsTile.navigation(
|
|
36
35
|
leading: const Icon(Icons.color_lens_outlined, color: Colors.pink),
|
|
37
|
-
title:
|
|
36
|
+
title: Text(localizations.themeTitle),
|
|
38
37
|
trailing: ToggleButtons(
|
|
39
38
|
onPressed: (int index) {
|
|
40
39
|
app.toggleDarkMode();
|
|
@@ -57,16 +56,8 @@ class SettingsSheet extends StatelessWidget {
|
|
|
57
56
|
],
|
|
58
57
|
),
|
|
59
58
|
),
|
|
60
|
-
SettingsTile.switchTile(
|
|
61
|
-
onToggle: (value) {
|
|
62
|
-
app.toggleBold();
|
|
63
|
-
},
|
|
64
|
-
initialValue: app.fontBold,
|
|
65
|
-
leading: Icon(Icons.format_bold, color: iconColor),
|
|
66
|
-
title: const Text("Font Bold"),
|
|
67
|
-
),
|
|
68
59
|
SettingsTile(
|
|
69
|
-
title:
|
|
60
|
+
title: Text(localizations.incrementFontTitle),
|
|
70
61
|
leading: Icon(Icons.font_download, color: iconColor),
|
|
71
62
|
trailing: IconButton(
|
|
72
63
|
onPressed: app.increaseFont,
|
|
@@ -74,20 +65,28 @@ class SettingsSheet extends StatelessWidget {
|
|
|
74
65
|
),
|
|
75
66
|
),
|
|
76
67
|
SettingsTile(
|
|
77
|
-
title:
|
|
68
|
+
title: Text(localizations.decrementFontTitle),
|
|
78
69
|
leading: Icon(Icons.font_download, color: iconColor),
|
|
79
70
|
trailing: IconButton(
|
|
80
71
|
onPressed: app.decreaseFont,
|
|
81
72
|
icon: const Icon(Icons.remove_circle_outline, size: 32, color: Colors.blueAccent),
|
|
82
73
|
),
|
|
83
74
|
),
|
|
75
|
+
SettingsTile.switchTile(
|
|
76
|
+
onToggle: (value) {
|
|
77
|
+
app.toggleBold();
|
|
78
|
+
},
|
|
79
|
+
initialValue: app.fontBold,
|
|
80
|
+
leading: Icon(Icons.format_bold, color: iconColor),
|
|
81
|
+
title: Text(localizations.boldFontTitle),
|
|
82
|
+
),
|
|
84
83
|
SettingsTile.switchTile(
|
|
85
84
|
onToggle: (value) {
|
|
86
85
|
app.toggleEngBookNames();
|
|
87
86
|
},
|
|
88
87
|
initialValue: app.engTitles,
|
|
89
88
|
leading: Icon(Icons.abc, color: iconColor),
|
|
90
|
-
title:
|
|
89
|
+
title: Text(localizations.engTitles),
|
|
91
90
|
),
|
|
92
91
|
],
|
|
93
92
|
),
|
|
@@ -97,23 +96,23 @@ class SettingsSheet extends StatelessWidget {
|
|
|
97
96
|
tiles: [
|
|
98
97
|
SettingsTile.navigation(
|
|
99
98
|
leading: const Icon(Icons.policy_outlined, color: Colors.brown),
|
|
100
|
-
title:
|
|
99
|
+
title: Text(localizations.privacyPolicyTitle),
|
|
101
100
|
onPressed: app.showPrivacyPolicy,
|
|
102
101
|
),
|
|
103
102
|
SettingsTile.navigation(
|
|
104
103
|
leading: const Icon(Icons.share_outlined, color: Colors.blueAccent),
|
|
105
|
-
title:
|
|
104
|
+
title: Text(localizations.shareAppTitle),
|
|
106
105
|
onPressed: app.shareAppLink,
|
|
107
106
|
),
|
|
108
107
|
if (!isDesktop()) // TODO: mabe support OSx if we release in that store
|
|
109
108
|
SettingsTile.navigation(
|
|
110
109
|
leading: Icon(Icons.star, color: Colors.yellowAccent.shade700),
|
|
111
|
-
title:
|
|
110
|
+
title: Text(localizations.rateAppTitle),
|
|
112
111
|
onPressed: app.rateApp,
|
|
113
112
|
),
|
|
114
113
|
SettingsTile.navigation(
|
|
115
114
|
leading: Icon(Icons.info_outline, color: Theme.of(context).colorScheme.onBackground),
|
|
116
|
-
title:
|
|
115
|
+
title: Text(localizations.aboutUsTitle),
|
|
117
116
|
onPressed: app.showAboutUs,
|
|
118
117
|
),
|
|
119
118
|
],
|