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

Replace "Over..." language with more precise "Top..." #4509

Merged
merged 1 commit into from
Jun 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const AllCollectionsTemplate = (args) => ({
})
const mediaStore = useMediaStore()
mediaStore.$patch({
results: { image: { count: 10000 } },
results: { image: { count: 240 } },
})
return { args }
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/composables/use-i18n-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const collectionKeys = {
export function getCountKey(resultsCount: number): keyof KeyCollection {
return resultsCount === 0
? "zero"
: resultsCount >= 10000
: resultsCount >= 240
? "countMore"
: "count"
}
Expand Down Expand Up @@ -130,7 +130,7 @@ export function useI18nResultsCount() {
/**
* Returns the localized text for the number of search results, using corresponding
* pluralization rules and decimal separators.
* E.g. "No results", "3,567 results", "Over 10,000 results".
* E.g. "No results", "132 results", "Top 240 results".
*/
const getI18nCount = (resultsCount: number) => {
return i18n.tc(getI18nKey(resultsCount, ALL_MEDIA), resultsCount, {
Expand Down
36 changes: 18 additions & 18 deletions frontend/src/locales/scripts/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -614,17 +614,17 @@
browsePage: {
allNoResults: "No results",
allResultCount: "{localeCount} result|{localeCount} results",
allResultCountMore: "Over {localeCount} results",
allResultCountMore: "Top {localeCount} results",
contentLink: {
image: {
zero: "No images found for {query}.",
count: "See {localeCount} image found for {query}.|See {localeCount} images found for {query}.",
countMore: "See over {localeCount} images found for {query}.",
countMore: "See the top {localeCount} images found for {query}.",
},
audio: {
zero: "No audio tracks found for {query}.",
count: "See {localeCount} audio tracks found for {query}.",
countMore: "See over {localeCount} audio tracks found for {query}.",
countMore: "See the top {localeCount} audio tracks found for {query}.",
},
},
load: "Load more results",
Expand Down Expand Up @@ -705,12 +705,12 @@
image: {
zero: 'No image results for "{query}"',
count: '{localeCount} image result for "{query}".|{localeCount} image results for "{query}".',
countMore: 'Over {localeCount} image results for "{query}".',
countMore: 'Top {localeCount} image results for "{query}".',
},
audio: {
zero: 'No audio tracks for "{query}"',
count: '{localeCount} audio track for "{query}".|{localeCount} audio tracks for "{query}".',
countMore: 'Over {localeCount} audio tracks for "{query}".',
countMore: 'Top {localeCount} audio tracks for "{query}".',
},
},
allResultsHeadingCount: {
Expand All @@ -720,15 +720,15 @@
/* Interpolated into browsePage.aria.results.all */
count: "{localeCount} image|{localeCount} images",
/* Interpolated into browsePage.aria.results.all */
countMore: "over {localeCount} images",
countMore: "top {localeCount} images",
},
audio: {
/* Interpolated into browsePage.aria.results.all */
zero: "no audio tracks",
/* Interpolated into browsePage.aria.results.all */
count: "{localeCount} audio track|{localeCount} audio tracks",
/* Interpolated into browsePage.aria.results.all */
countMore: "over {localeCount} audio tracks",
countMore: "top {localeCount} audio tracks",
},
},
},
Expand Down Expand Up @@ -1137,15 +1137,15 @@
},
ariaLabel: {
creator: {
audio: "Audio files by {creator} in {source}",
audio: "Audio tracks by {creator} in {source}",
image: "Images by {creator} in {source}",
},
source: {
audio: "Audio files from {source}",
audio: "Audio tracks from {source}",
image: "Images from {source}",
},
tag: {
audio: "Audio files with the tag {tag}",
audio: "Audio tracks with the tag {tag}",
image: "Images with the tag {tag}",
},
},
Expand All @@ -1154,36 +1154,36 @@
audio: {
zero: "No audio tracks by this creator.",
count: "{count} audio track by this creator.|{count} audio tracks by this creator.",
countMore: "Over {count} audio files by this creator.",
countMore: "Top {count} audio tracks by this creator.",
},
image: {
zero: "No images by this creator.",
count: "{count} image by this creator.|{count} images by this creator.",
countMore: "Over {count} images by this creator.",
countMore: "Top {count} images by this creator.",
},
},
source: {
audio: {
zero: "No audio files provided by this source",
zero: "No audio tracks provided by this source",
count: "{count} audio track provided by this source|{count} audio tracks provided by this source",
countMore: "Over {count} audio files provided by this source",
countMore: "Top {count} audio tracks provided by this source",
},
image: {
zero: "No images provided by this source",
count: "{count} image provided by this source|{count} images provided by this source",
countMore: "Over {count} images provided by this source",
countMore: "Top {count} images provided by this source",
},
},
tag: {
audio: {
zero: "No audio files with the selected tag",
zero: "No audio tracks with the selected tag",
count: "{count} audio track with the selected tag|{count} audio tracks with the selected tag",
countMore: "Over {count} audio files with the selected tag",
countMore: "Top {count} audio tracks with the selected tag",
},
image: {
zero: "No images with the selected tag",
count: "{count} image with the selected tag|{count} images with the selected tag",
countMore: "Over {count} images with the selected tag",
countMore: "Top {count} images with the selected tag",
},
},
},
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/stores/media/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export const useMediaStore = defineStore("media", {

/**
* Returns the total count of results for selected search type, sums all media results for ALL_MEDIA or additional types.
* If the count is more than 10000, returns 10000 to match the API result.
*/
resultCount(state) {
const types = (
Expand All @@ -137,11 +136,10 @@ export const useMediaStore = defineStore("media", {
? supportedMediaTypes
: [this._searchType]
) as SupportedMediaType[]
const count = types.reduce(
return types.reduce(
(sum, mediaType) => sum + state.results[mediaType].count,
0
)
return Math.min(count, 10000)
},

/**
Expand Down
8 changes: 4 additions & 4 deletions frontend/test/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -897,24 +897,24 @@
"audio": {
"zero": "No audio files provided by this source",
"count": "{count} audio file provided by this source. {count}",
"countMore": "Over {count} audio files provided by this source"
"countMore": "Top {count} audio files provided by this source"
},
"image": {
"zero": "No images provided by this source",
"count": "{count} image provided by this source. {count} images provided by this source",
"countMore": "Over {count} images provided by this source"
"countMore": "Top {count} images provided by this source"
}
},
"tag": {
"audio": {
"zero": "لا ملفات صوتية مع علامة مختارة",
"count": "{count} {count}",
"countMore": "Over {count} audio files with the selected tag"
"countMore": "Top {count} audio files with the selected tag"
},
"image": {
"zero": "لا صور مع العلامة المختارة",
"count": "{count} {count} الصور مع علامة مختارة",
"countMore": "Over {count} images with the selected tag"
"countMore": "Top {count} images with the selected tag"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/test/playwright/e2e/resources/mock_image_data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"result_count": 10000,
"page_count": 250,
"result_count": 240,
"page_count": 12,
"page_size": 20,
"results": [
{
Expand Down
4 changes: 2 additions & 2 deletions frontend/test/playwright/e2e/search-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ const imageConfig = {
name: "Images",
url: "/search/image?q=birds",
canLoadMore: true,
results: /Over 10,000 results/,
results: /Top 240 results/,
} as const

const audioConfig = {
id: "audio",
name: "Audio",
url: "/search/audio?q=birds",
canLoadMore: true,
results: /Over 10,000 results/,
results: /Top 240 results/,
} as const

const searchTypes = [allContentConfig, imageConfig, audioConfig] as const
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 1,
page_size: 10,
page: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
],
},
body: {
result_count: 10000,
result_count: 240,
page_count: 20,
page_size: 20,
page: 1,
Expand Down
Loading