How To Translate Or Localize GeoDirectory

GeoDirectory, by default, comes in English. (en_US)

Our users fully translated GeoDirectory into several languages. If yours is incomplete or you want to edit a language, you can by following the steps in this document.

There are 2 options, creating a translation file or using an existing translation file.

  1. Create a translation file.
  2. Download and install POEdit. Launch it to open this file:

    geodirectory/languages/geodirectory-en_US.po
    	

    Add your translations and once you finish, click File > Compile to MO...

    Change the file name to reflect your Locale (the Locale is a unique code for each language). For example, if your translation is to Italian, the locale is it_IT. 

    The file name should be:

    geodirectory-it_IT.mo
    	

    Here you can find the full list of Locale codes.

    Inside the wp-content folder, create the folder /languages/

    Inside the languages folder, create the folder /plugins/

    Transfer the .mo file via FTP into the newly created folder:

    The complete path should look like this:

    wp-content/languages/plugins/geodirectory-it_IT.mo
    	
  3. Using an existing translation file
  4. Download the desired language file from the GeoDirectory GlotPress page.

    You can download the file as .po file and modify it following point 1 of this doc or download it directly as .mo file, skip editing with POEdit / compiling the mo file, and follow the steps from here.

    If you save the translation file in the wp-content/plugins/geodirectory/languages/ folder, you will lose your translation with each plugin update.

  5. Change WordPress language
  6. From your WordPress dashboard go to Settings > General > Site Language. Change it to your language. WordPress and GeoDirectory will start using the translation files for your language. 

Translating Add-ons

to translate the add-ons the procedure is identical. Only the location of the translation files changes:

They can be downloaded from our website and not from wordpress.org. 

The URL is https://wpgeodirectory.com/translate/projects.

Once you are ready to load your translation file, the path for example for the Location Manager should look like this:

/wp-content/languages/plugins/geodirlocation-en_US.mo

Let's take another example. For the Advanced search add-on the path should look like this:

/wp-content/languages/plugins/geodiradvancesearch-en_US.mo

Translating themes

The translation file for themes is found in the  languages folder of the theme.

When you are ready with the translation file, create the folder /themes/ inside the  wp-content/languages folder

Transfer the .mo file via FTP into the newly created folder:

For example, the complete path for the Directory Starter theme should look like this:

/wp-content/languages/themes/directory-starter-en_US.mo

For the Supreme Directory child theme, the complete path should look like this:

/wp-content/languages/themes/supreme-directory-en_US.mo

Updating Translations

sometimes a new release comes out with new features and in some cases, these new features require new text strings.

When this happens, you'll need to merge your translated PO file with the new language file provided with the update.

To do so, you need to have both files on your desktop. For example: 

geodirectory-it_IT.po (your translated PO file)
&
geodirectory-en_US.po (the new translation file shipped with the plugin update)

Open the first file (geodirectory-it_IT.po) with POEdit 

From the PoEdit menu, click Catalogue and then Update from POT file…

This will not find the PO file, so use the file type option to look for PO files.
Browse to the new PO file (geodirectory-en_US.po) and press the open button.
That will merge the new language strings with your translated file. Make any changes as required, save and upload the new MO file with updated translation in the wp-content/languages/plugins folder.    

POEdit
Use POEdit's built in tools like the 'Find' tool to find the string you want to change.
POEdit looks like this
POEdit - hide a variable with CSS
You can hide a variable in the output of the translation with some CSS like this.
Be sure to pay attention to syntax errors. POEdit will infom you if the string needs to end with a period or is missing a variable. Referring back to the original will usually clarify errors if they sound obscure.
My new string<span style='display: none;'>%s </span>.

The %s is the variable, and the CSS around it hides that variable from the output/display.

Translating Custom Fields

Translate Custom Fields without WPML

Translate Custom Fields with WPML

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us