FAQs: Languages & Translation
You have the ability to translate the WordPress FAQ plugin in your preferred language. The translation process is rather simple and the only mandatory requirement is that you fluently understand English and another language. This article will guide you through the process if translating the WordPress FAQ plugin using an application called poEdit.
- Albanian (sq_AL) translation BY Visar Uruqi.
- Dutch (nl_NL) translation BY Jackey van Melis.
- German (de_DE) translation BY Holger Tempel.
- Spanish (es_ES) translation BY Juan Llamosas.
- Italian (it_IT) translation BY Johnny Pixel.
- Romanian (ro_RO) translation BY Richard Vencu.
You can follow the technical steps below, using poEdit to translate but alternatively you can use a WordPress plugin called Codestyling Localization with a visual interface and a more user-friendly experience.
Before you can get started, you’ll need to open the poEdit application on your computer. If you don’t have poEdit, you can download and install it for your platform.
Open/Create Catalog File
The WordPress FAQs plugin is distributed with a default, English catalog file named ‘wp-faq-en_US.po’ inside ‘wp-faq/languages’. You may open this file with poEdit and save a copy so that you can start translating immediately. If you open the existing catalog file, all the strings will be available for translation immediately.
Alternatively, you can create a new catalog file though by choosing ‘File’ > ‘New Catalog…’ inside the poEdit application.
Fill in the project information such as the plugin name, your team name, your preferred language, your country, charset, etc. These values under the ‘Project Info‘ tab can be anything you wish them to be.
Under the ‘Paths‘ tab, you’ll need to fill in “.” as the base path and under the paths, you’ll need to create a new path and fill in “..”. This indicates that the PHP files are in the upper/parent directory (one directory up) of the one the language file will be located in.
Create 2 keywords under the ‘Keywords‘ tab. The one is 2 underscores “__” and the other one is underscore and the letter ‘e‘ which makes “_e“. These will always remain the same since they are inside the code.
With that done, click the ‘Ok’ button so that poEdit can allow you to save the catalog file. Save the file with the filename ‘wp-faq-xx_XX.po’ where the “xx_XX” part should be replaced with your language code, followed by an underscore and then your country/region code, such as en_US (US English), en_UK (UK English), nl_NL (Dutch), zh_TW (Traditional Chinese for Taiwan), es_ES (Spanish), se_SE (Swedish), etc.
Save it inside the ‘wp-faq/languages’ directory/folder of the plugin. You will notice that it immediately saves a .MO file (which is the actual language file) as well. The .PO file is just the catalog file and it is not used by the plugin through WordPress. Be sure to keep the .PO catalog file for future changes though.
Once you save the catalog file, poEdit will start scanning the PHP files recursively in the upper/parent directory (the ‘wp-faq’ folder) for words/phrases encapsulated by __() or _e() so that they can be translated.
Whether you chose to open the existing catalog file or create a new one in Step 2, the words and phrases inside the WordPress FAQs plugin should now be in front of you, ready to be translated. You’ll need to type the translated string (in your language) in the box below the box which shows the English string.
Set your WPLANG locale
The locale will be your language code, followed by an underscore “_” and then your country/region code such as en_US (US English), en_UK (UK English), de_DE (German in Germany), nl_NL (Dutch in the Netherlands), zh_TW (Traditional Chinese for Taiwan), es_ES (Spanish), se_SE (Swedish), etc.
Be sure that you saved your catalog file (.PO) and your language file (.MO) as ‘wp-faq-xx_XX‘ inside ‘wp-faq/languages/‘ where the “xx_XX” part in the filename should be replaced by your locale which you also define here in the configuration file.
4.1. Single WordPress Site
Open up your WordPress configuration file named ‘wp-config.php‘ and fill in your locale as the value for the WPLANG defined constant.
4.2. WordPress Multi-Site Network
When running a multi-site network, the WPLANG constant has to be set for each site individually on the network.
Go to ‘Network Admin‘ then go to ‘Sites‘ where you manage all your network sites and under the specific site for which you want to set the locale, click the ‘Edit‘ link.
Navigate to the ‘Settings‘ tab while editing the specific site and you’ll see a very long list of configuration settings. Find the ‘WPLANG‘ setting where you will fill in your locale and then save the settings again.
Translate with mqTranslate / WPML
2. Add the languages in the mqTranslate /WMPL plugin settings that you want to use on your website
3. Flags will be added under different areas of the faq plugin. You will be able to add a different languages per section under the language flags as display below: