[ 
https://issues.apache.org/jira/browse/BEAM-14220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17522522#comment-17522522
 ] 

David Huntsperger edited comment on BEAM-14220 at 4/14/22 8:17 PM:
-------------------------------------------------------------------

It looks like there's a problem with the the language switcher logic: 
[https://github.com/apache/beam/blob/master/website/www/site/assets/js/language-switch-v2.js]

If the last selected language (or the default language, which is java) does not 
match the language of the tab, this line hides the code snippet: 
[https://github.com/apache/beam/blob/master/website/www/site/assets/js/language-switch-v2.js#L116]

But that toggling logic is also required to properly display the selected 
language, if other language tabs are present. I suspect that there's going to 
be some non-trivial refactoring required, to get all combinations of language 
tab to work as expected.

The only workaround I can see is to _always_ use all three language tabs (i.e. 
three adjacent highlight shortcodes – java, python, go) whenever you use a 
highlight shortcode. With the current implementation, any time that you leave 
out one of the languages, you could end up in a situation where a user visits a 
page with a different preferred language, and that would cause the other 
language(s) not to be displayed. And that seems unrealistic.


was (Author: pcoet):
It looks like there's a problem with the the language switcher logic: 
[https://github.com/apache/beam/blob/master/website/www/site/assets/js/language-switch-v2.js]

If the last selected language (or the default language, which is java) does not 
match the language of the tab, this line hides the code snippet: 
[https://github.com/apache/beam/blob/master/website/www/site/assets/js/language-switch-v2.js#L116]

But that toggling logic is also required to properly display the selected 
language, if other language tabs are present. I suspect that there's going to 
be some non-trivial refactoring required, to get all combinations of language 
tab to work as expected.

 

> Code snippets are completely hidden on pages with code snippets for just one 
> language
> -------------------------------------------------------------------------------------
>
>                 Key: BEAM-14220
>                 URL: https://issues.apache.org/jira/browse/BEAM-14220
>             Project: Beam
>          Issue Type: Bug
>          Components: website
>            Reporter: Brian Hulette
>            Assignee: David Huntsperger
>            Priority: P2
>
> The Java/Python/Go toggle is preserved between pages. Some pages, like the 
> DataFrame API Overview (BEAM-13371), and [Python type hint 
> guidance|https://lists.apache.org/thread/t1fonotpj6nzllwx5m9ykmrxpy9hqd1n] 
> only have a single language, and if the toggle is stuck on a different 
> language, the code snippets are completely hidden.
> A workaround is to go to a page with other languages, like the [Programming 
> Guide|https://beam.apache.org/documentation/programming-guide/], and select 
> the appropriate language, then navigate back.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to