How to add a new translation to a plugin ( french ) (Plugin: Private Profiles)


I have just installed a plugin: Private Profiles and I wish to add a French translation on the plugin.

In the file / mod / private_profiles / languages there is only a German translation (de.php) and English (en.php) ) which is by default.

I have to try to create a fr.php file and to stick the lines of the en.php file then to translate them, but nothing to make that works.

Thank you in advance for any answer.

  • Using the Translation Editor plugin as Michele suggested is one way of creating translations of language files.

    But you can also work directly with a language file and translate the strings in an editor. It should work, if you make a copy of en.php that you give the name fr.php and then translate the strings in the fr.php (right of "=>" only). You can also make the translations on your own computer and then upload the finished fr.php file on your server into the languages folder within the Private Profiles plugin. You only need to make sure that you don't save the file with Byte Order Mark (BOM) characters as this will very likely result in issues on your Elgg site. Best would be to save the translated file in UTF8 encoding without BOMs.

    If you are still on Elgg 1.8 and are using the corresponding version of the Private Profiles plugin, you also need to change line at the end to be

    add_translation("fr", $french);

    with the name of the language array also be changed to $french at the top of the file (it's just important that the name of the array is the same in both places; but it's important that the first parameter in the add_translation() function call is "fr" for the French translation).

    For the language file for Elgg 1.9 or newer you don't need to make this adjustment in the language file as the add_translation() function call is no longer necessary in the Private Profiles language files (but the name of the language file must match fr.php now for the French translation).

    Also, you would need to flush the site cache in the admin section of your Elgg site for the changes / additions you made in the language file to take effect. And of course you would need to use French as site language for it to be visible (and also in your own account's user settings to see the French translation to be used).

    If you have a complete French translation for the Private Profiles plugin, you could also send it to me (or make a pull request at the corresponding plugin repo at github). Then I can include your translation in the next release of the Private Profile plugin.

  • Big thanks to iionly and Michele ! :)