Shopstar! is translation-ready which means all of the text used in the theme is in a language / POT file named shopstar.pot. This file can be found in the “languages” folder of the theme (wp-content/themes/shopstar/languages). A POT file is essentially just a text file that contains all the strings (ie. text) used throughout the theme. Note, this only includes strings that exist within the theme itself though, not text created by the user (eg. pages, blog posts, etc.)
If you want to translate the entire site into a new language you can just follow these steps:
- Download and install Poedit which is a free program that will allow you to edit POT files.
- Open Poedit and click File > Open then browse to shopstar.pot. You will see a list of all the English versions of the strings.
- Click on a string that you would like to translate and click the “Create new translation” button near the bottom of the screen. You will be prompted to select the language you’re translating to.
- Now when you click on a string you will see 2 fields at the bottom of the screen “Source Text” with the English version and a “Translation” field which will be empty to start with. That is where you can enter the translated version of the text.
- Once you’ve translated some strings click “Save” and you will be prompted to save the file. You need to give the file a name specific to the language you’re translating to. This filename should follow the format of LANGUAGE CODE_LOCALE CODE. So for example “fr_BE” for French Belgium or “fr_CA” for French Canada. You can find an extensive list of the internationalization locale codes that WordPress uses here. This file should then be saved to the same location as shopstar.pot. When you save it, it will automatically create an MO file. This is the compiled translation file that will be used by WordPress. It will have same name as your new POT file but the file extension will be “.mo”.
- In order to place the file into the correct folder in the theme that is powering your live website you will need to have FTP access to the server that your website is hosted on. Once you are connected via FTP browse to the languages folder of the Shopstar! theme (wp-content/themes/shopstar/languages) and upload both the POT and MO files. While the POT file is not required by WordPress it’s a good idea to keep these two files in the same location as the POT file is required for you to amend or add to your translated strings in future.
- Once you’re done with your translating log in to your WordPress admin and go to Settings > General. You will see a “Site Language” setting and the first 2 options should be English and the language file you have created. Select your new language and save. This will activate the translation file and if you refresh the site you will see your translations. Any untranslated strings will just default to the English version.
If you would like to offer various languages on the site that a user can choose from then you will need to use a plugin to do this. A very popular plugin for doing this is WPML. It’s quite powerful as it allows you to create translated versions of the pages, posts, etc. that you have created within WordPress. You can watch a demo video on their site of the plugin in action.