Skip to content

Commit

Permalink
Rename contributor to translator
Browse files Browse the repository at this point in the history
Signed-off-by: DrDisagree <[email protected]>
  • Loading branch information
Mahmud0808 committed Nov 13, 2024
1 parent 3aa82b3 commit 3b18adb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/crowdin_download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Generate contributors table
id: "contributors"
- name: Generate translators table
id: "translators"
uses: andrii-bodnar/action-crowdin-contributors@v2
with:
contributors_per_line: 6
max_contributors: 500
image_size: 32
min_words_contributed: 1
files: ./docs/contributors.md
files: ./docs/translators.md
crowdin_project_link: 'https://crowdin.com/project/iconify'
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

- name: Save contributors in assets
- name: Save translators in assets
run:
printf '%s\n' '${{ steps.contributors.outputs.json_report }}' > ./app/src/main/assets/Misc/contributors.json
printf '%s\n' '${{ steps.translators.outputs.json_report }}' > ./app/src/main/assets/Misc/translators.json

- name: Download translations
uses: crowdin/github-action@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ You can help translate Iconify [on Crowdin](https://crowdin.com/project/iconify)
- [AOSPMods](https://github.com/siavash79/AOSPMods), [@siavash79](https://t.me/siavash7999) for helping me with Xposed mods.
- [@Sanely_insane](https://t.me/sanely_insane), [@Jaguar](https://t.me/Jaguar0066) for support and motivation.
- [HideNavBar](https://github.com/Magisk-Modules-Repo/HideNavBar) for the navbar tweaks.
- And everyone who [contributed](https://github.com/Mahmud0808/Iconify/graphs/contributors) and [translated](https://github.com/Mahmud0808/Iconify/blob/beta/docs/contributors.md)... :)
- And everyone who [contributed](https://github.com/Mahmud0808/Iconify/graphs/contributors) and [translated](https://github.com/Mahmud0808/Iconify/blob/beta/docs/translators.md)... :)

# 📝 Disclaimer

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.drdisagree.iconify.ui.adapters.InfoAdapter
import com.drdisagree.iconify.ui.base.BaseFragment
import com.drdisagree.iconify.ui.models.InfoModel
import com.drdisagree.iconify.ui.utils.ViewHelper.setHeader
import com.drdisagree.iconify.utils.parseContributors
import com.drdisagree.iconify.utils.parseTranslators

class Credits : BaseFragment() {

Expand Down Expand Up @@ -277,7 +277,7 @@ class Credits : BaseFragment() {
private fun initTranslatorsList(): InfoAdapter {
return InfoAdapter(
requireContext(),
parseContributors().also {
parseTranslators().also {
it.add(0, InfoModel(resources.getString(R.string.section_title_translators)))
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.drdisagree.iconify.utils

import com.drdisagree.iconify.Iconify.Companion.appContext
import com.drdisagree.iconify.ui.models.InfoModel
import com.drdisagree.iconify.utils.FileUtils.readJsonFileFromAssets
import org.json.JSONArray
import java.io.BufferedReader
import java.io.InputStreamReader

fun parseContributors(): ArrayList<InfoModel> {
fun parseTranslators(): ArrayList<InfoModel> {
val contributorsList = ArrayList<InfoModel>()
val jsonStr = readJsonFileFromAssets("Misc/contributors.json")
val jsonStr = readJsonFileFromAssets("Misc/translators.json")
val jsonArray = JSONArray(jsonStr)

for (i in 0 until jsonArray.length()) {
Expand All @@ -30,16 +28,4 @@ fun parseContributors(): ArrayList<InfoModel> {
}

return contributorsList
}

fun readJsonFileFromAssets(fileName: String): String {
val stringBuilder = StringBuilder()
val inputStream = appContext.assets.open(fileName)
val bufferedReader = BufferedReader(InputStreamReader(inputStream))
var line: String?
while (bufferedReader.readLine().also { line = it } != null) {
stringBuilder.append(line)
}
bufferedReader.close()
return stringBuilder.toString()
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/drdisagree/iconify/utils/FileUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import com.drdisagree.iconify.common.Resources
import com.drdisagree.iconify.utils.SystemUtils.hasStoragePermission
import com.drdisagree.iconify.utils.SystemUtils.requestStoragePermission
import com.topjohnwu.superuser.Shell
import java.io.BufferedReader
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.io.OutputStream
import java.nio.file.Files
import java.nio.file.Paths
Expand Down Expand Up @@ -192,4 +194,16 @@ object FileUtils {
chooseFile.setType(type)
launcher.launch(chooseFile)
}

fun readJsonFileFromAssets(fileName: String): String {
val stringBuilder = StringBuilder()
val inputStream = appContext.assets.open(fileName)
val bufferedReader = BufferedReader(InputStreamReader(inputStream))
var line: String?
while (bufferedReader.readLine().also { line = it } != null) {
stringBuilder.append(line)
}
bufferedReader.close()
return stringBuilder.toString()
}
}
File renamed without changes.

0 comments on commit 3b18adb

Please sign in to comment.