symfony/demo

Modal dropdown menue

Opened this issue · 5 comments

Hi to everyone,

I translated my project with the same method as this demo project and I can't get the dropdown and modal to choose the language. I think it's because of the assets, the way I installed them in my project. The paths with the translated pages work. Whenever I go to /en or /fr, English and français appear in the "Choose your language" section of the menu. What packages do I need to install to make the dropdown, modal, ... work? Can someone help me with this. Here is the code generated by Symfony regarding the dropdown:

  • --   |   |   | English   |   | menu.choose_language   |   |     |
      |
      |
      |
      |

      | Choose your language   |

      |   | ×   |   |
      |     |
      |   |
      |
      |
      |
      |     |
  • English menu.choose_language
    <div id="locale-selector-modal" class="modal" tabindex="-1" aria-hidden="true">
        <div class="modal-lg modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <p class="modal-title" lang="en">
                                                Choose your language
                    </p>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
    
                <div class="modal-body">
                    <ul class="locales">
                                                                                                            <li class="active " translate="no">
                                <a class="stretched-link" lang="en" hreflang="en" href="[/en/home](https://127.0.0.1:8000/en/home)">
                                    English
                                    <small>en</small>
                                </a>
                            </li>
                                                                                                            <li class=" " translate="no">
                                <a class="stretched-link" lang="fr" hreflang="fr" href="[/fr/home](https://127.0.0.1:8000/fr/home)">
                                    Français
                                    <small>fr</small>
                                </a>
                            </li>
                                                                                                    
                                            </ul>
                </div>
            </div>
        </div>
    </div>
    
                </li>
    
  • Define "make the dropdown, modal, ... work".

    1. The modal does not open on clicking the language selector?
    2. The current language is not selected?
    3. The language selector does nothing when clicking a language?

    Based on the generated HTML and assuming that the assets were copied/loaded correctly, everything seems to be in place for it to work.

    @alexmerlin

    I tried to use the Symfony Demo project as a translation template for another project. I managed to make it work partially in the sense that the pages are translated but the language selection button does not open the modal with the languages. In the code inspector I can see the links with the translation languages ​​for each page on all pages. Is there any documentation to implement the same translation system because I failed to integrate my project into the Symfony Demo project, so I tried to insert the translation from the Symfony Demo project into my project.
    Thank you in advance for your time. Kind regards,

    Is there any documentation to implement the same translation system

    Have you tried with the official translation docs?