Skip to content

Commit

Permalink
feat: crowdin sync (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine authored Aug 13, 2022
1 parent f5404c2 commit cf3618e
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 12 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Sync Crowdin

on:
push:
branches:
- 'master'
paths:
- 'app/src/main/res/values/strings.xml'
- '.github/workflows/crowdin.yml'
schedule:
- cron: "0 17 * * 6" # "At 17:00 on Saturday."
workflow_dispatch:

jobs:
sync-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Crowdin
uses: crowdin/[email protected]
with:
config: crowdin.yml
upload_translations: true
download_translations: true
push_translations: true
create_pull_request: false
localization_branch_name: l10n
commit_message: 'chore(i18n): sync translations'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }}

- name: Merge
run: |
sudo chmod -R ugo+rwX .
git checkout main
git add *
git merge l10n
git push
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# OpenCord
[![Discord](https://img.shields.io/discord/885879572447522817.svg?color=blue&label=OpenCord&logo=discord&style=for-the-badge)](https://discord.gg/3y6vbneMsW)
[![Crowdin](https://badges.crowdin.net/opencord/localized.svg)](https://crowdin.com/project/opencord)

An open-source reimplementation of the Discord Android app.

Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/xinto/opencord/ui/screen/GuildsChannels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private fun CurrentUserItemLoading(
IconButton(onClick = onSettingsClick) {
Icon(
painter = painterResource(R.drawable.ic_settings),
contentDescription = "Open settings"
contentDescription = stringResource(R.string.settings_open)
)
}
},
Expand Down Expand Up @@ -292,7 +292,7 @@ private fun CurrentUserItemLoaded(
IconButton(onClick = onSettingsClick) {
Icon(
painter = painterResource(R.drawable.ic_settings),
contentDescription = "Open settings"
contentDescription = stringResource(R.string.settings_open)
)
}
},
Expand Down Expand Up @@ -326,7 +326,7 @@ private fun GuildsListLoading(
.size(32.dp)
.align(Alignment.Center),
painter = painterResource(R.drawable.ic_discord_logo),
contentDescription = "Home",
contentDescription = stringResource(R.string.guilds_home),
)
}
}
Expand Down Expand Up @@ -379,7 +379,7 @@ private fun GuildsListLoaded(
.size(32.dp)
.align(Alignment.Center),
painter = painterResource(R.drawable.ic_discord_logo),
contentDescription = "Home",
contentDescription = stringResource(R.string.guilds_home),
)
}
}
Expand Down Expand Up @@ -592,7 +592,7 @@ private fun ChannelsListLoaded(
if (boostIcon != null) {
Icon(
painter = painterResource(id = boostIcon),
contentDescription = "Server boost level icon",
contentDescription = stringResource(R.string.guild_boost_level),
modifier = Modifier.size(20.dp),
tint = Color.Unspecified,
)
Expand Down Expand Up @@ -634,7 +634,7 @@ private fun ChannelsListLoaded(
icon = {
Icon(
painter = painterResource(R.drawable.ic_keyboard_arrow_down),
contentDescription = "Collapse category",
contentDescription = stringResource(R.string.channels_collapse_category),
modifier = Modifier.rotate(iconRotation)
)
},
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/xinto/opencord/ui/screen/Login.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private fun LoginAppBar(
) {
Icon(
imageVector = Icons.Rounded.ArrowBack,
contentDescription = "Back"
contentDescription = stringResource(R.string.navigation_back)
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.xinto.bdc.BottomSheetDialog
import com.xinto.opencord.R
Expand Down Expand Up @@ -73,7 +74,7 @@ fun CurrentUserSheet(
Text(viewModel.userCustomStatus!!.text ?: "")
Icon(
painter = painterResource(R.drawable.ic_cancel),
contentDescription = "Clear status",
contentDescription = stringResource(R.string.current_user_clear_status),
modifier = Modifier
.align(Alignment.CenterEnd)
.clickable {
Expand All @@ -97,7 +98,7 @@ fun CurrentUserSheet(
tint = Color.Unspecified,
modifier = Modifier.size(25.dp),
)
Text("Set a custom status")
Text(stringResource(R.string.current_user_set_status))
}
}

Expand All @@ -114,7 +115,7 @@ fun CurrentUserSheet(
contentDescription = null,
modifier = Modifier.size(25.dp),
)
Text("Switch Accounts")
Text(stringResource(R.string.accounts_open))
}
}
}
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<resources>
<string name="app_name">OpenCord</string>
<string name="app_name" translatable="false">OpenCord</string>

<string name="navigation_back">Back</string>

<string name="login_landing_title">Welcome to OpenCord!</string>
<string name="login_landing_subtitle">Join over 0 people who use OpenCord as an alternative to the stock Discord app.</string>
Expand All @@ -21,15 +23,26 @@

<string name="channel_unselected_message">Please select a guild.</string>

<string name="channels_collapse_category">Collapse category</string>

<string name="pins_title">Pinned Messages</string>
<string name="pins_loading_error">An error occurred while loading pinned messages.</string>

<string name="settings_title">Settings</string>
<string name="settings_open">Open settings</string>

<string name="timestamp_tomorrow">Tomorrow at %1$s</string>
<string name="timestamp_today">Today at %1$s</string>
<string name="timestamp_yesterday">Yesterday at %1$s</string>

<string name="message_reply_unknown">Unknown message.</string>

</resources>
<string name="guilds_home">Home</string>

<string name="guild_boost_level">Server boost level</string>

<string name="current_user_set_status">Set a custom status</string>
<string name="current_user_clear_status">Clear status</string>

<string name="accounts_open">Open account switcher</string>
</resources>
7 changes: 7 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN

preserve_hierarchy: true
files:
- source: app/src/main/res/values/strings.xml
translation: app/src/main/res/values-%android_code%/strings.xml

0 comments on commit cf3618e

Please sign in to comment.