Skip to content

Commit

Permalink
Use i18n plurals for video + channel count
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkyProgrammer committed Jul 18, 2023
1 parent db1d0fc commit 57673fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/renderer/components/ft-list-hashtag/ft-list-hashtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default defineComponent({
url: '',
channelCount: 0,
videoCount: 0,
channelCountFormatted: '',
videoCountFormatted: '',
}
},
computed: {
Expand All @@ -32,8 +34,10 @@ export default defineComponent({
methods: {
parseData: function () {
this.url = this.data.url
this.channelCount = formatNumber(this.data.channelCount)
this.videoCount = formatNumber(this.data.videoCount)
this.channelCount = this.data.channelCount
this.channelCountFormatted = formatNumber(this.channelCount)
this.videoCount = this.data.videoCount
this.videoCountFormatted = formatNumber(this.videoCount)
this.title = this.data.title
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/ft-list-hashtag/ft-list-hashtag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
v-if="channelCount"
class="channelCount"
>
{{ $t('Channel Count', {channelCount: channelCount}) }}
{{ $tc('Channel Count', channelCount, {channelCount: channelCountFormatted}) }}
</span>
<span
v-if="videoCount"
class="videoCount"
>
{{ $t('Video Count', {videoCount: videoCount}) }}
{{ $tc('Video Count', videoCount, {videoCount: videoCountFormatted}) }}
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -889,5 +889,5 @@ Hashtag:
Yes: Yes
No: No
Ok: Ok
Video Count: '{videoCount} videos'
Channel Count: '{channelCount} channels'
Video Count: '1 video | {videoCount} videos'
Channel Count: '1 channel | {channelCount} channels'

0 comments on commit 57673fb

Please sign in to comment.