Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    marketplace-mod

    How to switch the language in the administration at the Shopware

    In this blog, you are going to learn “How to switch the language in the administration at Shopware.”
    I hope you know the directory structure of Shopware 6 plugin, if you don’t know, see here- https://docs.shopware.com/en/shopware-platform-dev-en/internals/directory-structure.

    If you change the content language in the so-called language switch, every listing or detail page will update and use that new language to display and edit content. To make sure your custom entity supports translations, look at overview of translations in the DAL

    In order to change the language in an administration listing, you will have to add the language switch component to your smart bar.

    The slot is used to place the language switch in the same place on all pages according to Shopware conventions. Firstly, not all components are translatable. Additionally, pages do not know how to handle language switching themselves. Thelanguage switch triggers the language change. Every request afterward will then use the new language. So, as our content is not automatically reloaded by default on switching the language, you will have to listen to the change event.

    listing page

    detail page

    This will reload the active entity on a detail page. Be aware, you may lose data here. To prevent data loss, a modal will give you the opportunity to save unsaved changes, while switching the language.

    This component displays a short info text about the currently selected language and its impacts on the current entity.

    create page

    On a creation page, there is nothing to reload. It is common to re-use the editing page for creation, but you have to make sure that you don’t do it while creating. 

    When you create a new entry using a different language than the system default language, you have to switch back to it for the creation process.

    The language info differs depending on its entity, so be sure to tell the sw-language-info the component about it.

    I hope it will help you. Thanks for reading. Happy Coding 🙂
    Thank You.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close