Translate a WordPress Blog

For my family blog, I decided to fully convert it to Spanish.  We had been primarily posting in Spanish, but most of the descriptions were in English.  The primary reason for doing the blog in Spanish was so that we could have a connection with our family in Guatemala, and although many do speak English, Spanish is still the best way to communicate with them.  Although I did not do all these changes in the order that I present them here, now that I have given more thought to the process I think this is the best way to do it.

WordPress in Your Language

From the WordPress help:

Although WordPress displays in U.S. English (en_US) by default, the software has the built-in capability to be used in any language. The WordPress community has already translated WordPress into many languages, and there are themes, translation files and support available in many other languages. It is also possible to create a multilingual blog with the help of Plugins.

It is fairly simple to change the language for the installation of your WordPress instance.  You can find a list of languages in the codex site, the list will live here soon. For now, go here.  Since I wanted the Spanish translation, I started at es.wordpress.com, but the instructions are always the same:

  • Download the .mo language file for your language.
  • On your site server, create a new folder in your /wp-content directory called /languages
  • Upload the .mo file to the languages folder you just created.
  • Open your wp-config.php file in a text editor and search for:
define ('WPLANG', '');
  • Edit this line according to the .mo file you’ve just downloaded, e.g. I wanted the Spanish language so I added:
define ('WPLANG', 'es_ES');
  • Once you’ve added your language code, save the file.
  • Upload the modified wp-config.php file into the WordPress root directory.
  • Open your browser and go to your WordPress site. It should now display in the newly-installed language.

A Theme with Internationalization

Now that your installation is in the language that you desire, you can change the language on your theme, this is can be as easy as your main installation or downright impossible; this because you depend on the theme’s creator to allow internationalization.  I believe that the all default themes come ready for multiple languages, for others it really is hit or miss.  I had chosen Pinboard because it offered internationalization.

What does it mean to offer internationalization

You can find a lot of information in the wiki entry, but in short for a theme to offer internationalization, or as commonly written i18n (where 18 stands for the number of letters between the first i and last n in internationalization), they need to provide a template.

Pinboard provides a template file called pinboard.pot, which contains a list of all the translatable strings extracted from the sources.  The .pot files looks something like this:

 #. TRANSLATORS: Please leave %s as it is
 #. Thank you for contributing to this project.
 #: src/name.c:36
 msgid "My name is %s.\n"
 msgstr ""

Translating the theme

Search for other people that have translated the theme, you should be looking for a file name like themename-locale.mo or themename-locale.po (ie pinboard-es_ES.mo).  I couldn’t fin any translations on the support forums or on searches, I had to do it by myself.

In short you need to rename the .pot file into a .po file and add all the translations on the messages.  You can find all about it here, but there are easier ways.

LocoI used the web service Loco, which offers a very easy interface to load the .pot file, translate each message and then download the .mo file. From their about page: “Loco helps you manage and integrate translations into your software, whatever you’re building.”

Folder Tree
Folder Tree

I renamed the file as pinboard-es_ES.mo and then uploaded it to the correct folder.  This is in a subfolder where you placed the wordpress language file.

Folder Content
Folder Content

By this point you should be able to see your site in the language of your choosing.  I love looking now at my blog and just seeing that I made it happen.

Compare

Changing the Language in Your Posts

There are several ways to do this, you can learn about them here.  I considered these 3:

  1. Translate each post
  2. Create separate posts for different audiences
  3. Use a service to translate

Although I would have full control over the content on options 1 and 2; the burden was so big that I couldn’t do it.  I tried a few services and settled on Google’s Translation services.  Here are the steps I used to add this service to my blog.

Go to translate.google.com

GoogleTranslateSelect Website Translator

GoogleTranslate2Then click on “Add new website”

GoogleTranslate3Add your site, the original language and the languages you want to have available

GoogleTranslate4Pick the way that you want your dropdown bar to look and see if any of the Advance features apply.  I use Google Analytics so I wanted to track this.  If none of them make sense to you, leave them unchecked.  Now click on “Get Code”

GoogleTranslate5This code needs to be inserted in two places for it to work on your wordpress site.  This is where it becomes less easy, if you see the instructions as being too complicated you can try this plugin “Google Language Translator” it looks simple to use and has very good ratings

First you will need to find your theme’s functions.php and edit it.  You can find it in the Appearance editor.  Then add the following code:


if ( ! function_exists('mijangos_google_translate')):
/***
Adds Meta tag to header
*/
function mijangos_google_translate() {
echo '<meta name="google-translate-customization" content="XXXXXXXX-XXXXXXX-g4a2bfd921f7edf6c-f"></meta>'."\n";
}

add_action('wp_head', 'mijangos_google_translate');

endif;

Notice that the part after echo ' is from the code being generated, and don’t forget to end it with ' ;.  This functions puts this code in the header.  Now click on “Save File.”

Edit the single.php page, this is the page that generates your posts.  I wanted the language selector to be just above the post content.  I located that part and put the following code in.


<!-- Google Translate -->
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'es', includedLanguages: 'en,fr,pt,ru', gaTrack: true, gaId: 'UA-37421093-1'}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<!-- Google Translate -->

<div style="margin: auto;">
<div id="google_translate_element"></div>

Save the file and go to a post. This was my result.

GoogleTranslate6

 

What do you want to do next?

Recently I was in the midst of a redeployment effort as the project I was working on was put on hold.  My manager and other leaders would ask me, “what do you want to do next?”  I had some vague concepts of the things I wanted to do, but it was very difficult to articulate them.  In the back of my mind I kept saying: “I just want to still be employed.”  That was not an issue, thankfully, but it seemed everyone was allowing me to think of what I wanted to do, and I had no thoughts.

I met with my mentor and with other managers to learn how they though about transitions, and I was able to learn some very interesting bits.  I don’t think that any of this is revolutionary, but it created an easy way for me to answer the question: “What do you want to do next?”

Big Dreams

The first thing that I learned was to set my mind free and say: What are my big dreams?  This includes retirement and spending long days in the beach with my family.  This is everything, all your dreams onto a piece of paper.  Then do a second paper, more structure and this will be just your professional Big Dreams. (I’ve included a simplified version of mine)

Your Big Career Dreams
Your Big Career Dreams

As you see I’ve put age just to have some context and some titles, but mainly it will give you some context.  It provides just jumping points, but if someone asked me what do you want to do next I would just be able to answer: “Eventually I want to be a Director, maybe internationally, in either Marketing or Strategy or some combination of all of that.”  It does not answer what I want to do next, but it does give you a good next milestone.

What should I do next in 5 steps

Step 1 – What kind of work do you want to do?

There are infinite permutation of work that you could do and you would enjoy doing.  Think broadly, things like “exciting work” or “working close to customers” or “working close to the product” or “thinking about long term strategy” or all of the above.  This could change on your next leap, but shouldn’t vary too much.

I want my work to be exciting, important to the company, and strategic and forward looking.

Step 2 – What is your history?

Think about the past 3 or 4 roles you’ve done and list them out.  For me they would be: I was a developer, then a general manager, then in market research, then a program manager.  This gives you context; do I want to do more of software development with a twist or a project manager over something bigger? Or I want to use my MBA degree into something more like marketing.  Start thinking about skills that you have acquired and what you want to develop

Step 3 – What skills do you want to develop in the next 5 years?

Remember my statement: “Eventually I want to be a Director, maybe internationally, in either Marketing or Strategy or some combination of all of that.” To get that I need to develop a few skills.  I know that where I work to be promoted to director I have to be 6 Sigma Green belt certified; I need that skill.  After talking to a few people that are in those roles, I saw that I need to learn more about the products and customers.  Think about the skills that you will need for that next milestone

Step 4 – Convert that milestone into possibilities

Look for positions that would be possibilities for the milestone.  I looked in my organization and there were a few positions that I would say, yes that is what I want to do.  One of them was Director of Competitor Intelligence, another was Director of Market Strategy and Planning, and another Director of Market Segment in Mexico.  These were places that would fit my milestone, I want to get there, so finally, which role/s would take me there.

Step 5 – List the roles that will take you to your next milestone

It has become evident that I might have to be in 2 more roles before I get to be a Director, but that is fine, as long as I can identify a few roles that:

  1. Take advantage of my past skills
  2. Give or strength my desired skills
  3. Are congruent with my overall type of work I want to do

That is the last step, find 2 or 3 roles that would lead you to that milestone.  I talked to the directors that hold the positions I want and learned about their path.  Some took a longer path because they had to gain more experience or education.  Others had similar roles than those I want to pursue, so I could relate easily.  We discussed the skills and which roles provided particular skills that I have to master.

Putting it all together

Slide2A mentor shared a similar slide that puts all those steps into one visual image.  As you see each part has a number, but you can fill it out in any way you want, as you are putting things together.  You will probably have to do a few passes before you can say that you are satisfied.  In the end I had  3 jobs I thought would be good next steps and looked for open positions.  One spot I interviewed and discussed the skills I wanted to gain and those that I was bringing; the manager agreed that I would make a good fit.

I don’t think I will update my slide until next year, when I will start again thinking about next steps.  In the meantime, I have a lot of material to read to catch up to the rest of the team.

Here is a template that you can use:  Template