Skip to:
Content
Pages
Categories
Search
Top
Bottom

Languages, Translations, i18n, l10n

Like WordPress, BuddyPress has the built in capability to be used in any language.

Each BuddyPress version includes a POT file which contains all the strings who can be translated. See /bp-languages/buddypress.pot

Important: The POT file is not the translation. You have to download your language file or make it yourself.

Where you can get your language file

At this time, there is no unique or official place to get a translation for BuddyPress. Some are on the dedicated WordPress site for translation projects translate.wordpress.org, but many other are elsewhere.

How to get a language file on http://translate.wordpress.org/projects/buddypress/dev

  1. Select BuddyPress in the list
  2. Select your language
  3. At the bottom of the page select ‘all current’ as ‘.mo’ and press ‘export’
  4. Do the same to get the ‘.po’ file

If you maintain several BuddyPres projects or if you need to be constantly up to date to a standart translation, you can use the BuddyPress-Translation plugin by @djpaul which give you the possibility to load your BuddyPress with the translations provided by translate.wordpress.org. Do not use this if you use a very customized translation.

Alternative resources

Is your language missing?

If you do not see your language in the list, please ask for it on the support forum or consider creating your own translation file.

There is a translation, but it is not complete

Sorry for you, but you have to finish the work yourself. See further down how to do this.

How to use the language file

  1. Make a copy of the bp-languages folder outside of the buddypress folder.
  2. Keep the POT file as is and download the po/mo files into it.
  3. Rename the folder to something accurate to your project.
  4. The po/mo files must be named buddypress-xx_XX.mo and buddypress-xx_XX.po, where xx_XX is your language ISO code.
  5. Move the MO file to /wp-content/languages/ on your server. If the folder does not exist, create it !
  6. Make sure you have enabled your language on the WordPress “Settings > General” admin page.
  7. If you are using BuddyPress on a network install, go to “BuddyPress > Settings”.
  8. Check also your language setting in wp-config:
    define ( 'WP_LANG', 'xx_XX' );

You can find the latest BuddyPress POT file here: http://svn.buddypress.org/trunk/bp-languages/buddypress.pot.
For previous versions, see the /bp-languages/ repertory in any BuddyPress Branch or Tag check out.

Translating BuddyPress

Translating BuddyPress, even from scratch, is exactly the same work as translating a theme or a plug-in.

Two options

  1. Do it directly on-line on the BuddyPress translation project.
  2. Stay independent and make your own copy. In this case, you will need a compiler software like poEdit.

For instructions, please take a look at Translating WordPress as many of the instructions there can be applied to BuddyPress.

Important: if you use the first solution and need some customization, you will not get a copy for your personal needs on the fly. This situation will probably lead you to consider the second option.

The bp-languages folder

The bp-languages folder is in the BuddyPress folder. It is not used by BuddyPress or by WordPress and contains only one file: buddypress.pot This is only provided so for translation purpose. If you need a complete translation for BuddyPress, or want only to change some labels or text, make a copy of this bp-languages folder outside of BuddyPress before. Keep in mind that the original folder will be overwritten at the next release update.
Once your cahnges are done and safely stored, you have to copy the compiled .mo file to the server into /wp-content/languages/buddypress-xx_XX.mo

A complete language folder contains at least 3 files.

POT and PO file can be integraly written and edited with a text editor. But you need a compiler to generate the .mo which is the only file you need for getting the translation to work on your site.

The other difference between these files is the header information in each of them.
The pot file header is really basic and contains only specific informations about BuddyPress version and creation date. It looks like this:

The pot file header

# Copyright (C) 2013 BuddyPress
# This file is distributed under the same license as the BuddyPress package.
msgid “”
msgstr “”
“Project-Id-Version: BuddyPress \n”
“Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n”
“POT-Creation-Date: 2013-07-27 18:35:29+00:00\n”
“MIME-Version: 1.0\n”
“Content-Type: text/plain; charset=UTF-8\n”
“Content-Transfer-Encoding: 8bit\n”
“PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n”
“Last-Translator: FULL NAME <EMAIL@ADDRESS>\n”
“Language-Team: LANGUAGE <LL@li.org>\n”

The po file header

msgid “”
msgstr “”
“Project-Id-Version: BuddyPress-fr_FR 1.8\n”
“Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n”
“POT-Creation-Date: 2013-07-16 19:35:17+00:00\n”
“PO-Revision-Date: 2013-07-25 10:31+0100\n”
“Last-Translator: dan <danco38@gmail.com>\n”
“Language-Team: Dan <danco38@gmail.com>\n”
“MIME-Version: 1.0\n”
“Content-Type: text/plain; charset=UTF-8\n”
“Content-Transfer-Encoding: 8bit\n”
“X-Poedit-KeywordsList: _e;__\n”
“X-Poedit-Basepath: .\n”
“X-Poedit-Language: French\n”
“X-Poedit-Country: FRANCE\n”
“Plural-Forms: nplurals=2; plural=(n > 1);\n”
“X-Poedit-SourceCharset: utf-8\n”

Good to know

  1. The po file header contains additional information about the translator and about the environment. These lines are automatically generated by the compiler when you fill in the required fileds before begining a translation project (here with Poedit).
  2. Header informations should be in the .po file.
  3. The mo file is compiled, humans cannot read it.
  4. Refer to your compiler documentation for more information about heading information.

Language secrets

Read here about some secrets about keywords-list and plural-forms settings. This is crucial to know, specially if you are debuging a translation.

Of course, you can apply these recommendations to any other theme or plugin translation.

Troubleshooting

The most common translation issues are due to special characters, erroneous numeric variables (%s, %1$s, etc) or malformed HTML. Such errors goes from untranslated strings to blank pages, depending on how PHP’s gettext function handled the string. So the first source of error is the po/mo file.
Be warned that tracking down such errors can be long and fastidious.
The best way to get rid of this is to locate the error on the template.
Open the PO file in a text editor and search for the supposed to be culprit template file name within the source code. Check if a string in this file is containing something you omit or did wrong. For example an %s changed into %1$s

Case study

Locate the expression

The easiest place to find an expression is the POT file, where ALL BuddyPress wordings are stored. Use a text editor such as Notepad++ to do so.

Search result

Is in /bp-languages/buddypress.pot

#: bp-templates/bp-legacy/buddypress/activity/index.php:51
#: bp-themes/bp-default/activity/index.php:71
msgid "<span>%s</span>"
msgstr ""

OK, we have found the file and know the code position into it, which is line 71.

_e( “The activity I’ve marked as a favorite.”, ‘buddypress’ )
printf( __( ‘My Favorites <span>%s</span>’, ‘buddypress’ )

Now open buddypress-xx_XX.po file, search again for My Favorites to get the translated expression.

#: bp-templates/bp-legacy/buddypress/activity/index.php:51
#: bp-themes/bp-default/activity/index.php:71
msgid "My Favorites <span>%s</span>"
msgstr "Mes favoris <strong>%</strong>"

The translator changed the HTML tag from span to strong and erased the little s during the cosmetic surgery. Make the correction and save. But if you did this change in the text editor and you reloaded the file to the server, NOTHING will happen.

Hot Tips

Once the .mo file is correctly updated and uploaded to your site, you will now see your correction !

Common mistakes

Sometimes, translations are showing partially or odd, with strange characters. Assuming there are no conflicts with your databse, server, doctype or charset declaration, the culprit is probably in the translation. The translation maybe contain reserved characters, specific language characters such as the french à or the spanish ñ, and last but not least, apostrophes. In such cases, you have to check the BuddyPress translation first, but you must absolutely check your theme and plugins too.

Example
This part is in a PHP conditionnal loop, which means that apostrophs for example, must be written by using the correct unicode.
context_code

The po file contains this:

code_example

PHP and HTML do not understand human languages subtilities. So they must be “coded” a little. The output of the translated string:

Vous êtes invité(e) par le groupe [group name here]

To close this case study, it is important to understand that the original strings are only “proposals”. You do not have to translate word for word, much less to translate all suggested words. The only things you should never change, alter or translate – if they exist in a string – are the variables.
In our case it was %s

Using translation files to customize labels and text

Translation files can serve another purpose other than strict language translations. They are the best approach to changing text and labels on your site. A guide to achieving this can be found here Customizing labels, messages, and urls

Notes

Assist in making translations at http://translate.wordpress.org/projects/buddypress/dev

Subscribe to http://wppolyglots.wordpress.com/

Evolution

Lines to be translated grow and evolve.

Version – Lines
1.0 – 910
1.2 – 910
1.5 – 1114
1.6 – 1226
1.7 – 1275
1.8 – 1277
1.9 – 1311
2.0 – 1476

Additional Resources

Great starter tutorial by @vanillalounge
A good read for techies by @otto42
Back to school for some HTML entities usages (w3schools.com)
WordPress Codex: about internationalization (i18n)
WordPress Codex: L10n function reference
WordPress Codex: Translation Tools
Changing Core WordPress Strings by @viper007bond (works also for BP).