[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Phonos should accept filenames in lieu of using IPA rendering
Closed, ResolvedPublic3 Estimated Story Points

Description

Phonos should be flexible enough to provide the required output (e.g. IPA only, speaker icon only, or both)

The motivation is to allow Phonos to handle most things that {{IPA}} templates do currently on the wiki, in effort to make the experience consistent across all wikis and to have better control over design.

Acceptance criteria

  • The parser function could accept a |file= parameter that accepts a filename.
  • Play the given file if it exists instead of rendering the IPA
  • If the file doesn't exist, simply show a red link for now (similar to how red links are shown with [[File:Foo.ogg]] when File.ogg doesn't exist)
    • Design/error handling is separate from this task

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJul 28 2022, 4:27 PM

Some questions

  • Will the icons be the same?
  • How will errors like (invalid file) will be displayed/handled? This can be a separate task
  • Per previous conversations, we've said that human recording takes preference over a generated one (maybe add it to the acceptance criteria?)
MusikAnimal renamed this task from Phonos should handle human or IPA recordings to Phonos should accept filenames in lieu of using IPA rendering.Aug 1 2022, 6:29 PM
MusikAnimal updated the task description. (Show Details)
MusikAnimal subscribed.

we've said that human recording takes preference over a generated one (maybe add it to the acceptance criteria?)

Correct. I've revised the task so hopefully it's more clear now.

This comment was removed by MusikAnimal.

Change 819204 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/Phonos@master] Introduce a 'file' param to play human-recorded audio and remove 'type'

https://gerrit.wikimedia.org/r/819204

@dmaza

  • The icons shouldn't change depending on the pronunciation being generated or human-recorded. I don't think it's a significant detail to surface to users โ€“ what do you think?
  • The errors would likely look like this, in this case invalid file :

Screen Shot 2022-08-01 at 21.25.23.png (626ร—1 px, 54 KB)

  • Human-recorded > TTS-generated makes complete sense :)

(cc @NRodriguez @JFernandez-WMF)

  • The icons shouldn't change depending on the pronunciation being generated or human-recorded. I don't think it's a significant detail to surface to users โ€“ what do you think?

It was recommended by the language team to make some sort of distinction, but I generally agree that it's not a significant issue, assuming the IPA rendering proves to be reliable enough.

  • The errors would likely look like this, in this case invalid file :

Screen Shot 2022-08-01 at 21.25.23.png (626ร—1 px, 54 KB)

Looks great! Would it make sense for Foo.ogg to be a link?

Regardless, I'm thinking it probably makes most sense to do all the design changes in a separate task (right now there are none at all).

Looks great! Would it make sense for Foo.ogg to be a link?

Yeah I think that makes sense-- link to the file correct?

Regardless, I'm thinking it probably makes most sense to do all the design changes in a separate task (right now there are none at all).

Sounds good, as agreed we can add inside of https://phabricator.wikimedia.org/T309613

Change 819204 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Introduce a 'file' param to play human-recorded audio and remove 'type'

https://gerrit.wikimedia.org/r/819204

I think I still have some testing to do on this, but just putting in some thoughts/observations here:

  • The parser function could accept a |audio= parameter that accepts a filename.

The parameter is actually file.

The example documented in the code has audio.

  • If the file doesn't exist, simply show a red link for now (similar to how red links are shown with [[File:Foo.ogg]] when File.ogg doesn't exist)

The red link is to the main namespace, not the file namespace.

If the template is invalid, it stills shows the red file link.

Other
  • I cannot just enter the file parameter, I have to at least enter the ipa parameter. A user might only have the audio file but not the IPA translation.
  • It can be made to display images on the page, e.g. {{#phonos:ipa=hษ›หˆloสŠ|text=Hello|file=File:Cover_Lutung_Kasarung_Wikibook.png}}
    template_displays_image.png (463ร—723 px, 63 KB)

I also wrote a python script to generate wikitext for various combinations of phonos parameters.

Wow, thanks for the thorough QA (as always), Dom! Looks like I made some careless errors. It's supposed to check the content type to ensure it's audio, for starters. Hilarious that you can make it show an image, lol! I'll get that fixed.

I've updated the description to say we are using file= (not audio). I don't know if one is really preferred over the other, and we could even support both if we want. In development I just decided file made more sense as it was explicit as what the value is supposed to be.

I cannot just enter the file parameter, I have to at least enter the ipa parameter. A user might only have the audio file but not the IPA translation.

Giving a value for the ipa parameter is a requirement for the Phonos parser function, but maybe it shouldn't be. @NRodriguez what do you think? I guess if only audio is provided, we can just show a play button and that's it, but this might complicate the designs, and also is somewhat redundant to existing templates like Template:Audio. I figure Phonos should basically be the MediaWiki replacement for enwiki's Template:IPA, which does not let you provide only audio either.

It can be made to display images on the page, e.g. {{#phonos:ipa=hษ›หˆloสŠ|text=Hello|file=File:Cover_Lutung_Kasarung_Wikibook.png}}

This might actually be addressed by T309613: Build UI Components for the IPA play-audio experience. Similar for the "The red link is to the main namespace, not the file namespace" issue. Cc @Samwilson

Change 821303 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/Phonos@master] Prefix redlinks with the File namespace

https://gerrit.wikimedia.org/r/821303

We spoke about this in RTL and it sounds like issues with the error states (when a red link is shown) can be addressed as part of T309613 since whatever I do will basically be re-done as part of that task. However I was able to fix some of the issues with a very minor change, so I've submitted that for review. This fixes the red link destination to always have the File namespace prefixed, which prevents images from being shown, and also correctly links to Special:Upload which is what we wanted anyway. The patch also fixes the error in the code comments (audio= when it should be file=).

If the template is invalid, it stills shows the red file link.

This I wanted to ask about as I'm not sure what you mean. Which template are we referring to, or did you mean the {{#phonos}} parser function itself? Invalid use of the parser function came up in code review. In general, I wouldn't worry about invalid syntax, if that's the concern, since the parser will make this obvious to the editor. I.e. it's very easy to make MediaWiki do funny things and show broken code, etc., if you don't use the right syntax, and this parser function is no different. I think we can assume editors will follow directions.

  • I cannot just enter the file parameter, I have to at least enter the ipa parameter. A user might only have the audio file but not the IPA translation.

Noting this is still an outstanding question for product (T314068#8138117). I'll ask in the Slack channel, but for now you can assume Phonos always expects ipa= and we can change that in a follow-up task, if needed.


I've moved this back to Review/Feedback for the tiny patch I made.

Change 821303 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Prefix redlinks with the File namespace

https://gerrit.wikimedia.org/r/821303

Such thorough QA @Dwalden

Giving a value for the ipa parameter is a requirement for the Phonos parser function, but maybe it shouldn't be. @NRodriguez what do you think? I guess if only audio is provided, we can just show a play button and that's it, but this might complicate the designs, and also is somewhat redundant to existing templates like Template:Audio. I figure Phonos should basically be the MediaWiki replacement for enwiki's Template:IPA, which does not let you provide only audio either.

I agree it is somewhat redundant. Before I say it is out of scope, I'm curious about the overhead. If someone is really familiar with Phonos but not with other audio templates, we're causing them extra work by asking them to search for that functionality elsewhere when they can just use what they already know. If it in fact it does add a lot of overhead, down to remove from our plate.

I agree it is somewhat redundant. Before I say it is out of scope, I'm curious about the overhead. If someone is really familiar with Phonos but not with other audio templates, we're causing them extra work by asking them to search for that functionality elsewhere when they can just use what they already know. If it in fact it does add a lot of overhead, down to remove from our plate.

I think in practice editors aren't going to know about Phonos, only the template that uses it (such as Template:IPA). If we wanted to make Phonos handle audio files only, then the community might (it's up to them) use it in Template:Audio. In both cases, the editor's knowledge about Phonos seemingly wouldn't matter as it's abstracted into existing templates anyway. So the burden I think is mainly on us to implement the support for it, if we want to. It wouldn't be hard; it's only the design aspect I'm not sure about. Overall I would say it's a stretch-goal or something we can look into after shipping the MVP. If we did it, it would solve https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2022/Multimedia_and_Commons/Audio_links_that_play_on_click after all!

Yeah, so let's do it! It seems like we should be able to go off of the existing designs at T309613 to make it work, but there's still some shuffling around of code and other things that need doing, so I think it should at least be a separate ticket. I don't know if it's better to make @Samwilson aware of this (having only a play button and no IPA) before or after his work, in case it changes the implementation in a significant way.

I don't want to do too much more for this task, as we're already in "merge conflict" territory with T309613.

Making |ipa= optional sounds like a good idea.

I've had a go at updating https://www.mediawiki.org/wiki/Extension:Phonos#Usage to show all planned parameters, to try to make sense of the different states.

I don't think it adds too much work to do this.

Hurray!!!! Another wish?! And not much overhead?! Gee whiskers!

Macro ayyyy:

I don't want to do too much more for this task, as we're already in "merge conflict" territory with T309613.

Let's def make it another task. Here's a stub if a more technical person wants to fill it out! I'm sure there's a way better way to scope the engineering of all that T314834: Make ipa optional inside of Phonos

If the template is invalid, it stills shows the red file link.

This I wanted to ask about as I'm not sure what you mean. Which template are we referring to, or did you mean the {{#phonos}} parser function itself? Invalid use of the parser function came up in code review. In general, I wouldn't worry about invalid syntax, if that's the concern, since the parser will make this obvious to the editor. I.e. it's very easy to make MediaWiki do funny things and show broken code, etc., if you don't use the right syntax, and this parser function is no different. I think we can assume editors will follow directions.

I mean something like {{#phonos:ipa=|file=does-not-exist.ogg}}. This only shows the red link (see below). Sorry, I wasn't very clear.

invalid_phonos_file.png (183ร—376 px, 13 KB)

I don't think I have anymore testing to do here. I will do more testing as part of T309613.

I have tested that the phonos template can play various audio files in different formats, locally and from commons.

Test environment: local docker Phonos 0.1.0 (473457b) 19:54, 8 August 2022.
Test browsers: Firefox 91, Chromium 87.

MusikAnimal set the point value for this task to 3.

Moving to done as per the action item from the August 9 check-in.