From 3af301f7628976dbaa8f8bc47d7eaca9a7688db5 Mon Sep 17 00:00:00 2001 From: Arman Kolahan Date: Sat, 15 May 2021 16:30:09 +0200 Subject: [PATCH] persian version --- app/build.gradle | 4 ++ .../java/com/armanco/integral/MainActivity.kt | 11 +++- .../integral/extensions/Context_extensions.kt | 15 ++++++ .../armanco/integral/extensions/extensions.kt | 8 +++ app/src/main/res/values-ar/strings.xml | 2 +- app/src/main/res/values-bn/strings.xml | 2 +- app/src/main/res/values-da/strings.xml | 2 +- app/src/main/res/values-fa/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-hi/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-ko/strings.xml | 2 +- app/src/main/res/values-pt/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-tr/strings.xml | 2 +- app/src/main/res/values-ur/strings.xml | 2 +- app/src/main/res/values-zh/strings.xml | 2 +- fastlane/Fastfile | 50 ++++++++++++++++++- fastlane/report.xml | 12 +++-- 20 files changed, 107 insertions(+), 21 deletions(-) create mode 100644 app/src/main/java/com/armanco/integral/extensions/Context_extensions.kt diff --git a/app/build.gradle b/app/build.gradle index 06bc842..df2f8fe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -50,6 +50,10 @@ android { dimension 'default' applicationId "com.armanco.integral_pro" } + persian { + dimension 'default' + applicationId "com.armanco.integral_persian" + } } } diff --git a/app/src/main/java/com/armanco/integral/MainActivity.kt b/app/src/main/java/com/armanco/integral/MainActivity.kt index 36d2b1f..56e0905 100644 --- a/app/src/main/java/com/armanco/integral/MainActivity.kt +++ b/app/src/main/java/com/armanco/integral/MainActivity.kt @@ -3,15 +3,17 @@ package com.armanco.integral import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity -import androidx.navigation.findNavController import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.setupWithNavController +import com.armanco.integral.extensions.isPersian import com.armanco.integral.extensions.isPro +import com.armanco.integral.extensions.setLocale import com.google.android.gms.ads.AdRequest import com.google.android.gms.ads.MobileAds import dagger.hilt.android.AndroidEntryPoint import kotlinx.android.synthetic.main.activity_main.* +import java.util.* @AndroidEntryPoint class MainActivity: AppCompatActivity() { @@ -23,6 +25,13 @@ class MainActivity: AppCompatActivity() { initToolbar() } + override fun onResume() { + super.onResume() + if(isPersian) { + setLocale(Locale("fa")) + } + } + private fun initAdMob() { MobileAds.initialize(this) val adRequest = AdRequest.Builder().build() diff --git a/app/src/main/java/com/armanco/integral/extensions/Context_extensions.kt b/app/src/main/java/com/armanco/integral/extensions/Context_extensions.kt new file mode 100644 index 0000000..d4d869c --- /dev/null +++ b/app/src/main/java/com/armanco/integral/extensions/Context_extensions.kt @@ -0,0 +1,15 @@ +package com.armanco.integral.extensions + +import android.content.Context +import android.os.Build +import java.util.* + +fun Context.setLocale(locale: Locale) { + val configuration = resources.configuration + configuration.setLocale(locale) + Locale.setDefault(locale) + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { + createConfigurationContext(configuration) + } + resources.updateConfiguration(configuration, resources.displayMetrics) +} diff --git a/app/src/main/java/com/armanco/integral/extensions/extensions.kt b/app/src/main/java/com/armanco/integral/extensions/extensions.kt index 615f736..2fc2e2d 100644 --- a/app/src/main/java/com/armanco/integral/extensions/extensions.kt +++ b/app/src/main/java/com/armanco/integral/extensions/extensions.kt @@ -8,4 +8,12 @@ val isPro: Boolean "pro" -> true else -> false } +} + +val isPersian: Boolean + get() { + return when (BuildConfig.FLAVOR) { + "persian" -> true + else -> false + } } \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 425c902..4d3ed38 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1,6 +1,6 @@ - Integral + متكامل دور الحد الأدنى (a) الحد الأعلى (b) diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml index 247f9a6..b3ce868 100644 --- a/app/src/main/res/values-bn/strings.xml +++ b/app/src/main/res/values-bn/strings.xml @@ -1,6 +1,6 @@ - Integral + ইন্টিগ্রাল ফাংশন নিম্ন সীমা (a) উচ্চ সীমা (b) diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index f4047ae..3c2abc2 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -1,6 +1,6 @@ - Integral + Integreret Rationel Eksponentiel Logaritmer diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index 7aaa287..5b494cb 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -1,6 +1,6 @@ - Integral + انتگرال تابع حد پایین (a) حد بالا (b) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 448a539..912d861 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,6 +1,6 @@ - Integral + Intégral Rationnelles Exponentielles Logarithmes diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 391cd6a..97ea520 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -1,6 +1,6 @@ - Integral + अविभाज्य समारोह निचली सीमा (a) ऊपरी सीमा (b) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a9634d6..36ca767 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,6 +1,6 @@ - Integral + Integrante Razionali Esponenziali Logaritmi diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index cf08ab1..cbfb888 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1,6 +1,6 @@ - Integral + 積分 関数 下限(a) 上限(b) diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 5f1f7b6..d17f501 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1,6 +1,6 @@ - Integral + 완전한 함수 하한 (a) 상한선 (b) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 9586eb6..21eabba 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1,6 +1,6 @@ - Integral + Integrante Função Limite inferior (a) Limite Superior (b) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 8b6433e..2ceb452 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1,6 +1,6 @@ - Integral + интеграл Функция Нижний предел (а) Верхний предел (б) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index cbd4aea..82b16af 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1,6 +1,6 @@ - Integral + İntegral Fonksiyon Alt Sınır (a) Üst Limit (b) diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index 34aee31..34282d7 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -1,6 +1,6 @@ - Integral + لازمی عقلی گستاخانہ لوگرتھمز diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 4bb46ab..803ed0f 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -1,6 +1,6 @@ - Integral + 不可缺少的 功能 下限(a) 上限(b) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ac4ecfc..a05cd8c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -94,7 +94,7 @@ platform :android do ) end - desc "Submit a new Internal Test" + desc "Submit a new Internal Test (PRO)" lane :internal_pro do validate_play_store_json_key( json_key: ENV['JSON_PATH'] @@ -118,6 +118,54 @@ platform :android do ) end + desc "Deploy a new version to the Google Play (PERSIAN)" + lane :deploy_persian do + validate_play_store_json_key( + json_key: ENV['JSON_PATH'] + ) + gradle(task: "test") + gradle( + task: 'assemblePersianRelease', + properties: { + "android.injected.signing.store.file" => ENV['KEYSTORE_PATH'], + "android.injected.signing.store.password" => ENV['STORE_PASSWORD'], + "android.injected.signing.key.alias" => ENV['KEY_ALIAS'], + "android.injected.signing.key.password" => ENV['KEY_PASSWORD'], + } + ) + upload_to_play_store( + package_name: 'com.armanco.integral_persian', + track: 'production', + apk: ENV['APK_PATH_PERSIAN'], + json_key: ENV['JSON_PATH'], + skip_upload_aab: true + ) + end + + desc "Submit a new Internal Test (PERSIAN)" + lane :internal_persian do + validate_play_store_json_key( + json_key: ENV['JSON_PATH'] + ) + gradle(task: "test") + gradle( + task: 'assemblePersianRelease', + properties: { + "android.injected.signing.store.file" => ENV['KEYSTORE_PATH'], + "android.injected.signing.store.password" => ENV['STORE_PASSWORD'], + "android.injected.signing.key.alias" => ENV['KEY_ALIAS'], + "android.injected.signing.key.password" => ENV['KEY_PASSWORD'], + } + ) + upload_to_play_store( + package_name: 'com.armanco.integral_persian', + track: 'internal', + apk: ENV['APK_PATH_PERSIAN'], + json_key: ENV['JSON_PATH'], + skip_upload_aab: true + ) + end + desc "Build debug and test APK for screenshots" lane :screenshots do build_android_app( diff --git a/fastlane/report.xml b/fastlane/report.xml index 9b478a3..6f387b3 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,27 +5,29 @@ - + - + - + - + - + + +