- #WORDPRESS CHANGE THEME POEDIT HOW TO#
- #WORDPRESS CHANGE THEME POEDIT SOFTWARE#
- #WORDPRESS CHANGE THEME POEDIT CODE#
- #WORDPRESS CHANGE THEME POEDIT WINDOWS#
The first is an underscore with “e” which is used when you want to echo the text at the same time. What we do with all texts is putting them inside one of WordPress’ gettext-functions, which most commonly are _e() or _(). Nothing is more annoying than using a theme or plugin where the author hard coded texts making it impossible to translate or change in any way. It’s good practice to make sure we cover absolutely all texts.
#WORDPRESS CHANGE THEME POEDIT CODE#
The next step is going through all our code and find any text output that should be translatable.
![wordpress change theme poedit wordpress change theme poedit](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/13009995862/original/Poedit.jpg)
If WordPress doesn’t find the folder nor the correct translation files, it will default back to the texts we have in theme. We defined them to reside in a subfolder ‘ lang‘ in our theme directory.ĭon’t worry if this folder doesn’t exist or doesn’t contain any files – nothing will crash. The second argument tells WordPress where the translation files are. You will repeat this handle every time you make a text translatable. The first argument is the handle, this is an unique string which you will use to group up all texts that belongs to your theme. In case you forgot, this is what we added: load_theme_textdomain('wptutorial', get_stylesheet_directory(). We have already done the first part in the previous step of this theme tutorial series, where we added load_theme_textdomain in our theme’s setup function. If you are interested in the topic, WordPress Codex has a long and good documentation guide on i18n for developers. But it can also be utilized for changing certain texts to something different within the same language. This is very useful for people who want to use WordPress and your theme (or plugin) in a different language than the origin language it was written in (which is usually English). Inside your theme (or plugin) you can add files of a certain filetype for each translated language, or make sure other people are able to create their own translation in their own language. These functions make it so that WordPress is able to pick these up and inject a translation if it exists. The way it works is that you as a theme author or plugin developer wrap all your texts (such as “Read more”, “No posts”) in certain functions.
![wordpress change theme poedit wordpress change theme poedit](https://www.webfulcreations.com/wp-content/uploads/2018/01/saving-translation-file-into-wordpress.png)
This is called internationalization (i18n in short), and allows people to translate texts you add in your theme into another language. Why bother with adding translation support?Īll themes, at least ones that goes public for use of other people than the developer, should be available for translation.
#WORDPRESS CHANGE THEME POEDIT HOW TO#
We will also learn how to set up PoEdit properly to create a translation file for our theme, ready to be translated into different languages.
![wordpress change theme poedit wordpress change theme poedit](https://www.templatemonster.com/help/wp-content/uploads/2013/04/how_to_add_theme_localization_in_WordPress5.jpg)
The same translation principle applies to WordPress Plugins as well.In this lesson we learn about how translation (or otherwise known as i18n) in WordPress works and how to make the necessary adjustments in our templates. This skill is valuable if you want to adapt your website to your local language. Now you know how to translate your WordPress theme using Poedit translations editor. Open up wp-config.php file (it is located in your WordPress installation) and add the following line:ĭefine ('WPLANG', 'ZZZ'), where ZZZ is the name of the file you have used to save your translation ( lt_LT in this example): Refer to this tutorial on how to upload files to your account. The directory should look similar to public_html/wp-content/themes/THEMEXXX/lang, where THEMEXXX is the name of your WordPress theme. mo file ( lt_LT.mo was generated automatically by Poedit) to the corresponding directory on your hosting account. po file you have saved in step 2 ( lt_LT.po in this example) and. Step 3 - Changing Your WordPress Website Language Once you have translated your theme, save the file ( lt_LT in this example) in the same directory as the original template: In the Translation section enter a desired translation of the source string:
![wordpress change theme poedit wordpress change theme poedit](https://codeytek.com/wp-content/uploads/2020/07/image.png)
Highlight any string you want to translate: You are ready to translate your theme now. Next, from a dropdown menu select a language you want to translate your theme to: A Theme’s default translation template is located in THEMEXXX/lang/YYY.po, where THEMEXXX is the name of your theme and YYY – default language of the theme ( twentysixteen/lang/en_EN.po in this example): Open Poedit and select Create new translation:Ī new window will pop up, select WordPress theme you want to translate. Step 1 - Opening Your Theme’s Default Language Template
#WORDPRESS CHANGE THEME POEDIT WINDOWS#
Poedit is available on OS X and Windows and can be downloaded from here.