Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Translation Not Working


  • geistschatten
    Participant

    @geistschatten

    Alright, so I’m almost ripping out my hair over this. I’ve checked other threads on here, I’ve put the .po and .mo files in multiple directories (wp-content/languages, theme/languages, bp-languages), I’ve added the bp-custom file, tried to change the language with wp-config, and even selected the language from Settings->General.

    All I’m trying to do is change some of the words talking about friends to something else. I’m not using a BuddyPress theme, it’s the Duena theme (https://wordpress.org/themes/duena).

    I took the .pot file and edited it with a text editor for Ubuntu called gedit, then I saved it as .mo & .po files and named them accordingly. I’ve triple checked every other fix to the issue for the past few days and have had zero success.

    Since this is supposed to help, here is my info below. Any help is greatly appreciated! I just need a simple step-by-step of what to do for my versions of WP and BP, I can follow them to the letter, and then report what happens.

    1. Which version of WordPress are you running? 4.0

    2. Did you install WordPress as a directory or subdomain install? Directory.

    3. If a directory install, is it in root or in a subdirectory? Root.

    4. Did you upgrade from a previous version of WordPress? If so, from which version? The previous version, but was having the issue prior to the upgrade.

    5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting. Yes, everything works perfect, I just need certain words like “Friends” changed to something else.

    6. Which version of BP are you running? 2.0.2

    7. Did you upgraded from a previous version of BP? If so, from which version? The previous one, had this issue prior to the upgrade.

    8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones? (BuddyDev)BP Poke, All In One SEO Pack, BP Profile Search, BP Xtra Signup, Buddypress – Who clicked at my Profile?, BuddyPress Edit Activity Stream, BuddyPress Friends Only Activity Stream, BuddyPress Live Notification, BuddyPress Username Changer, BuddyPress Usernames Only, Gatekeeper, Limit Login Attempts, Maintenance, Membership Premium, Registration Honeypot, RS Buddypress Activity Refresh, rtMedia for WordPress BuddyPress and bbPress, Simple Login Log, Useful Banner Manager, and Welcome Pack.

    9. Are you using the standard BuddyPress themes or customized themes? Duena, so a regular theme? Not designed particularly for BuddyPress though.

    10. Have you modified the core files in any way? Other than uploading the .mo & .po files and the bp-custom.php, no.

    11. Do you have any custom functions in bp-custom.php? Yes, the function from every tutorial talking about the language, but changed for my custom language file.

    12. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in? Nope, no bbPress.

    13. Please provide a list of any errors in your server’s log files. None.

    14. Which company provides your hosting? My own, HostArmor.

    15. Is your server running Windows, or if Linux; Apache, nginx or something else? Linux + Apache.

Viewing 7 replies - 1 through 7 (of 7 total)

  • danbp
    Participant

    @danbp

    11. Do you have any custom functions in bp-custom.php? Yes, the function from every tutorial talking about the language, but changed for my custom language file.

    Which tutorial are you telling about ?

    Remove that function, it’s not necessary i guess.

    By default, you set your site language in wp-config define ( ‘WP_LANG’, ‘de_DE’ ); and in wp settings > general (depending if single or MS install)

    Where to put the translation ?
    wp-content/languages/de_DE.mo (this is the WP translation)
    wp-content/languages/plugins/buddypress-de_DE.mo (this is the BP translation)
    wp-content/languages/themes/theme_name-de_DE.mo (this is the theme translation)

    You say you used gedit to generate your translation. It’s a text-editor, not a mo compiler. (mo means machine only, you can’t read it !)

    I suggest that you use poEdit to make a translation and generate a correct mo file.
    On Ubuntu, you can (not sure) use the msgmt command from the gettext package. Something like this

    $> msgfmt -o your_file.mo -v your_file.po


    geistschatten
    Participant

    @geistschatten

    I called it a tutorial, I just meant this page: https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/

    I’ve removed the bp-custom.php file entirely.

    Thank you for the list of where to put the translation files and the tip about poEdit! I installed poEdit, opened my edited .pot file, exported the .po and .mo files, uploaded them to the appropriate directories and changed to the language in wp-config to “en_US” while naming the files buddypress-en_US.po and buddypress-en_US.mo

    Still no translations showing up (even after several refreshes and Ctrl+F5), but I did discover a couple errors with my file while editing it. Something about duplicate definitions, which I fixed.

    Again, all I’m trying to do is change friends, friendships, friend requests, etc. to something else. A simple translation for only BuddyPress seemed to be the easiest way to do that.


    danbp
    Participant

    @danbp

    I just tested Duena and the BP translation is fine.

    Recheck your po/mo files. Here what you must have:

    duena – leave as is.
    buddypress/bp-languages/buddypress.pot
    wp-config – if you use english, as it’s default language you have nothing to do
    // define(‘WP_LANG’, ” );
    wp-content/languages/plugins/buddypress-en_US.mo

    Now if you want to modify only some strings, make a copy of the pot file and put it in a folder outside of buddypress.

    From this copy you remove anything you don’t want and keep only the 2 lines or 4 lines (if plural form) who belong to the string you want to change. You keep only the string you want to change.
    Once done, save and rename it buddypress-en_US.po and open it with a text editor (not poEdit), as we’re going to modify the header.

    msgid ""
    msgstr ""
    "PO-Revision-Date: 2014-09-12 00:05+0100\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Plural-Forms: nplurals=2; plural=n > 1;\n"
    "X-Generator: Poedit 1.5.7\n"
    "Project-Id-Version: BuddyPress 2.0.2\n"
    "POT-Creation-Date: \n"
    "Last-Translator: \n"
    "Language-Team: \n"
    "Language: en\n"
    "X-Poedit-SourceCharset: UTF-8\n"
    "X-Poedit-Basepath: .\n"
    "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
    "_n_noop:1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;esc_attr__;"
    "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
    "X-Poedit-SearchPath-0: ..\n"

    The rest of the file looks like this:

    msgid "Friendships"
    msgstr ""  <strong><- replacement goes here</strong>
    
    #: bp-friends/bp-friends-template.php:588
    msgid "%s friend"
    msgid_plural "%s friends"
    msgstr[0] ""
    msgstr[1] ""

    Save in text format utf8 without BOM. (important)

    Now you can open this po file with poEdit, do your translation and save so that poEdit generate a mo file (see poEdit settings first to get this automatically each time you save a file).

    Copy the mo file in the appropriate folder and, normally, you’re done.

    References
    https://codex.wordpress.org/Translating_WordPress
    https://make.wordpress.org/polyglots/handbook/translating/basics/
    http://www.wpbeginner.com/wp-tutorials/how-to-disable-automatic-updates-in-wordpress/

    The definitive guide to disabling auto updates in WordPress 3.7


    geistschatten
    Participant

    @geistschatten

    Thank you! That worked perfect and now I see my translated terms. I tried the same process for BP Poke and it didn’t seem to work (even renamed the translation files to bp-poke-en_US.mo/po and dropped them in the languages/plugins folder). Oh well though, not as important as the main change. I’m a happy camper, so to speak… 🙂


    danbp
    Participant

    @danbp

    Glad you got it to work !

    FYI: BP Poke comes with his own languages folder who contains po/mo in english. This is wrong, but has no influence if you want to use another language.

    The reason is that many authors create a po file instead of a pot file, and when they save the file, poEdit (or similar) automatically creates a mo file.
    The correct file name should be bp-poke.pot ! You can remove the original – in english – mo, totally useless: the plugin is coded in english !

    To use a translation for this plugin, you add xx_XX.mo to bp-poke/languages/xx_XX.mo

    Text domain ref: bp-poke.php:50


    geistschatten
    Participant

    @geistschatten

    Once again you’ve saved my life! That worked perfectly after it was named correctly. There really should be central language requirements for all plugins, themes, etc. I’ve set up dozens of WordPress sites and never ran into as much of an issue as this. Thank you for teaching me not just answering 😀


    danbp
    Participant

    @danbp

    You’re welcome !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Translation Not Working’ is closed to new replies.
Skip to toolbar