Custom Fields: Languages & Translation

You can easily translate the entire WordPress Custom Fields plugin with all its words and phrases into your own preferred language.

Current Languages

Translation Instructions

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.

1. Open poEdit

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.

2. Open/Create Catalog File

The WordPress Custom Fields plugin is distributed with a default, English catalog file named ‘wp-fields-en_US.po‘ inside ‘wp-fields/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.

2.1. Create a new catalog

Alternatively, you can create a new catalog file though by choosing ‘File‘ > ‘New Catalog…‘ inside the poEdit application.

click to enlarge

2.2. Project Info

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.

click to enlarge

2.3. Paths

Under the ‘Paths’ tab, you’ll need to fill in “.” (dot) as the base path and under the paths, you’ll need to create a new path and also fill in “..” (two dots). 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.

click to enlarge

2.4. Keywords

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.

click to enlarge

2.5. Save Catalog File

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-fields-xx_XX.po‘ where the “xx_XX” part should be replaced with your language code or locale, 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-checkout/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.

click to enlarge

Once you save the catalog file, poEdit will start scanning the PHP files recursively in the upper/parent directory (the ‘wp-checkout‘ folder) for words/phrases encapsulated by __() or _e() so that they can be translated.

3. Translate Words/Phrases

Whether you chose to open the existing catalog file or create a new one in Step 2, the words and phrases inside the WordPress Custom Fields 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.

click to enlarge

4. 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-fields-xx_XX‘ inside ‘wp-fields/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.

WordPress Plugins

Start selling products, sending newsletters, publishing ads, and more through your own WordPress website using our premium WordPress plugins.


Pin It on Pinterest

%d bloggers like this: