Translating and editing language files (.po and .mo)


Typically each theme/plugin will have its own language file, located in the theme folder languages or lang (ex: /wp-content/themes/kyma-advance/languages/...). There will be at least two files, THEME_TEXT_DOMAIN.po and THEME_TEXT_DOMAIN.mo, these are the main ones. THEME_TEXT_DOMAIN.po - this is a ASCII file (readable text). It's responsible for most of the text displayed on the website. This is the file that will be edited. THEME_TEXT_DOMAIN.mo - this is a binary file (machine readable). This is the actual file used by Osclass and is compiled from the .po file.

Step 1: Download Poedit

While there are several such .po file editors out there, a highly recommended one is Poedit. It's a free cross-platform gettext catalogs (.po files) editor. Download Poedit and install

Step 2: Copy your theme.po file

To edit your THEME_TEXT_DOMAIN.po file, you must first copy the file from language folder to your computer.

Step 3: Run Poedit

Run Poedit and then click File and open theme.po. You should now see a list of strings, along with two separate horizontal window panes down at the bottom of the program, like this: poeditor Now click on file >> New From POT/Po File. add new po file A popup will display. Select the theme.po file from your computer. If you can't see file select Po Translation Files (* .po)  from dropdown. see below screen short. popup Select the file and click open button. popup 2 File will open in your po-editor with a popup to select translation language. select language Select your language from drop down and click to save button. Save the file in your desktop.

Step 4: Edit

To edit a string, within Panel 1, click on the string you wish to edit. You'll then see the string appear in Panel 2. You should not edit the string in Pane 2 (this would also require editing your theme's php files). Instead, click on Panel 3 and type the text you'd like to appear instead. translated string You may continue to edit strings by repeating the above procedure. Once you're done editing, click File > Save.

Step 5: Upload to website

Lastly, you must now upload your .po and.mo file to your theme's language folder language. ex: fr_DJ.po and fr_DJ.mo files That's it! Visit your website and hit "reload" to see the changes.

Share this post:


Leave a Reply

Your email address will not be published. Required fields are marked *