• Hi,
    I have a blog for which only a few posts are translated in several languages. I want to display the mlang-menu only on posts with contents in several languages, and only with the relevant languages.
    It somehow works if I put this in the post itself (html view):

    <script type="text/javascript" src="https://localhost/wordpress/wp-content/plugins/mlanguage/mlanguage.js?ver=3.0.5"></script>
    <a class="mlang-menu-link" href="/" data-lang="en">
    <img class="mlang-menu-image" style="outline: medium none;" src="https://localhost/wordpress/wp-content/plugins/mlanguage/img/den.png" alt="English" />
    </a>
    <a class="mlang-menu-link mlang-active" href="/" data-lang="fr">
    <img class="mlang-menu-image" style="outline: medium none;" src="https://localhost/wordpress/wp-content/plugins/mlanguage/img/fr.png" alt="fran?ais" />
    </a>

    HOWEVER, when you first go to the web site, if you click very rapidly to the language button, it goes to the root page of the website (here, to: https://localhost/).
    Maybe it is because the mlanguage.js is not loaded yet.
    If you wait or have already loaded mlanguage.js, then it works (until you clear the cache).
    Any hint on how to solve this?
    Thanks!
    PS: a bonus would be to have a short code instead of the above html code.

    https://www.ads-software.com/extend/plugins/mlanguage/

Viewing 1 replies (of 1 total)
  • Thread Starter mayeulk

    (@mayeulk)

    Hi,
    Putting an anchor as the destination of the href somehow works (flag is inneffective until js is loaded).

    <script type="text/javascript" src="https://localhost/wordpress/wp-content/plugins/mlanguage/mlanguage.js?ver=3.0.5"></script>
    
    <a data-lang="en" href="#change_language" class="mlang-menu-link"><img alt="English" src="https://localhost/wordpress/wp-content/plugins/mlanguage/img/den.png" style="outline: medium none;" class="mlang-menu-image"/></a>  <a data-lang="fr" href="#change_language" class="mlang-menu-link mlang-active"><img alt="fran?ais" src="https://localhost/wordpress/wp-content/plugins/mlanguage/img/fr.png" style="outline: medium none;" class="mlang-menu-image"/></a>

    However, I needed to disable to disable visual editor to avoid WP to strip the <script> tag. I solved this installing the “Enhanced Text Widget” plugin and putting the <script> in such a text widget.

    (Note: I do not want to modify the templates)

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: mLanguage] Optional mlang-menu’ is closed to new replies.