I AM LISTENING TO
|
WAS ICH LIEBE
  • Englisch
  • Deutsch

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

17. Mai 2015




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

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

 




Abonnieren
Benachrichtige mich bei
guest
0 Comments
Inline Feedbacks
View all comments



Alexander

Ich bin ein Full-Stack-Entwickler. Meine Expertise umfasst:

  • Server-, Netzwerk- und Hosting-Umgebungen
  • Datenmodellierung / Import / Export
  • Geschäftslogik
  • API Layer / Action Layer / MVC
  • Benutzeroberflächen
  • User Experience
  • Verständnis für Kundenwünsche und Geschäftsbedürfnisse

 

Ich liebe die Entwicklung, das Design und kenne mich auch mit Serverarchitekturen aus.  Ich würde mich nie vollständig fühlen, wenn einer der Bereiche fehlen würde.

Ich habe ein breites Interessengebiet, deshalb tauche ich ständig in neue Technologien ein und erweitere mein Wissen, wo immer es nötig ist. Die Technologien entwickeln sich schnell und ich genieße es, die neuesten Technologien zu nutzen.

Abgesehen davon bin ich ein friedliebender Kerl, der versucht, Leute um sich herum zu haben, die dasselbe denken.  Ich glaube wirklich an das Prinzip: "Wenn man jemandem hilft, wird einem jemand helfen, wenn man es braucht."

Previous Next