Vacation Notice
Boxy Studio will be on a break from July 21st–29th. I will be catching up on all tickets when I get back on the 30th.
Thank you for your patience and understanding!
– Justin Scheetz

Okay
  Print

Translation & Text Changes

Our products come with a language file that needs to be translated in order for it to display a different language. The easiest way to translate it is to install a great plugin like Loco Translate and do it via the WordPress admin panel:  http://wordpress.org/plugins/loco-translate/


Full Language Translating

  1. Once you have Loco Translate installed, head over to the main Loco Translate screen by going to Loco Translate > [Plugins] or [Themes] (depending on what you're translating).
  2. Find the theme/plugin in the list and click it, then click the [+ New Language] link above the list.
  3. If you see a "Template Missing" message, simply click "Skip Template".
  4. Choose the language for this translation from the dropdown.
  5. IMPORTANT: Make sure you choose the third radio button (System) in the next section. (languages/plugins or languages/themes) before clicking Start Translating. If you do not, then your translation file will be gone if/when you update the theme or plugin.
  6. Now, on the next page, you can simply go through and add/edit your translations by clicking on each string and adding the translation in the bottom box.
  7. When you're done, simply click "Save".
  8. Be sure that WordPress is set to use the same language you've translated from Settings > General (look for the language dropdown at the bottom).

The POEdit Method

You can use software like POEdit (  http://www.poedit.net/download.php) to translate the *.po file that's included with the theme or plugin. Just remember to put your translated files into the appropriate folder listed above and remember to update your translations when there's an update.

More information on translation can be found here as well: http://codex.wordpress.org/Installing_WordPress_in_Your_Language


Simple Text Changes

Sometimes you just need to change some of the text, from English to English. In this case, you could either create a second "English" translation file following the same directions above, or better yet, just add some custom code to your theme's functions.php file or create a custom single-file plugin that does this for you. In the following example, this code will change the "Search..." text in a search bar to say "Find..." instead:

add_filter( 'gettext', 'my_custom_text_changes', 20, 3 );
function my_custom_text_changes( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Search...' :
            $translated_text = 'Find...';
        break;
    }
    return $translated_text;
}

As mentioned, you can open up your theme's functions.php file and add this code. Or a better method would be to create a simple single-file plugin that will allow you to add code like this without messing with the theme files (which might get overwritten when updating). The following is the code needed to create a very simple plugin. To create this yourself, go to your /wp-content/plugins/ folder on your server and add a file called my-custom-code.php (it can be named whatever you want). Then add the following code to that file:

<?php
/*
Plugin Name: My Awesome Customizations
*/
add_filter( 'gettext', 'my_custom_text_changes', 20, 3 );
function my_custom_text_changes( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Search...' :
            $translated_text = 'Find...';
        break;
    }
    return $translated_text;
}
?>

Save the file, and then go onto your WordPress admin's plugins page. Find the plugin called "My Awesome Customizations" and activate it. That's it!

Also, to add more than one translation, you can add more case/break statements. Here's what that would look like if you wanted to change a custom post type called "recipes" to "books" in several locations (this will require changes to probably many more "cases", but this is an example. A developer might be needed for additional work:

function my_custom_text_changes( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Recipe' :
            $translated_text = 'Book';
        break;
        case 'Recipes' :
            $translated_text = 'Books';
        break;
        case 'recipe' :
            $translated_text = 'book';
        break;
        case 'recipes' :
            $translated_text = 'books';
        break;
    }
    return $translated_text;
}