How to change wordpress frontend language, update translations or translate themes Wordpress is a very nice blogging solution but does not really allow to create and publish multilingual blogs out of the box. The good news is that it allows you to set the language for frontend so that users see localized messages.
Writing wordpress posts in your chosen language is one thing but then you make sure buttons, error messages and other labels are translated. This is where gettext and translation files step in.
To host your website in foreign language you have to add translation files to your theme and set proper language in the
wp-config.php
Then set language in that file to selected language like this:
define ('WPLANG', 'pl_PL');
Language files should be in:
wp-content/themes/nazwathemu/languages
Files with .po extension are source translation files. You have to create your language by copying default.pot. Then edit the file to set all translations.
#: Arjuna-X/archive.php:77 #: Arjuna-X/index.php:64 #: Arjuna-X/search.php:59 msgid "Newer Entries" msgstr ""
becomes
#: Arjuna-X/archive.php:77 #: Arjuna-X/index.php:64 #: Arjuna-X/search.php:59 msgid "Newer Entries" msgstr "Nowsze"
At the end you have to compile the translation file to .mo file. Wordpress (and other applications that use gettext files for internationalisation) use .mo files. These files are optimised for performance and have no useless comments and white spaces.
To compile language translations run this command:
msgfmt -v pl_PL.pot -o pl_PL.mo
where pl_PL.pot is a wordpress source translation file you created or modified and pl_PL.mo is a ready to use translation file.
hope it helps someone
Comments
Wielkie dzięki za tego posta!
Wielkie dzięki za tego posta! Dzięki niemu ogarnąłem swoje tłumaczenie! Pozdrawiam! :)
Post new comment