Tatoeba / tatoeba2

Tatoeba is a platform whose purpose is to create a collaborative and open dataset of sentences and their translations.
https://tatoeba.org
GNU Affero General Public License v3.0
702 stars 132 forks source link

Add audio source count per sentence for user audio contributions page #3121

Open cblanken opened 5 months ago

cblanken commented 5 months ago

This PR solves issue #2944

So far I've only tested on a couple audio sources as shown in the screenshot, but this solution should work for any number of audio sources. I'll do some more testing when I get a script working to import audio files automatically. image

jiru commented 5 months ago

Thanks! :slightly_smiling_face: I have a few comments.

From my understanding, the code you changed also affects the display of sentences everywhere on the website, including search results etc. I wonder if this is a necessary or wanted change.

Since the majority of sentences with audio only have one audio, I suggest not displaying anything in that case to reduce cognitive load.

cblanken commented 5 months ago

From my understanding, the code you changed also affects the display of sentences everywhere on the website, including search results etc. I wonder if this is a necessary or wanted change.

I can't quite pin down why, but there does appear to be a different component for the regular sentence search. The changes I've made only seem to affect the search by audio page (/audio/index) and the individual contributor audio page (/audio/of/<contributor>).

In the long run, I think it would be nice to have a complete dropdown menu to select available audios and replay them at will instead of cycling through them one at a time especially if any features to mark audios as particular dialects/accents are ever implemented. A number indicator telling how many different audios exist for a sentence is a good stopgap though.

/audio/index

image

/audio/of/contributor

image

Main Sentence Search

image

Edit: I removed the counts for sentences with only one audio and added a bit of right-side padding, so it should work well for sentences up to 2 digits. I doubt many sentences will ever get more than 99 audios.

jiru commented 5 months ago

Thank you for making the change I suggested.

I can't quite pin down why, but there does appear to be a different component for the regular sentence search. The changes I've made only seem to affect the search by audio page (/audio/index) and the individual contributor audio page (/audio/of/).

Sorry I wasn’t very clear. Sentences can be displayed using two different designs, because we "in the process" of migrating from the "old design" to the "new design". There is a setting in user preferences that allows you to switch between both, it says:

Display sentences with the old design. Note that the old design will be removed at some point.

You can see the difference between both designs on the search results page for example. Using the old design, your change does affect search results (and pretty much all the other pages where sentences are displayed).

As for the /audio/index and /audio/of/<contributor> pages, they both happen to use the old design no matter what the setting says, because they have not been migrated yet.

As for the impact of your change, the only concern I have is that your change reduces the available space for sentence text, especially in search results where the space is already reduced compared to other places, because of the right pane. Looking back, at some point we added the audio icon, then the copy-paste button, which makes the whole thing more and more crowded, I think we want to avoid adding yet another item.

I think that while it totally makes sense to make the "number of audios" prominently visible on /audio pages, maybe not so much in other pages where audio isn’t the main focus. Maybe the display can be adjusted with a CSS specific to /audio pages.

cblanken commented 5 months ago

Ah, I see now. Thank you. I was really confused what was going on :sweat_smile:

As for the impact of your change, the only concern I have is that your change reduces the available space for sentence text, especially in search results where the space is already reduced compared to other places, because of the right pane. Looking back, at some point we added the audio icon, then the copy-paste button, which makes the whole thing more and more crowded, I think we want to avoid adding yet another item.

If space is the main concern, I think the audio count could be minimized a bit, so it only takes up about 1 character's width at most. Like this:

/audio/index

image

/sentences/search

image

This solution just adds an extra 3/4 character width in margin on the right to make space for up to 2 digits in the audio count (the audio count font size is 60% of the main sentence font size here).

I think that while it totally makes sense to make the "number of audios" prominently visible on /audio pages, maybe not so much in other pages where audio isn’t the main focus. Maybe the display can be adjusted with a CSS specific to /audio pages.

@jiru I think it would be better for the audio playback interface to be consistent between pages whether that means leaving out the audio count entirely or adding it, but I can look into applying it specifically to the /audio pages if you really think that's the way to go?

jiru commented 5 months ago

If space is the main concern

My concern is also about cognitive load. More things displayed means it takes longer for the eyes and brain to process the information.

@jiru I think it would be better for the audio playback interface to be consistent between pages whether that means leaving out the audio count entirely or adding it, but I can look into applying it specifically to the /audio pages if you really think that's the way to go?

I understand the point of having a consistent interface, but striking for consistency is also what made us to build the current sentences+translations block, which is somewhat crowded. This block has all the functionalities, you can do anything everywhere, but in terms of design I think it is rather disconnected from the context of the page it is displayed in. Sorry for digressing. :laughing:

As showed in issue #2944 there are good reasons to add the number of audio in audio pages. Let’s add it to the audio pages only for now, and if we figure out there is a need somewhere else, or everywhere, we can later add it there too.

jiru commented 5 months ago

By the way it seems your changes break the display of sentences with transcriptions: image