Dekoratives Bildchen

Archive for Wordpress

Multi-Language WordPress with xili-language Plugin

I started this blog at first to write about things i have tested or built in my private life. But then VMware and Linux got more and more and i thought it would be could to blog in two languages.

There are many plugins or ways to do this in wordpress and i decided to use xili-language.

This plugin extends the create new post page with a additional window where you can select a language for this post.

beitrag-neu

It is easy to change the default language of your wordpress Blog, but i set it to the prefered language of the browser:

languages-front-end-settings

This was the point where my blog displayed the corresponding posts for the selected language, but i had problems with the widgets on the right side.No language setting took any effect. The widgets were displayed in german.

The change of the sidebar widgets to the special xili-language versions didn’t change anything.

The solution came from the perfect support of the xili dev team. The reason was the preselected german language in wordpress’ wp-config.php.

Änderung in der wp-config.php

[von]define('WPLANG', 'de_DE');

[zu]  define('WPLANG', '');

After that i had to allow xili-language to change the default wp domain and another step was finished.

languages-expert-settings

The xili-language widgets changed now their languages as expected. But the original ones remained english. In the categories widget only the title was translated, but the categories itself didn’t.

For this you need a language file like the one for wordpress itself. This files are located in themes/zeesynergie/includes/lang for my theme.

I created a own local-de_DE.po file and inserted following text. A little later i read that it is normally done in a child theme.

msgid "Hardware"
msgstr "Hardware"

msgid "PC"
msgstr "PC"

msgid "Private"
msgstr "Privat"

msgid "Software"
msgstr "Software"

msgid "Linux"
msgstr "Linux"

msgid "VMware"
msgstr "VMware"

msgid "Recent Comments"
msgstr "Letzte Kommentare"

msgid "Recent Posts"
msgstr "Letzte Beiträge"

msgid "Search"
msgstr "Suchen"

msgid "Log out"
msgstr "Ausloggen"

msgid "Site Admin"
msgstr "Administration"

msgid "Login"
msgstr "Einloggen"

msgid "Entries"
msgstr "Beiträge"

msgid "Comments"
msgstr "Kommentare"

After that you can create the .mo file with following statement

msgfmt -o local-de_DE.mo local-de_DE.po

Now allmost everything will be translated. For the last to steps there is a additional plugin from xili, but i’m used to use a texteditor.

Only the search button and the two links to the feeds resists my translation effords. Before i fix this i wanted to add a menu to change languages manually.

You can add such a menu in the desgin settings under the section menu:

nav-menu

After that i stopped investing more time. There are some things that don’t work till now, but this isn’t very important to me.