Skip to content

Commit

Permalink
Merge pull request #86 from TowardsIkhlaas/feat/add-localization-support
Browse files Browse the repository at this point in the history
feat: Add localization support
  • Loading branch information
ahmd-sh authored Oct 21, 2024
2 parents 9812c94 + cfe5534 commit 57cf8eb
Show file tree
Hide file tree
Showing 23 changed files with 366 additions and 118 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="SimplyQibla"
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-ar/Strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">سمبلي قبلة</string>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-en/Strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SimplyQibla</string>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/Strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SimplyQibla</string>
</resources>
8 changes: 8 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
521A0D5B2C3F307300265CA2 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 521A0D5A2C3F307300265CA2 /* Settings.bundle */; };
5294FA062CC444CB00730463 /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 5294FA052CC444CB00730463 /* InfoPlist.xcstrings */; };
52A1E2772C1E09F9008A08A5 /* APIKey.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52A1E2762C1E09F9008A08A5 /* APIKey.plist */; };
52A1E2792C1E0A89008A08A5 /* KeyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A1E2782C1E0A89008A08A5 /* KeyManager.swift */; };
619C83D14998A15D22C40BD3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF50407A1118AFD38F7BDA3D /* Pods_Runner.framework */; };
Expand Down Expand Up @@ -55,6 +56,7 @@
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
46596C92FBD50067BAD4D22A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
521A0D5A2C3F307300265CA2 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
5294FA052CC444CB00730463 /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = "<group>"; };
52A1E2762C1E09F9008A08A5 /* APIKey.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = APIKey.plist; sourceTree = "<group>"; };
52A1E2782C1E0A89008A08A5 /* KeyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyManager.swift; sourceTree = "<group>"; };
52EA67D52C2C392E0046843C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
Expand Down Expand Up @@ -161,6 +163,7 @@
isa = PBXGroup;
children = (
52EA67D52C2C392E0046843C /* Runner.entitlements */,
5294FA052CC444CB00730463 /* InfoPlist.xcstrings */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -247,6 +250,7 @@
knownRegions = (
en,
Base,
ar,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand All @@ -272,6 +276,7 @@
buildActionMask = 2147483647;
files = (
52A1E2772C1E09F9008A08A5 /* APIKey.plist in Resources */,
5294FA062CC444CB00730463 /* InfoPlist.xcstrings in Resources */,
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -491,6 +496,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -628,6 +634,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -681,6 +688,7 @@
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand Down
5 changes: 5 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ar</string>
</array>
<key>CFBundleName</key>
<string>simply_qibla</string>
<key>CFBundlePackageType</key>
Expand Down
40 changes: 40 additions & 0 deletions ios/Runner/InfoPlist.xcstrings
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"sourceLanguage" : "en",
"strings" : {
"CFBundleDisplayName" : {
"extractionState" : "manual",
"localizations" : {
"ar" : {
"stringUnit" : {
"state" : "translated",
"value" : "سمبلي قبلة"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "SimplyQibla"
}
}
}
},
"NSLocationWhenInUseUsageDescription" : {
"extractionState" : "manual",
"localizations" : {
"ar" : {
"stringUnit" : {
"state" : "translated",
"value" : "يتم استخدام موقعك لتمركز الخريطة في منطقتك وتحديد اتجاه القبلة. بدلاً من ذلك، يمكنك تحريك الخريطة يدويًا أو إدخال إحداثيات محددة."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Your location is used to center the map to your area and determine the Qibla direction. Alternatively, you can manually move the map or enter specific coordinates."
}
}
}
}
},
"version" : "1.0"
}
3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
39 changes: 0 additions & 39 deletions lib/constants/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,6 @@ enum CenterConsoleState {
}

class AppStrings {
// Meta

static const String appNamePascalCase = 'SimplyQibla';
static const String appAboutLegalese = '© 2024 TowardsIkhlaas';

// App Text

static const String changeLocationBarText = 'Jump to a specific location? :)';
static const String centerConsoleCenteringText = 'Locating you...';
static const String centerConsoleDraggingText = 'Lift to show Qibla line';
static const String centerConsoleIdleText = 'km to the Kaaba';

// Errors and Warnings

static const String locationDisabled = 'Your location is off.';
static const String locationDeniedInitial =
'Please allow location permission to use this feature. We do not store or sell your data. :)';
static const String locationDeniedPermanent =
'Please allow location permission to use this feature.';

// User Experience

static const String thankYouText = 'JazakAllahu Khayran for using this app!';
static const String supportAppealText =
'This app costs to run and maintain (Google Maps API). Please consider supporting the project through the buttons below (excess amounts will be donated to registered charities).';
static const String githubButtonText = 'Support us on GitHub';
static const String donateButtonText = 'Support us on Ko-Fi';
static const String shareButtonText = 'Share with Friends';
static const String socialInstagramButtonText = 'Follow us on Instagram';
static const String onboardingUsageTitle = 'How does this work?';
static const String onboardingLocationTitle = 'Let the app find you.';
static const String onboardingSupportTitle = 'Support our mission!';
static const String onboardingUsageBody =
'Salaam! To use the app, hold your device flat and rotate it to align with nearby landmarks shown in the map, like streets and buildings around you.';
static const String onboardingLocationBody =
'Location permissions are needed for the app to function ideally, but not required. Rest assured, your data is neither collected nor sold.';
static const String onboardingSupportBody =
'SimplyQibla is ad-free and open-source. If you like what you see, please support us through the in-app links. Your support will be used to run the app, and excess will be donated to registered charities.';

// Links

static const String githubUriPath =
Expand Down
37 changes: 37 additions & 0 deletions lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"@@locale": "ar",
"appNamePascalCase": "سمبلي قبلة",
"appAboutLegalese": "© ٢٠٢٤ TowardsIkhlaas",
"changeLocationBarText": "الانتقال إلى موقع محدد؟ :)",
"latitudeFieldLabel": "(أرقام 0-9) خط العرض",
"longitudeFieldLabel": "(أرقام 0-9) خط الطول",
"skipText": "تخطي",
"doneText": "تم",
"okText": "حسنا",
"cancelText": "إلغاء",
"clearText": "مسح",
"allowText": "يسمح",
"turnOnText": "تشغيل",
"coordinatesInputFormTitle": "أدخل الإحداثيات",
"centerConsoleCenteringText": "جارٍ تحديد موقعك...",
"centerConsoleDraggingText": "ارفع لإظهار خط القبلة",
"centerConsoleIdleText": "كم إلى الكعبة",
"locationDisabled": "تم تعطيل الموقعك.",
"locationDeniedInitial": "يرجى السماح بإذن الموقع لاستخدام هذه الميزة. نحن لا نخزن أو نبيع بياناتك. :)",
"locationDeniedPermanent": "يرجى السماح بإذن الموقعك لاستخدام هذه الميزة.",
"latitudeErrorText": "قيمة خط العرض غير صالحة",
"longitudeErrorText": "قيمة خط الطول غير صالحة",
"thankYouText": "جزاك الله خيرًا لاستخدامك هذا التطبيق!",
"supportAppealText": "يتطلب تشغيل هذا التطبيق وصيانته (Google Maps API). يرجى النظر في دعم المشروع من خلال الأزرار أدناه (سيتم التبرع بالمبالغ الزائدة للجمعيات الخيرية المسجلة).",
"githubButtonText": "ادعمنا على GitHub",
"donateButtonText": "ادعمنا على Ko-Fi",
"socialInstagramButtonText": "تابعنا على Instagram",
"shareButtonText": "شارك مع الأصدقاء",
"shareContentText": "السلام عليكم ورحمة الله وبركاته! تحقق من هذا التطبيق الجميل والدقيق لتحديد القبلة",
"onboardingUsageTitle": "كيف يعمل هذا؟",
"onboardingLocationTitle": "دع التطبيق يجد موقعك.",
"onboardingSupportTitle": "ادعم مهمتنا!",
"onboardingUsageBody": "السلام عليكم! لاستخدام التطبيق، ضع جهازك بشكل مسطح وقم بتدويره ليصطف مع المعالم القريبة المعروضة في الخريطة، مثل الشوارع والمباني من حولك.",
"onboardingLocationBody": "تعد أذونات الموقع ضرورية لكي يعمل التطبيق بشكل مثالي، ولكنها ليست إلزامية. كن مطمئنًا، بياناتك لن يتم جمعها أو بيعها.",
"onboardingSupportBody": "سمبلي قبلة خالي من الإعلانات ومفتوح المصدر. إذا أعجبك ما تراه، يرجى دعمنا من خلال الروابط داخل التطبيق. سيتم استخدام دعمك لتشغيل التطبيق، وسيتم التبرع بالفائض للجمعيات الخيرية المسجلة."
}
139 changes: 139 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"@@locale": "en",
"appNamePascalCase": "SimplyQibla",
"@appNamePascalCase": {
"description": "Name of the app in PascalCase where supported."
},
"appAboutLegalese": "© 2024 TowardsIkhlaas",
"@appAboutLegalese": {
"description": "Legal text appearing in the About section of the app."
},
"changeLocationBarText": "Jump to a specific location? :)",
"@changeLocationBarText": {
"description": "Prompt asking the user if they want to navigate to a specific location."
},
"latitudeFieldLabel": "Latitude",
"@latitudeFieldLabel": {
"description": "Label for latitude input field."
},
"longitudeFieldLabel": "Longitude",
"@longitudeFieldLabel": {
"description": "Label for longitude input field."
},
"skipText": "Skip",
"@skipText": {
"description": "Text used as a button label, typically for skipping through something."
},
"doneText": "Done",
"@doneText": {
"description": "Text used as a button label, typically for finishing an action."
},
"okText": "OK",
"@okText": {
"description": "Text used as a button label, typically for confirming an action."
},
"cancelText": "Cancel",
"@cancelText": {
"description": "Text used as a button label, typically for canceling an action."
},
"clearText": "Clear",
"@clearText": {
"description": "Text used as a button label, typically for clearing a field."
},
"allowText": "ALLOW",
"@allowText": {
"description": "Text used as a button label, typically within a snackbar for allowing a permission."
},
"turnOnText": "TURN ON",
"@turnOnText": {
"description": "Text used as a button label, typically within a snackbar for turning on a service."
},
"coordinatesInputFormTitle": "Enter Coordinates",
"@coordinatesInputFormTitle": {
"description": "Text shown as the title of coordinates input form."
},
"centerConsoleCenteringText": "Locating you...",
"@centerConsoleCenteringText": {
"description": "Message displayed while the app is determining the user's current location."
},
"centerConsoleDraggingText": "Lift to show Qibla line",
"@centerConsoleDraggingText": {
"description": "Text indicating that the user should lift their finger to reveal the Qibla direction line."
},
"centerConsoleIdleText": "km to the Kaaba",
"@centerConsoleIdleText": {
"description": "Text displayed in idle state, showing the distance from the user's location to the Kaaba."
},
"locationDisabled": "Your location is off.",
"@locationDisabled": {
"description": "Warning message indicating that the user's location services are disabled."
},
"locationDeniedInitial": "Please allow location permission to use this feature. We do not store or sell your data. :)",
"@locationDeniedInitial": {
"description": "Message asking the user to allow location permission, with a privacy reassurance statement."
},
"locationDeniedPermanent": "Please allow location permission to use this feature.",
"@locationDeniedPermanent": {
"description": "Message requesting the user to allow location permission after they have previously denied it permanently."
},
"latitudeErrorText": "Invalid latitude value",
"@latitudeErrorText": {
"description": "Error message shown when inputting an invalid latitude."
},
"longitudeErrorText": "Invalid longitude value",
"@longitudeErrorText": {
"description": "Error message shown when inputting an invalid longitude."
},
"thankYouText": "JazakAllahu Khayran for using this app!",
"@thankYouText": {
"description": "Gratitude message shown to users, thanking them for using the app."
},
"supportAppealText": "This app costs to run and maintain (Google Maps API). Please consider supporting the project through the buttons below (excess amounts will be donated to registered charities).",
"@supportAppealText": {
"description": "Appeal asking users to support the app through donations, mentioning that excess funds will be donated to charity."
},
"githubButtonText": "Support us on GitHub",
"@githubButtonText": {
"description": "Button text that directs users to GitHub to support the project."
},
"donateButtonText": "Support us on Ko-Fi",
"@donateButtonText": {
"description": "Button text that directs users to Ko-Fi to support the project."
},
"socialInstagramButtonText": "Follow us on Instagram",
"@socialInstagramButtonText": {
"description": "Button text encouraging users to follow the project on Instagram."
},
"shareButtonText": "Share with Friends",
"@shareButtonText": {
"description": "Button text allowing users to share the app with friends."
},
"shareContentText": "As salaam alaykum warahmatullahi wabarakatuh! Check out this beautiful and accurate Qibla app",
"@shareContentText": {
"description": "Text content used when users share the app with others."
},
"onboardingUsageTitle": "How does this work?",
"@onboardingUsageTitle": {
"description": "Title for the onboarding section explaining how to use the app."
},
"onboardingLocationTitle": "Let the app find you.",
"@onboardingLocationTitle": {
"description": "Title for the onboarding section that explains the need for location permissions."
},
"onboardingSupportTitle": "Support our mission!",
"@onboardingSupportTitle": {
"description": "Title for the onboarding section that encourages users to support the project."
},
"onboardingUsageBody": "Salaam! To use the app, hold your device flat and rotate it to align with nearby landmarks shown in the map, like streets and buildings around you.",
"@onboardingUsageBody": {
"description": "Body text explaining to the user how to operate the app by aligning with landmarks on the map."
},
"onboardingLocationBody": "Location permissions are needed for the app to function ideally, but not required. Rest assured, your data is neither collected nor sold.",
"@onboardingLocationBody": {
"description": "Body text explaining why location permissions are requested and reassuring users about data privacy."
},
"onboardingSupportBody": "SimplyQibla is ad-free and open-source. If you like what you see, please support us through the in-app links. Your support will be used to run the app, and excess will be donated to registered charities.",
"@onboardingSupportBody": {
"description": "Body text encouraging users to support the project and explaining how donations will be used."
}
}
Loading

0 comments on commit 57cf8eb

Please sign in to comment.