jQuery Template – Simple templating solution Conditional Tags for Menus & Widgets
Development     PHP     WordPress    

Mix languages in a WordPress post / pages with a simple shortcode and gettext

17. May 2015

In a current project I am using pages as templates, to load content into specific containers on the website. The website will be using up to 15 different languages.

The main language setup is done through WPML, which creates linked content per language. This helps, as some languages will fail terribly when translating them through a pure gettext setup, as the words setup is often completely different.

But there is always static stuff that can be translated directly through the language files. For that I use a simple shortcode that allows me to keep the native language as a basis in all linked content. Easier to move around, as I can actually read and understand it 🙂

Call the shortcode from the functions.php

The shortcode function itself. This loads the language textdomain from the specified location and translates the string.

How to use it in your post or page content


Leave a Reply

Be the First to Comment!

Notify of