In order to have your VamTam theme in а language other than English, please follow the instructions below.
Please note that this guide is about translating the theme into only one language.
See also our guide How to make a Vamtam theme multilingual?
All of our themes are localized using GNU’s ‘gettext’ functionality. This means that each of our themes includes one file (.pot) which contains all of the English terms we have used, this allows our users to only edit one file in order to translate the theme to any language.
Please note that this is the standard WordPress way for translating themes and plugins.
You will find detailеd info here: http://codex.wordpress.org/Translating_WordPress
What you have to do is:
1. Download and install а gettext file editor, like Poedit on your computer.
To download the Poedit please go to this URL http://poedit.net/download.php. Choose between Download for OS X or Download for Windows options.
2. Download a copy of your theme's .pot file to your computer using your FTP program of choice. This file is usually located in the "languages" folder: /yoursite.com/wp-content/themes/vamtam-theme/languages
3. Open the Poedit program and select Create new translation.
4. Choosing the language of the translation, Poedit will automatically create a .po file and will name it with the appropriate language code. You can find all language and country code https://wpastra.com/docs/complete-list-wordpress-locale-codes/
5. To translate the strings in your language just click on a text row and translate each line as required.
- You can set your Poedit to always compile a .mo file when saving changes from Poedit >> Preferences >> on the Editor tab check the Automatically compile .mo file on save box
6. The name of the .mo file is very important. It’s also case sensitive. If it doesn’t match the theme name, language code, and country code it won’t work. Same goes for the define constant in step 2 above.
File naming format should be as follows:
[THEME NAME]-[LANGUAGE CODE]_[COUNTRY CODE].mo
Example: church-event-it_IT.mo
7. Upload the newly translated .po and .mo files in the directory: /yoursite.com/wp-content/languages/themes/church-event-it_IT.mo
- Please note, that if you don't have such a folder in your wp-content directory, you have to create one, following the steps below:
1>Create a new folder called “languages”
2>Go inside that folder and create another folder called “themes”
3>Copy the church-event-it_IT.mo file you set aside earlier into this folder
- Please note that you don't have to delete the .pot file. If you want to translate the theme into another language you will need it.
- The .po file is your editable file which you can always load back up in Poedit and update. If you edit the .po file, you have to generate a new .mo file. Also, replace old .po and .mo files with the new ones in your language folder.
8. Make a change to your WordPress Site Language in Dashboard > Settings > General
Troubleshooting:
1. Assuming you've made all these changes, you should now be able to reload the theme and see it in your native language. If it’s not working, chances are you didn't use the correct naming conventions for your .mo file or in your wp-config.php file. If you see part of your site translated you either didn't translate the entire .po file or the .po file wasn't completely translated correctly in the first place.
2. Please note that the difference between the theme slug and the theme text domain can cause several issues with the translation.
There are two places where the theme textdomain is defined:
- style.css (this is standardized)
- in vamtam/classes/framework.php (the line is different in every theme)
The first one is only used when the theme is not active. The two text domains must match, and they must also be present in every call to a translation function. This means that changing the text domain of a theme/plugin is very time consuming and I would personally advise against that.
How to Update an Older Translation
If you've previously translated an older version of a theme and upgraded your site to the latest version, you’ll notice the translation file no longer works correctly. This is due to the fact that some theme strings have changed and the old .mo language file doesn’t have translations for those strings.
1. Open your old existing .pot file in Poedit
2. Select Catalog >> Update from .pot file from the menu and select your new .pot file from the theme language folder
3. Poedit will show you what text is new and needs to be translated. It should also update any other changes that have been made.
4. After you have translated the new text, save the project, which will generate your new .mo file
5. Overwrite your old .mo and .po file in your wp-content/languages/themes folder. The format should be:
wp-content/languages/themes/THEME-LANG.mo
THEME is the theme textdomain, which is usually the same as the name of the theme's directory. LANG is the language code for your translation. Note the dash separating the two.
6. Make sure you've activated the latest version of the theme (the one that the new language file came with)
*************************************************
So if you've recently purchased a VamTam theme and a language pack file (.mo) is not available for your native language, you should follow the steps above and create your own.
VamTam themes are designed to work with virtually any language so just take the included .pot file and translate away.
Make sure to contact us and send a copy so others can download your language pack. You will get full credit for the work and a link back to your site in return.
How to translate the plugins
Important:
Upload the newly translated .po and .mo files in the directory: /yoursite.com/wp-content/languages/plugins/the-events-calendar-it_IT.mo