Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Update audio categories #1168

Merged
merged 6 commits into from
Mar 23, 2022
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
2 changes: 1 addition & 1 deletion src/components/VAudioDetails/VAudioDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div v-if="audio.category">
<dt>{{ $t('audio-details.table.category') }}</dt>
<dd>
{{ audio.category }}
{{ $t(`filters.audio-categories.${audio.category}`) }}
</dd>
</div>
<div v-if="audio.sample_rate">
Expand Down
2 changes: 1 addition & 1 deletion src/components/VAudioTrack/layouts/VBoxLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
hide-name
:license="audio.license"
/>
<div>{{ $t(`audio-categories.${audio.category}`) }}</div>
<div>{{ $t(`filters.audio-categories.${audio.category}`) }}</div>
krysal marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/VAudioTrack/layouts/VRowLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</span>

<span v-if="audio.category">
<span>{{ $t(`audio-categories.${audio.category}`) }}</span
<span>{{ $t(`filters.audio-categories.${audio.category}`) }}</span
><span class="mx-2">{{ $t('interpunct') }}</span>
</span>

Expand Down
9 changes: 8 additions & 1 deletion src/constants/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ export const mediaUniqueFilterKeys = deepFreeze<
const filterCodesPerCategory = deepFreeze<Record<FilterCategory, string[]>>({
licenses: [...ACTIVE_LICENSES],
licenseTypes: ['commercial', 'modification'],
audioCategories: ['music', 'sound', 'podcast'],
audioCategories: [
'audiobook',
'music',
'news',
'podcast',
'pronunciation',
'sound_effect',
],
imageCategories: ['photograph', 'illustration', 'digitized_artwork'],
audioExtensions: ['mp3', 'ogg', 'flac'],
imageExtensions: ['jpg', 'png', 'gif', 'svg'],
Expand Down
15 changes: 6 additions & 9 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,13 @@
},
"audio-categories": {
"title": "Audio category",
"audiobook": "Audiobook",
"music": "Music",
"sound": "Sound effects",
"podcast": "Podcast"
"news": "News",
"podcast": "Podcast",
"pronunciation": "Pronunciation",
"sound_effect": "Sound effects",
"sound": "Sound effects"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sound key is still required due to the API returning this value in some audios.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch to display it here but not include it in the filters 👍

},
"image-categories": {
"title": "Image type",
Expand Down Expand Up @@ -568,13 +572,6 @@
"search": {
"search": "Search"
},
"audio-categories": {
"title": "Audio Category",
"music": "Music",
"sound": "Sound effects",
"podcast": "Podcast",
"pronunciation": "Pronunciation"
},
"license-readable-names": {
"cc0": "Zero",
"pdm": "Public Domain Mark",
Expand Down
42 changes: 19 additions & 23 deletions src/locales/po-files/openverse.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Openverse \n"
"Report-Msgid-Bugs-To: https://github.com/wordpress/openverse/issues \n"
"POT-Creation-Date: 2022-03-22T03:16:50+00:00\n"
"POT-Creation-Date: 2022-03-22T20:55:19+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -163,26 +163,6 @@ msgctxt "license-readable-names.nc-sampling+"
msgid "NonCommercial Sampling Plus"
msgstr ""

msgctxt "audio-categories.title"
msgid "Audio Category"
msgstr ""

msgctxt "audio-categories.music"
msgid "Music"
msgstr ""

msgctxt "audio-categories.sound"
msgid "Sound effects"
msgstr ""

msgctxt "audio-categories.podcast"
msgid "Podcast"
msgstr ""

msgctxt "audio-categories.pronunciation"
msgid "Pronunciation"
msgstr ""

#: src/components/VHeader/VSearchBar/VSearchButton.vue:4
msgctxt "search.search"
msgid "Search"
Expand Down Expand Up @@ -1005,18 +985,34 @@ msgctxt "filters.audio-categories.title"
msgid "Audio category"
msgstr ""

msgctxt "filters.audio-categories.audiobook"
msgid "Audiobook"
msgstr ""

msgctxt "filters.audio-categories.music"
msgid "Music"
msgstr ""

msgctxt "filters.audio-categories.sound"
msgid "Sound effects"
msgctxt "filters.audio-categories.news"
msgid "News"
msgstr ""

msgctxt "filters.audio-categories.podcast"
msgid "Podcast"
msgstr ""

msgctxt "filters.audio-categories.pronunciation"
msgid "Pronunciation"
msgstr ""

msgctxt "filters.audio-categories.sound_effect"
msgid "Sound effects"
msgstr ""

msgctxt "filters.audio-categories.sound"
msgid "Sound effects"
msgstr ""

msgctxt "filters.audio-providers.title"
msgid "Source"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion test/playwright/e2e/filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const assertCheckboxCount = async (

const FILTER_COUNTS = {
[ALL_MEDIA]: 11,
[AUDIO]: 23,
[AUDIO]: 26,
[IMAGE]: 70,
}

Expand Down
12 changes: 6 additions & 6 deletions test/unit/specs/stores/search-store.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ describe('Search Store', () => {
it.each`
searchType | nextSearchType | expectedFilterCount
${AUDIO} | ${IMAGE} | ${25}
${IMAGE} | ${ALL_MEDIA} | ${34}
${IMAGE} | ${ALL_MEDIA} | ${37}
${ALL_MEDIA} | ${VIDEO} | ${12}
${VIDEO} | ${AUDIO} | ${21}
${VIDEO} | ${AUDIO} | ${24}
${ALL_MEDIA} | ${IMAGE} | ${25}
`(
'changing searchType clears all but $expectedFilterCount $nextSearchType filters ',
Expand Down Expand Up @@ -415,10 +415,10 @@ describe('Search Store', () => {
*/
it.each`
searchType | nextSearchType | expectedFilterCount
${AUDIO} | ${ALL_MEDIA} | ${34}
${IMAGE} | ${ALL_MEDIA} | ${34}
${ALL_MEDIA} | ${ALL_MEDIA} | ${34}
${VIDEO} | ${ALL_MEDIA} | ${34}
${AUDIO} | ${ALL_MEDIA} | ${37}
${IMAGE} | ${ALL_MEDIA} | ${37}
${ALL_MEDIA} | ${ALL_MEDIA} | ${37}
${VIDEO} | ${ALL_MEDIA} | ${37}
`(
'changing searchType clears all but $expectedFilterCount ALL_MEDIA filters',
async ({ searchType, nextSearchType, expectedFilterCount }) => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/utils/search-query-transform.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('searchQueryTransform', () => {
{
checked: false,
code: 'soundEffects',
name: 'filters.audio-categories.sound-effects',
name: 'filters.audio-categories.sound_effects',
},
{
checked: false,
Expand Down