DEV Community

Cover image for Announcing Language Switcher for Transposh plugin
codingfix
codingfix

Posted on • Originally published at codingfix.com

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 the dashboard those annoying invitations to rating LOL).

Thank you all for reading.

Good coding!

Sincerely,
Marco Gasi by Codingfix

Top comments (0)