Translating Storefront Themes

Posted by on Apr 14, 2012 in Blog, Echo, Gridport, Translation, Wordpress, WP e-Commerce | One Comment

How to translate a Storefront theme

Hi this is the very beginning of an article on translating Storefront Themes e-Commerce themes. I will be adding more detail and screenshots to help soon. I will also start a collection of translated files for download.

Volunteer

Help out the Storefront community. If you have the skills in your language please volunteer to create a file for one or more themes via the contact form on this site. Most of theme ar every simple with less than 40 text strings to translate. You can take a file that is already translated and translate it to a new language then save with the correct name for the new language.

Expanded translation:

I have started to add translation that includes the Storefront Options panel. See the very end of this post. It does require 2 new PHP files. Also about 110 extra strings to translate!

Instructions

These instructions refer to Gridport Theme but the process is exactly the same for all Storefront themes. Hopefully when updates are released the code change to functions.php will be included.

Your theme does not include many text strings. Most of the things like buttons are handled by the WP e-Commerce plugin. What buttons etc are not translating?
It does have some parts that need translating. I have put up some .po (language) files for translation here.
1.
make a new folder under the theme folder called “lang” For example…
wp-content/themes/storefront-gridport-1.0.6/lang

2.
You can use the free program PoEdit which works on macs and Pc’s to translate your file
You need to translate then save to the lang folder (or save and copy there) The program will make a .po and .mo file when you save. The .mo is the one that is actually read by WordPress. You need to name your file with the right language and country code. The not translated file I am supplying is named for French. Just change to the right name for your language. You can find the country and language codes here.
Language codes
Country codes

There is some information on translating with PoEdit here with screen shots. You do not need to worry about the PHP code etc in the first part of the article. Just Step 5.

3.
You also need to add a function to the themes functions.php file.

In the theme folder find functions.php and open it for editing. You can do this by going to Appearance/Editor and opening it from the file list as the change is very simple. Right BEFORE the very last line which is ?>
add this

/* Make Gridport available for translation.
	 * Translations can be added to the /lang/ directory.
	 */
	load_theme_textdomain( 'storefront', TEMPLATEPATH . '/lang' );

Make sure you have no blank lines or spaces at the end of the file and save.

In your site you may need to change your wp-config.php, which is in your WordPress install root directory file, to state your language It is probably already there if you have other translations working. Below is the line you change with the codes for French added.
You probably already know your countries codes.

define (‘WPLANG’, ‘fr_FR’);

There may still be some small issues with the translation files, I am not sure about some of the plural translation codes, it should be close. Let me know if you see any problems. If you translate it please get in touch via http://gasolicious.com/contact/
I will try and build up a collection of translated .po files for different languages for all of the Storefront themes. If you are really good with languages please help by volunteering to translate some other themes .po files

Translation files

Gridport theme version 1.0.6. Not translated.

Echo theme version 1.4.1 French translation

Expanded translation files

I was asked if it was possible to translate the Storefront Options panel in the backend. This was not possible. It requires an expanded pot file that covers all front end and backend translation, plus 2 modified PHP files.
You must replace 2 PHP files to make it work, they are included in the zip with the .pot file.
You need to put them in your theme replacing the ones that are there.
wp-content/your-theme-folder/functions/admin-interface.php
wp-content/your-theme-folder/includes/theme-options.php

Remember if you just want the front end of the site translated use the files above

So far I have only done this for Gridport. I will attempt to add more as I find time. If you need one urgently use the contact form on this site.
Expanded backend and frontend Gridport pot translation file, including required PHP files

1 Comment

  1. Lexi
    December 31, 2013

    I suggest using https://poeditor.com for the translation of your themes. It’s more complex and useful than Poedit. It has translation memory, a very useful feature and also API and a very nice crowd sourcing system.

    Reply

Leave a Reply