Skip to:
Content
Pages
Categories
Search
Top
Bottom

Broken translation in some tabs


  • januzi_pl
    Participant

    @januzi_pl

    Hello

    So, I’ve translated everything in *.po file, uploaded it and corresponding *.mo file into the proper directory and I’ve got disappointed. Some of the text aren’t translated, like: Notifications (number), Groups (number), etc. I’ve took a look at the files and found out that the working ones are using __( "Foo %s", "buddypress" ) and the wrong ones are using _x( "Foo %s", "Blah blah blah", "buddypress" ). I’ve replaced _x( 3 vars ) with the __( 2 vars ) and translations started to work.

    The problem is: the next update of Buddypress will erase my fix and everything will get back to previous state.

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

  • danbp
    Moderator

    @danbp

    Don’t hack core files. (never !) Which language do you use ?

    Where have you done this ?
    I’ve took a look at the files and found out that the working ones are using __( "Foo %s", "buddypress" ) and the wrong ones are using _x( "Foo %s", "Blah blah blah", "buddypress" ).

    Actually all BP strings are working. If you need custom translation, you have to do that in po/mo and to use preferably the original strings. For example, if you build a template and want to use the notification count on it, you copy the original string to your work. If you don’t do that, you nedd 2 po/mo ! One for BP and one for your custom work. Which is certainly not the best and easiest solution.

    The notification count is defined in wp-content/plugins/buddypress/bp-notifications/classes/class-bp-notification-component.php

    The counter itself is inside a span and is defined separately.

    /* translators: %s: Unread notification count for the current user */
    _x( 'Notifications %s', 'Profile screen nav', 'buddypress' ),
    sprintf(
    	'<span class="%s">%s</span>',

    The bla bla bla part you mention is a comment for translators who indicates him the context. This comment appears in the pot file like: Notification %s [Profile screen nav]

    That’s BP’s default coding. You haven’t to modify this. Use it as is.

    If you have difficulty to translate such a string, you have to check your theme or any custom function you added (by hand or another plugin).

    The corresponding custom string should reflect the original one as gettext function wouldn’t translate a string which is not identic.

    __( "Foo %s", "buddypress" ) and _x( "Foo %s", "Blah blah blah", "buddypress" ) are both working, and do technicaly the same thing (foo = something) which let you modify “foo” in both case, but as the original string is _x( "Foo %s", "Blah blah blah", "buddypress" ), you couldn’t replace it with __( "Foo %s", "buddypress" ). It is the translation prefix (_x or __) which is the important thing here.

    Hope to be clear. And you’re right, unfortunately your changes will be overwriten at next BP update as you hacked core files.


    januzi_pl
    Participant

    @januzi_pl

    Yep, BP has replaced my changes and the changes that I did in *.po (so, eventually in *.mo) files. Is there a way to disable Buddypress from updating translation file with the broken ones? I don’t need poorly translated versions on my site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar