Problem/Motivation

  • As a visitor of drupal.xx, I can switch the language of the website
  • The language switcher is accessible.
  • As a visitor, I can choose the language of the website with a language picker in the topmenu.
  • As a visitor with a visual or physical impairment, I can easily use the language picker
  • As a visitor, I can easily use the language picker with my reader
  • Proposal: As a site visitor, when I am viewing a page that is unavailable in a different language, then the language picker informs me that the translation is not available (e.g. greyed out and not selectable, or something similar)

Proposed resolution

Implement language switcher as designed in #3557934: Design a language picker for multi language

Remaining tasks

Implement language switcher as designed in #3557934: Design a language picker for multi language

User interface changes

On a website with multiple languages, the language switcher appears.

API changes

/

Data model changes

/

CommentFileSizeAuthor
#2 Drupal website taaloptie.pdf583.21 KBesmoves

Issue fork la_eu-3570122

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

svendecabooter created an issue. See original summary.

esmoves’s picture

StatusFileSize
new583.21 KB

stmh made their first commit to this issue’s fork.

stmh’s picture

Status: Active » Needs review

I implemented a first version. Needs some more testing on different browsers and a review.

stmh’s picture

evilargest made their first commit to this issue’s fork.

evilargest’s picture

When testing the switcher, I faced a problem with the mobile styles applying on the desktop screen, so the switcher was transparent (all white on the white background). I fixed it by removing one selector, and tested on chrome/mozilla/safary afterwards, and it worked as expected. It would be great to hear feedback

evilargest’s picture

Hey @stmh, me and @taran2l discussed the implementation, and two things caught our attention:
- The block is added via a Twig template and is rendered for all websites that have more than one language. However, when a website is about to introduce a new language, but they haven't translated any content on the website, they might want to have a block hidden for a while, which is not possible, as it is not added through the block layout. Also, it might be good to have it in the block layout for the sake of consistency, as all other blocks are added there
- The language block always shows a language on the pages, regardless of the page having a translation for that language or not, which results in a 404 page when trying to switch a language for such a page. In our opinion, hiding the languages on a page that has no translations can make sense.

Can you share your opinion regarding the items above?

stmh’s picture

Hey,

the frontend is structured in a way that I need to "inject" the language switcher into the menu block. From a structural point of view it needs to be there. Using the block layout would require some major frontend refactoring I wanted to avoid.

Regarding the second topic: Afaik that's Drupals standard behaviour or a side effect of injecting the block via the twig function. I'd prefer a different solution, but ran out of time.

taran2l made their first commit to this issue’s fork.

taran2l’s picture

hi @stmh, I went ahead and refactored it a bit.

I was not able to make everything configurable; so the branding block (logo) is hardcoded in the template now, but I think it's OK

Language switcher is disabled by default, as I think that would be the case for most countries.

evilargest’s picture

I've tested the changes, and everything works perfectly locally when the language switcher is enabled.

  • taran2l committed ad2c1d54 on staging authored by stmh
    feat: #3570122 Implement language switcher
    
    By: svendecabooter
    By:...
taran2l’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • taran2l committed ad2c1d54 on 1.0.x authored by stmh
    feat: #3570122 Implement language switcher
    
    By: svendecabooter
    By:...

  • taran2l committed ad2c1d54 on downstream/la_nl authored by stmh
    feat: #3570122 Implement language switcher
    
    By: svendecabooter
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.