Announcing Language Switcher for Transposh plugin

As many other developers, when I discovered Transposh plugin I immediately fell in love with it! It allows automatic translations out of the box but it also gives you a granular control on the translated text, allowing you to edit every single phrase.
Okay, you already know that so it’s not necessary for me to repeat here why we all love Transposh so much.

But I have to confess something: I was not happy with the language switcher widget. I develop small websites and usually I need to use from 2 to 4 different languages. Building non-WordPress websites, I used to put just some flag in the main navigation menu and wished I could do the same using WOrdPress and Transposh.

The artisan way

At first, to get that result, I used a couple of useful plugins and just a bit of javascript.

I won’t waste your time here to talk about this: if you’re interested you can find a detailed description here and here

 

 

The WordPress way

The “artisan way” was absolutely boring to me: for each new website I had to repeat every step just to get 2 or 3 flags in my menu. I wanted to get my flags just installing a plugin and maybe adjusting some settings… But that plugin didn’t exist, so I finally decided I had to go beyond my limits, meet the challenge head-on and create my own plugin.

Today I’m proud to present Language Switcher for Transposh. It’s not magic, it doesn’t do miracles but it gets the job done.

I’m very grateful to Ofer, who invited me to present my little creature in his blog: thank you, Ofer, for your kindness, I really appreciate this opportunity to let Language Switcher for Transposh be known.

So, what Language Switcher for Transposh actually does?

  • it reads Transposh settings and gets the list of languages used in the current website
  • it reads all menu locations available in the current theme and allows you to choose where the language switcher will show up through simple checkboxes
  • it allows you to add at the end of the chosen menu(s) a series of flags or a dropdown menu to select the language; Administrators, Authors and Editors will see an Edit translation button too which will allow them to activate the Transposh Translation Editor
  • if you choose to use only flags, it allows you to choose between Transposh flags or flags provided by Language Switcher for Transposh itself
  • if you choose to use a dropdown you can choose if using a select or an unordered list to build your dropdown: I added this option because unordered list give you much more options to customize their look and feel than a select
  • if you use an unordered list as dropdown, you can choose if the list items will show flag only, text only or both flags and text
  • it allows you set additional classes for your language switcher menu items: this allows you to make it look accordingly to your theme style using the same class your theme is using for navigation menu items
  • it allows you to totally customize your language switcher using a css editor with syntax highlighting: current stylesheet is loaded in the editor and you can just modify it and then save it or you can even create a totally new css file. with a custom name (it defaults to custom.css)

What about the future?

I already have a TODO list to add more features and maybe to create even a premium version, but I think that Language Switcher for Transposh will make your life easier in this first release already. Or at least, this is what I very much hope!

You can find Language Switcher for Transposh in WordPress.org website (or just searching for “transposh” in the admin dashboard of your WordPress installation): give it a try and feel free to contact me for any issues you can get into. And obviously, if you like it, don’t forget to give it some star (I still didn’t learn how to put in hte dashboard those annoying invitations to rating LOL).

Thank you all for reading.

Good coding!

Sincerely,
Marco Gasi by Codingfix

17 thoughts on “Announcing Language Switcher for Transposh plugin”

  1. Hi Marco,

    I tried to install Language Switcher for Transposh and I have an issue for the english language.
    If I click on the english flag your plugin create a bad link, instead of domain.com/en/ it makes domain.com/en/in/ and I have a 404 error.
    Where can I setup the link?

    Thank you

    1. Hi Laurent. Thank you for using my plugin. But the issue you’re talking about is strange indeed. I have the plugin setup and running on several websites and I’ve never found such an issue… Is your permalinks set to %post%?
      Actually there is no need nor way to setup links within my plugin settings: this kind of stuff is managed by WordPress Permalinks settings and by Transposh settings.
      Can you you give me a link to the live page where you get the issue?

    1. I see that the link is setup properly: just hover the mouse over the english flag and look the link which appears at the very bottom left of the window. Or open your browser’s dev tools and inspect the element: you’ll see the link is set to https://maltavela.com/en. So something is happening in Permalinks settings or in Transposh settings (or even somewhere else, as far as I know). If you want to give me access to your dashboard maybe I can help you. You can use the form in this website Contact page to send me my user credentials.
      Cheers

  2. Hello Simona.
    I can only tell to you what I told to Laurent: probably you have to check your permalinks settings. I’ve just seen that Laurent has solved his issue (check his wensite https://maltavela.com/) so I think he had managed permalinks settings.
    If you can post the url to your website, I can take a look. If you need more help, you’ll have to create a user account and give me access to your WP dashboard. If you want, you can use the form in my Contacts page to send me username and password ro you can send me an email to codingfix@codingfix.com

  3. hello, first of all, thank you so much for bring us such a great plugin, it helps us a lot to build a multi-language sites. it is so wonderful.
    but i have noticed that when i use yoast SEO plugin. i found a problem here. the description text will be translated to another language.
    and it did also to the short url too.
    example: view-source:https://www.tatoltool.com/hi/distinguish-between-an-electric-traditional-drillimpact-drill-and-hammer-drill/

    why? please help me out .
    Thank you again for your such great plugin.
    Regards
    Andrerw

    1. Hello Andrew. First of all, thank you for your kind words 🙂 Unfortunately I can’t help you with translations issues. My plugin is not Transposh but Language Switcher for Transposh, that is the simple and far to be perfect plugin to display flags or dropdowns to allow users to change language in the front-end. Actually, translations are managed by Transposh Translation Filter which currently is no more hosted on WordPress Plugins Repository. You can visit the officlai website at http://transposh.org/ and ask for help directly to the aithor of the plugin, Ofer Wald is a very kind person and I’m sure he’ll try to help you.
      Best regards

  4. Hi Andrew,
    Thanks for the very useful plugin. While am debugging a site that gives an 500 error, I stumbled across this error message:

    [28-Nov-2022 15:08:24 UTC] PHP Warning: file_get_contents(https://cas-amsterdam.nl/wp-content/plugins/language-switcher-for-transposh//assets/styles/): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
    in /home/casrooseboom/domains/cas-amsterdam.nl/public_html/wp-content/plugins/language-switcher-for-transposh/admin/class-cfx-language-switcher-for-transposh-admin.php on line 166

    Line 166:
    $css = file_get_contents(LSFT_PLUGIN_URL . “/assets/styles/$stylesheet”);
    I never tinkered with the rights on folders or files. Any ideas?

    Thanks in advance!

    kr,
    Anton

    1. Hello Anton.
      I’m Marco, Andrew is another user LOL. No problem.
      I’ve just uploaded a fix to the WP repo: it should be available for download in minutes. Feel free to contact me if something goes wong with the update

      1. Oops…. almost! new error:
        [28-Nov-2022 16:33:35 UTC] PHP Notice: Undefined variable: bestlang in /home/casrooseboom/domains/cas-amsterdam.nl/public_html/wp-content/plugins/transposh-translation-filter-for-wordpress/transposh.php on line 651

        1. Hello Anton. First, let me apologize for taking so long to reply to you… I’m very busy, and I often just mess emails 🙁 Anyway, That issue is related to Transposh plugin itself, not with my Language Switcher so I can’t help you. You should try to contact the author at https://transposh.org

  5. Hi Marco! Nice to meet you 😉

    No more errors in the debug log, so that is solved neatly.
    I hope it was related with the 500 error!
    (Intermittent error so not 100% sure yet…)

    Thanks
    Anton

  6. Hello,

    I discovered last update of this nice plugin has a bug when selecting Native dropdown (select), which is the Switcher Type I use. Probably because uncompatible with WP 6.2.

    On the switcher I select a language different from the default and nothing happens. I mean that the name of the selected language is visible, but the translated page into the new language is not seen. Rather than that, the default one is kept on the screen. However if I select Flags for Switcher type, then it works properly.

    Thank you for your support.

    Regards,
    Jordi

    1. Hello Jordi. Thank you so much to notify me about this bug – and for using my plugin :).
      I’ve just uploaded a fixed update to WP repo. Hope this solve the issue.

Leave a Reply to Laurent Cancel Reply

Your email address will not be published. Required fields are marked *