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

Reference strings from i18n folder #57

Merged
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
32 changes: 32 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ if (keystorePropertiesFile.exists()) {
android {
compileSdk 34



defaultConfig {
applicationId "be.scri"
minSdk 23
Expand Down Expand Up @@ -93,3 +95,33 @@ dependencies {
kapt 'com.github.bumptech.glide:compiler:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}


task moveFromi18n {
def locales = ['de','es','sv','en-US']

locales.each { locale ->
def fromDir = "src/main/assets/i18n/Scribe-i18n/values/${locale}/"
def toDir = locale == 'en-US' ? "src/main/res/values/" : "src/main/res/values-${locale}/"
def sourceDir = file(fromDir)

if (sourceDir.exists()) {
println "Preparing to move from $fromDir to $toDir"
doLast {
copy {
from fileTree(dir: fromDir)
into toDir
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
} else {
println "Source directory does not exist: $fromDir"
}
}
}

tasks.named('preBuild').configure {
dependsOn tasks.named('moveFromi18n')
}


9 changes: 5 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
android:label="@string/app_launcher_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:localeConfig="@xml/locales_config">

<activity
android:name=".activities.SplashActivity"
Expand Down Expand Up @@ -132,7 +133,7 @@
<activity
android:name=".activities.SettingsActivity"
android:exported="true"
android:label="@string/settings"
android:label="@string/app.settings.title"
android:parentActivityName=".activities.MainActivity">

<intent-filter>
Expand All @@ -147,11 +148,11 @@

<activity
android:name="be.scri.activities.AboutActivity"
android:label="@string/about"
android:label="@string/app.about.title"
android:parentActivityName=".activities.MainActivity" />
<activity
android:name="be.scri.activities.WikimediaScribeActivity"
android:label="@string/wikimedia_and_scribe"
android:label="@string/app.about.wikimedia"
android:parentActivityName=".activities.MainActivity" />

<activity-alias
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/kotlin/be/scri/activities/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,47 +87,47 @@ class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{
val data = ArrayList<ItemsViewModel>()
data.add(ItemsViewModel(
image = R.drawable.github_logo,
"Get the code on GitHub",
R.string.app_about_github,
image2 = R.drawable.external_link,
url = "https://github.com/scribe-org/Scribe-Android",
activity = null,
action = null
))
data.add(ItemsViewModel(
image = R.drawable.matrix_icon,
"Chat with the team on Matrix",
R.string.app_about_matrix,
image2 = R.drawable.external_link,
url = "https://matrix.to/%23/%23scribe_community:matrix.org",
activity = null,
action = null
))
data.add(ItemsViewModel(
image = R.drawable.mastodon_svg_icon,
"Follow us on Mastodon",
R.string.app_about_mastodon,
image2 = R.drawable.external_link,
url = "https://wikis.world/@scribe",
activity = null,
action = null
))
data.add(ItemsViewModel(
image = R.drawable.share_icon,
"Share Scribe",
R.string.app_about_share,
image2 = R.drawable.external_link,
url = null,
activity = null,
action = ::shareScribe
))
data.add(ItemsViewModel(
image = R.drawable.scribe_icon,
"View all Scribe Apps",
R.string.app_about_scribe,
image2 = R.drawable.external_link,
url = null,
activity = null,
action = null
))
data.add(ItemsViewModel(
image = R.drawable.wikimedia_logo_black,
"Wikimedia and Scribe",
R.string.app_about_wikimedia,
image2 = R.drawable.right_arrow,
url = null,
activity = WikimediaScribeActivity::class.java,
Expand All @@ -142,39 +142,39 @@ class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{
val data2 = ArrayList<ItemsViewModel>()
data2.add(ItemsViewModel(
image = R.drawable.star,
"Rate Scribe",
R.string.app_about_rate,
image2 = R.drawable.external_link,
url = null,
activity = null,
action = null
))
data2.add(ItemsViewModel(
image = R.drawable.bug_report_icon,
"Report a bug",
R.string.app_about_bugReport,
image2 = R.drawable.external_link,
url = "https://github.com/scribe-org/Scribe-Android/issues",
activity = null,
action = null
))
data2.add(ItemsViewModel(
image = R.drawable.mail_icon,
"Send us an email",
R.string.app_about_email,
image2 = R.drawable.external_link,
url = null,
activity = null,
action = ::sendEmail
))
data2.add(ItemsViewModel(
image = R.drawable.bookmark_icon,
"Version x.x.x",
R.string.app_version,
image2 = R.drawable.right_arrow,
url = null,
activity = null,
action = null
))
data2.add(ItemsViewModel(
image = R.drawable.light_bulb_icon,
"Reset App hints",
R.string.app_about_appHints,
image2 = R.drawable.counter_clockwise_icon,
url = null,
activity = null,
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/kotlin/be/scri/helpers/CustomAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.core.content.ContextCompat.getString
import androidx.recyclerview.widget.RecyclerView
import be.scri.R
import be.scri.models.ItemsViewModel
Expand All @@ -28,7 +29,7 @@ class CustomAdapter(private val mList: List<ItemsViewModel> , private val contex
val itemViewModel = mList[position]
holder.imageView.setImageResource(itemViewModel.image)

holder.textView.text = itemViewModel.text
holder.textView.text = getString(context,itemViewModel.textResId)
holder.imageView2.setImageResource(itemViewModel.image2)
if (position == 0) {
holder.itemView.setBackgroundResource(R.drawable.rounded_top);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/be/scri/models/ItemsViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import android.app.Activity
import kotlin.reflect.KFunction0


data class ItemsViewModel(val image: Int, val text: String, val image2:Int, val url: String? = null, val activity: Class<out Activity>? = null, val action: KFunction0<Unit>? = null)
data class ItemsViewModel(val image: Int, val textResId: Int, val image2:Int, val url: String? = null, val activity: Class<out Activity>? = null, val action: KFunction0<Unit>? = null)
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/community_title"
android:text="@string/app.about.community"
android:textColor="@color/text_color"
android:textSize="20sp"
android:textStyle="bold" />
Expand All @@ -49,7 +49,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:text="@string/feedback_and_support"
android:text="@string/app.about.feedback"
android:textColor="@color/text_color"
android:textSize="20sp"
android:textStyle="bold" />
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/res/layout/activity_wikimedia_scribe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
<View
android:layout_width="match_parent"
android:layout_height="40dp" />

<TextView
android:id="@+id/textView"
android:layout_width="303dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="56dp"
android:text="@string/app.about.wikimedia.caption"
android:layout_marginEnd="16dp"
android:text="@string/wikimedia_and_scribe_title"
android:textColor="@color/app_text_color"
android:textSize="20sp"
android:textStyle="bold" />
Expand Down Expand Up @@ -63,10 +64,10 @@
android:padding="16dp">

<TextView
android:layout_width="321dp"
android:layout_height="136dp"
android:layout_width="304dp"
android:layout_height="146dp"
android:layout_gravity=""
android:text="@string/scribe_wikimedia"
android:text="@string/app.about.wikimedia.text1"
android:textSize="16sp" />

<ImageView
Expand All @@ -80,7 +81,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wikidata_and_scribe"
android:text="@string/app.about.wikimedia.text2"
android:textSize="16sp" />

<ImageView
Expand All @@ -93,7 +94,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wikipedia_and_scribe"
android:text="@string/app.about.wikimedia.text3"
android:textSize="16sp" />

</LinearLayout>
Expand All @@ -103,7 +104,7 @@
android:layout_height="76dp"
android:layout_gravity="top|end"
android:alpha="0.9"
android:contentDescription="@string/wikimedia_logo"
android:contentDescription="@string/app.about.wikimedia"
android:src="@drawable/corner_polygon" />

<ImageView
Expand All @@ -112,7 +113,7 @@
android:layout_gravity="top|end"
android:layout_margin="8dp"

android:contentDescription="@string/wikimedia_logo"
android:contentDescription="@string/app.about.wikimedia"
android:src="@drawable/wikimedia_logo_black" />
</androidx.cardview.widget.CardView>
</FrameLayout>
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout/card_view_design.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Get the code on GitHub"
android:textSize="16sp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="15sp"
android:autoSizeMaxTextSize="24sp"
android:autoSizeStepGranularity="2sp"
android:textStyle="normal" />

<ImageView
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/menu/menu_navigation_bottom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/installation"
android:title="Installation"
android:title="@string/app.install"
android:icon="@drawable/material_keyboard"/>
<item
android:id="@+id/settings"
android:title="Settings"
android:title="@string/app.settings.title"
android:icon="@drawable/material_settings"/>

<item
android:id="@+id/info"
android:title="About"
android:title="@string/app.about.title"
android:icon="@drawable/material_info"/>

</menu>
Loading
Loading