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

Lang attribute on AV embed endpoint #3342

Closed
1 task done
pjlee11 opened this issue Aug 22, 2019 · 10 comments · Fixed by #4112
Closed
1 task done

Lang attribute on AV embed endpoint #3342

pjlee11 opened this issue Aug 22, 2019 · 10 comments · Fixed by #4112
Assignees
Labels
articles-av-epic Current focus for the articles features stream ws-articles Tasks for the WS Articles Team ws-media World Service Media

Comments

@pjlee11
Copy link

pjlee11 commented Aug 22, 2019

Is your feature request related to a problem? Please describe.
In the Mozart page templates for the /ws/* media embed endpoints we currently have <html lang="en"> hardcoded. We need to be able to set the lang attribute on the embed endpoint based on parameters in the request URL. This is needed so we can set the lang based on the current language of the service, page or block.

Any changes made to the /ws/av_embeds_media template should also be made to /ws/av_embeds_articles template. It is also worth evaluating if the 2 different payload could share a unified template < not possible.

Describe the solution you'd like
Edit the lang attribute in the Mozart page template so that it can be defined in the request URL.

Describe alternatives you've considered
If it is not possible to use the request URL to vary the lang then we will need to create a template for each service.

Testing notes
We will want to make sure that the relevant lang code is returned as expected when visiting ws sites.

Media liveradio AV embed URLs
https://www.test.bbc.com/ws/av-embeds/media/bbc_korean_radio/liveradio should have lang="ko"
https://www.test.bbc.com/ws/av-embeds/media/bbc_indonesia_radio/liveradio should have lang="id"
https://www.test.bbc.com/ws/av-embeds/media/bbc_tigrinya_radio/liveradio should have lang="ti"
https://www.test.bbc.com/ws/av-embeds/media/bbc_amharic_radio/liveradio should have lang="am"
https://www.test.bbc.com/ws/av-embeds/media/bbc_afaanoromoo_radio/liveradio should have lang="om"

Articles AV embed URLs
https://www.test.bbc.com/ws/av-embeds/articles/c3wmq4d1y3wo/p01kdbnv should have lang="en-gb"
https://www.test.bbc.com/ws/av-embeds/articles/c3wmq4d1y3wo/p01k6msp should have lang="en-gb"

  • This feature is expected to need manual testing.

Additional context
Add any other context or screenshots about the feature request here.

@pjlee11 pjlee11 added Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. ws-articles Tasks for the WS Articles Team ws-media World Service Media ws-media- LiveRadioV1 labels Aug 22, 2019
@12 12 added the articles-av-epic Current focus for the articles features stream label Aug 22, 2019
@jamesbrumpton jamesbrumpton removed the Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. label Aug 23, 2019
@pjlee11
Copy link
Author

pjlee11 commented Aug 28, 2019

It looks like we can use the request.language as {{language}}

We should check that these values are the write lang values we would expect.

@LilyL0u
Copy link
Contributor

LilyL0u commented Sep 2, 2019

Just to check I will be testing this correctly, do I just need to check that the 'html lang="en"' changes to the appropriate language e.g lang="ko" @pjlee11

UNADJUSTEDNONRAW_mini_8

@pjlee11
Copy link
Author

pjlee11 commented Sep 2, 2019

@LilyL0u correct, just checking they match the correct lang for the service

@ryanmccombe ryanmccombe self-assigned this Sep 4, 2019
@LilyL0u LilyL0u closed this as completed Sep 4, 2019
@LilyL0u LilyL0u reopened this Sep 4, 2019
@LilyL0u
Copy link
Contributor

LilyL0u commented Sep 4, 2019

Sorry I accidentally closed and reopened the issue, because I thought the button just closed the window with the issue open in 🙈

@ryanmccombe
Copy link
Contributor

We can't use request.language, as that comes from the following steps in mozart:

  • Get the product from the first part of the URL
  • Map the product to a language

This does not work for our embed URLs, as they do not contain the product. Mozart believes the product is "ws" because that is the first part of the URL

We can implement an alternative method for the live radio URLs, as they have the service ID, and the product can be mapped from that, eg, bbc_indonesian_radio => indonesia

However, the articles URLs, and our proposed URLs for future page types, do not have enough information to determine the language / product.

Article URLs are in the format: /ws/av-embeds/articles/:ares_id/:vpid/?:amp?

Possibly need a discussion on how to move forward with this

@ryanmccombe
Copy link
Contributor

Blocked based on discussion with article pod - it's possible we don't do this ticket at all - waiting for confirmation

@ryanmccombe ryanmccombe added the blocked This issue should not be worked on until another internal issue is completed - see desc for details label Sep 5, 2019
@ryanmccombe
Copy link
Contributor

Unassigning from me as it is mostly down to articles if they want to change their URLs

Note Mozart does seem to accept query strings - to get lang from the request query string in Mozart routing:

Rack::Utils.parse_nested_query(@request.query_string)['lang'] || 'en'

If this value is added to the payload, eg, under the language key, it can then be used in mozart page config:

<html lang="{{language}}">

@pjlee11
Copy link
Author

pjlee11 commented Sep 6, 2019

SMP itself produces an iframe which currently doesn't provide a lang attribute. We could potentially move forward without a lang attribute in the Mozart template

@jamesdonoh jamesdonoh removed the blocked This issue should not be worked on until another internal issue is completed - see desc for details label Sep 12, 2019
@jamesdonoh
Copy link
Contributor

Next steps are to a11y test this to assess the actual impact on AT.

@ryanmccombe ryanmccombe removed their assignment Sep 13, 2019
@ryanmccombe ryanmccombe added the blocked This issue should not be worked on until another internal issue is completed - see desc for details label Sep 13, 2019
@pjlee11
Copy link
Author

pjlee11 commented Sep 20, 2019

Update: as per #3877 we have removed the hardcoded lang attribute from the <html> element of the embed page. This was decided as we effectively have the following in Simorgh:

<html lang='{{service_lang}}'>
  ...
  <iframe>
    <html> // AV embed created by Mozart
      <div>
        <iframe /> // SMP instance
      </div>
    </html>
  </iframe>
</html>

AFAICT from Googling iframes are considered entirely seperate documents and therefore would need to specify the lang themselves. Therefore having lang in the embed only sets it for the single <div> before the next <iframe> (SMP) which currently doesn't support passing a lang.

If we find that the a11y test for this doesn't have any errors I propose closing this Issue as won't fix.

@pjlee11 pjlee11 removed the blocked This issue should not be worked on until another internal issue is completed - see desc for details label Oct 1, 2019
@pjlee11 pjlee11 self-assigned this Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
articles-av-epic Current focus for the articles features stream ws-articles Tasks for the WS Articles Team ws-media World Service Media
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants