Skip to content

Commit

Permalink
Add formatted social counts to more places
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Sep 16, 2024
1 parent 11aad05 commit aa6935b
Show file tree
Hide file tree
Showing 42 changed files with 511 additions and 503 deletions.
1 change: 1 addition & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ preserve_hierarchy: true
files:
- source: ui/src/commonMain/moko-resources/base/plurals.xml
translation: ui/src/commonMain/moko-resources/%locale%/plurals.xml
update_option: update_as_unapproved
ignore:
- ui/src/commonMain/moko-resources/images/
- ui/src/commonMain/moko-resources/files/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import com.materiiapps.gloom.api.dto.user.User
import com.materiiapps.gloom.gql.fragment.FeedRepository
import com.materiiapps.gloom.ui.component.Avatar
import com.materiiapps.gloom.ui.screen.repo.RepoScreen
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.util.parsedColor
import com.materiiapps.gloom.ui.util.pluralStringResource
Expand Down Expand Up @@ -129,7 +130,7 @@ fun FeedRepoCard(
modifier = Modifier.size(18.dp),
tint = starColor
)
Text(text = starCount.toString())
Text(text = NumberFormatter.compact(starCount))
}

if (repo.primaryLanguage != null) {
Expand Down Expand Up @@ -163,8 +164,9 @@ fun FeedRepoCard(
text = pluralStringResource(
res = Res.plurals.noun_contributors,
count = repo.contributorsCount,
repo.contributorsCount
), style = MaterialTheme.typography.labelLarge
NumberFormatter.compact(repo.contributorsCount)
),
style = MaterialTheme.typography.labelLarge
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.materiiapps.gloom.gql.fragment.FeedOrg
import com.materiiapps.gloom.gql.fragment.FeedUser
import com.materiiapps.gloom.ui.component.Avatar
import com.materiiapps.gloom.ui.screen.profile.ProfileScreen
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.util.pluralStringResource
import dev.icerock.moko.resources.compose.stringResource
Expand Down Expand Up @@ -131,7 +132,7 @@ fun FeedUserCard(
pluralStringResource(
Res.plurals.repositories,
count = repos ?: 0,
repos ?: 0
NumberFormatter.compact(repos ?: 0)
)
)
}
Expand All @@ -150,7 +151,7 @@ fun FeedUserCard(
pluralStringResource(
Res.plurals.followers,
count = followers,
followers
NumberFormatter.compact(followers)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import com.materiiapps.gloom.ui.screen.list.SponsoringScreen
import com.materiiapps.gloom.ui.screen.list.StarredReposListScreen
import com.materiiapps.gloom.ui.screen.settings.SettingsScreen
import com.materiiapps.gloom.ui.util.EmojiUtil
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.screen.profile.viewmodel.ProfileViewModel
import com.materiiapps.gloom.ui.widget.ReadMeCard
Expand Down Expand Up @@ -382,7 +383,7 @@ open class ProfileScreen(
pluralStringResource(
Res.plurals.followers,
(user.followers ?: 0).toInt(),
user.followers ?: 0
NumberFormatter.compact((user.followers ?: 0).toInt())
)
)
}
Expand All @@ -397,7 +398,7 @@ open class ProfileScreen(
pluralStringResource(
Res.plurals.following,
(user.following ?: 0).toInt(),
user.following ?: 0
NumberFormatter.compact((user.following ?: 0).toInt())
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import com.materiiapps.gloom.ui.component.Avatar
import com.materiiapps.gloom.ui.icon.Custom
import com.materiiapps.gloom.ui.icon.custom.Fork
import com.materiiapps.gloom.ui.screen.repo.RepoScreen
import com.materiiapps.gloom.ui.theme.colors
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.util.parsedColor
import dev.icerock.moko.resources.compose.stringResource
Expand Down Expand Up @@ -141,9 +143,9 @@ fun RepoItem(
Icons.Outlined.Star,
contentDescription = null,
modifier = Modifier.size(18.dp),
tint = Color(0xFFF1E05A)
tint = MaterialTheme.colors.statusYellow
)
Text(text = repo.stars.toString())
Text(text = NumberFormatter.compact(repo.stars ?: 0))
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.materiiapps.gloom.ui.icon.Custom
import com.materiiapps.gloom.ui.icon.custom.Fork
import com.materiiapps.gloom.ui.screen.repo.LicenseScreen
import com.materiiapps.gloom.ui.screen.repo.RepoScreen
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.util.pluralStringResource
import com.materiiapps.gloom.ui.screen.repo.viewmodel.RepoDetailsViewModel
Expand Down Expand Up @@ -154,7 +155,7 @@ class DetailsTab(
text = pluralStringResource(
res = Res.plurals.stars,
count = repoDetails.stargazerCount,
repoDetails.stargazerCount
NumberFormatter.compact(repoDetails.stargazerCount)
),
onClick = viewModel::toggleStar,
enabled = !viewModel.isStarLoading
Expand All @@ -173,7 +174,7 @@ class DetailsTab(
text = pluralStringResource(
res = Res.plurals.forks,
count = repoDetails.forkCount,
repoDetails.forkCount
NumberFormatter.compact(repoDetails.forkCount)
),
onClick = { /* TODO */ }
)
Expand Down
24 changes: 12 additions & 12 deletions ui/src/commonMain/moko-resources/af-ZA/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="noun_contributors">
<item quantity="one">%d Contributor</item>
<item quantity="other">%d Contributors</item>
<item quantity="one">%s Contributor</item>
<item quantity="other">%s Contributors</item>
</plurals>
<plurals name="repositories">
<item quantity="one">%d Repository</item>
<item quantity="other">%d Repositories</item>
<item quantity="one">%s Repository</item>
<item quantity="other">%s Repositories</item>
</plurals>
<plurals name="stars">
<item quantity="one">%d Star</item>
<item quantity="other">%d Stars</item>
<item quantity="one">%s Star</item>
<item quantity="other">%s Stars</item>
</plurals>
<plurals name="forks">
<item quantity="one">%d Fork</item>
<item quantity="other">%d Forks</item>
<item quantity="one">%s Fork</item>
<item quantity="other">%s Forks</item>
</plurals>
<plurals name="followers">
<item quantity="one">%d Follower</item>
<item quantity="other">%d Followers</item>
<item quantity="one">%s Follower</item>
<item quantity="other">%s Followers</item>
</plurals>
<plurals name="following">
<item quantity="one">%d Following</item>
<item quantity="other">%d Following</item>
<item quantity="one">%s Following</item>
<item quantity="other">%s Following</item>
</plurals>
<plurals name="contributions_toast">
<item quantity="one">%1$s: %2$d Contribution</item>
Expand Down
72 changes: 36 additions & 36 deletions ui/src/commonMain/moko-resources/ar-SA/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="noun_contributors">
<item quantity="zero">%d Contributors</item>
<item quantity="one">مساهم %d</item>
<item quantity="two">المساهمين %d</item>
<item quantity="few">%d Contributors</item>
<item quantity="many">المساهمين %d</item>
<item quantity="other">مساهم %d</item>
<item quantity="zero">%s Contributors</item>
<item quantity="one">مساهم %s</item>
<item quantity="two">المساهمين %s</item>
<item quantity="few">%s Contributors</item>
<item quantity="many">المساهمين %s</item>
<item quantity="other">مساهم %s</item>
</plurals>
<plurals name="repositories">
<item quantity="zero">%d Repositories</item>
<item quantity="one">%d Repository</item>
<item quantity="two">%d Repositories</item>
<item quantity="few">%d Repositories</item>
<item quantity="many">%d Repositories</item>
<item quantity="other">%d Repositories</item>
<item quantity="zero">%s Repositories</item>
<item quantity="one">%s Repository</item>
<item quantity="two">%s Repositories</item>
<item quantity="few">%s Repositories</item>
<item quantity="many">%s Repositories</item>
<item quantity="other">%s Repositories</item>
</plurals>
<plurals name="stars">
<item quantity="zero">%d Stars</item>
<item quantity="one">%d Star</item>
<item quantity="two">%d Stars</item>
<item quantity="few">%d Stars</item>
<item quantity="many">%d Stars</item>
<item quantity="other">%d Stars</item>
<item quantity="zero">%s Stars</item>
<item quantity="one">%s Star</item>
<item quantity="two">%s Stars</item>
<item quantity="few">%s Stars</item>
<item quantity="many">%s Stars</item>
<item quantity="other">%s Stars</item>
</plurals>
<plurals name="forks">
<item quantity="zero">%d Forks</item>
<item quantity="one">%d Fork</item>
<item quantity="two">%d Forks</item>
<item quantity="few">%d Forks</item>
<item quantity="many">%d Forks</item>
<item quantity="other">%d Forks</item>
<item quantity="zero">%s Forks</item>
<item quantity="one">%s Fork</item>
<item quantity="two">%s Forks</item>
<item quantity="few">%s Forks</item>
<item quantity="many">%s Forks</item>
<item quantity="other">%s Forks</item>
</plurals>
<plurals name="followers">
<item quantity="zero">%d Followers</item>
<item quantity="one">%d Follower</item>
<item quantity="two">%d Followers</item>
<item quantity="few">%d Followers</item>
<item quantity="many">%d Followers</item>
<item quantity="other">%d Followers</item>
<item quantity="zero">%s Followers</item>
<item quantity="one">%s Follower</item>
<item quantity="two">%s Followers</item>
<item quantity="few">%s Followers</item>
<item quantity="many">%s Followers</item>
<item quantity="other">%s Followers</item>
</plurals>
<plurals name="following">
<item quantity="zero">%d Following</item>
<item quantity="one">%d Following</item>
<item quantity="two">%d Following</item>
<item quantity="few">%d Following</item>
<item quantity="many">%d Following</item>
<item quantity="other">%d Following</item>
<item quantity="zero">%s Following</item>
<item quantity="one">%s Following</item>
<item quantity="two">%s Following</item>
<item quantity="few">%s Following</item>
<item quantity="many">%s Following</item>
<item quantity="other">%s Following</item>
</plurals>
<plurals name="contributions_toast">
<item quantity="zero">%1$s: %2$d Contributions</item>
Expand Down
24 changes: 12 additions & 12 deletions ui/src/commonMain/moko-resources/base/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<plurals name="noun_contributors">
<item quantity="one">%d Contributor</item>
<item quantity="other">%d Contributors</item>
<item quantity="one">%s Contributor</item>
<item quantity="other">%s Contributors</item>
</plurals>

<plurals name="repositories">
<item quantity="one">%d Repository</item>
<item quantity="other">%d Repositories</item>
<item quantity="one">%s Repository</item>
<item quantity="other">%s Repositories</item>
</plurals>

<plurals name="stars">
<item quantity="one">%d Star</item>
<item quantity="other">%d Stars</item>
<item quantity="one">%s Star</item>
<item quantity="other">%s Stars</item>
</plurals>

<plurals name="forks">
<item quantity="one">%d Fork</item>
<item quantity="other">%d Forks</item>
<item quantity="one">%s Fork</item>
<item quantity="other">%s Forks</item>
</plurals>

<plurals name="followers">
<item quantity="one">%d Follower</item>
<item quantity="other">%d Followers</item>
<item quantity="one">%s Follower</item>
<item quantity="other">%s Followers</item>
</plurals>

<plurals name="following">
<item quantity="one">%d Following</item>
<item quantity="other">%d Following</item>
<item quantity="one">%s Following</item>
<item quantity="other">%s Following</item>
</plurals>

<plurals name="contributions_toast">
Expand Down
24 changes: 12 additions & 12 deletions ui/src/commonMain/moko-resources/ca-ES/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="noun_contributors">
<item quantity="one">%d Contributor</item>
<item quantity="other">%d Contributors</item>
<item quantity="one">%s Contributor</item>
<item quantity="other">%s Contributors</item>
</plurals>
<plurals name="repositories">
<item quantity="one">%d Repository</item>
<item quantity="other">%d Repositories</item>
<item quantity="one">%s Repository</item>
<item quantity="other">%s Repositories</item>
</plurals>
<plurals name="stars">
<item quantity="one">%d Star</item>
<item quantity="other">%d Stars</item>
<item quantity="one">%s Star</item>
<item quantity="other">%s Stars</item>
</plurals>
<plurals name="forks">
<item quantity="one">%d Fork</item>
<item quantity="other">%d Forks</item>
<item quantity="one">%s Fork</item>
<item quantity="other">%s Forks</item>
</plurals>
<plurals name="followers">
<item quantity="one">%d Follower</item>
<item quantity="other">%d Followers</item>
<item quantity="one">%s Follower</item>
<item quantity="other">%s Followers</item>
</plurals>
<plurals name="following">
<item quantity="one">%d Following</item>
<item quantity="other">%d Following</item>
<item quantity="one">%s Following</item>
<item quantity="other">%s Following</item>
</plurals>
<plurals name="contributions_toast">
<item quantity="one">%1$s: %2$d Contribution</item>
Expand Down
Loading

0 comments on commit aa6935b

Please sign in to comment.