This topic has 8 replies, 3 voices, and was last updated 9 years by Catalin.

  • Author
  • #22152
     Tiger007xy
    Participant

    Hello,

    I want to translate the notifications and messages tab in Buddypress in your theme in German.

    My Code in functions.php:

    function cg_current_user_notification_count() {
    //$notifications = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
    $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id(), $format = ‘string’ );
    $count = !empty($notifications) ? count($notifications) : 0;

    echo $count;
    }

    function my_rename_em_nav() {
    global $bp;
    $bp->bp_nav[‘notifications’][‘name’] = ‘Benachrichtigungen <span id=”ab-pending-notifications” class=”pending-count”>’ . print(cg_current_user_notification_count()) . ‘</span>’;

    $bp->bp_nav[‘messages’][‘name’] = ‘Nachrichten <span id=”message-count” class=”message-count”>’ . print(messages_get_unread_count()) . ‘</span>’;
    }

    But the count of the unread notifications and the unread messages is different in my translated version to your version. How do I translate these tabs right with the right count?

    Regards,
    David

    #22633
     Catalin
    Moderator

    Hello,

    Have a look on this plugin:

    https://wordpress.org/plugins/codestyling-localization/

    Let me know if this helps.

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #22886
     collandi
    Participant

    I translate bbPress etc. and create a .mo File.

    All works fine, only the Notifications show jet count and no-count and not a number.
    What is gone wrong.

    Thanks for Help
    Andy

    Attachments:
    You must be logged in to view attached files.
    #23502
     Catalin
    Moderator

    Hello,

    Please send me a link to the page you are referring to.

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #23694
     Tiger007xy
    Participant

    You can solve it in the header.php with jQuery. It is not the best solution, but it works:

    jQuery(document).ready(function(){

    var count = jQuery(“#user-notifications .count”).html();

    if (typeof count != ‘undefined’) {
    var count = “Mitteilungen<span id=’count’>” + count + “</span>”;
    } else {
    var count = “Mitteilungen<span id=’count’>” + 0 + “</span>”;
    }
    jQuery(“#user-notifications”).html(count);

    });

    #23956
     collandi
    Participant
    This reply has been set as private.
    #24347
     Catalin
    Moderator

    Hello,

    Please send me admin credentials for your site to be able to replicate your issue. Reply as private for security reason.

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #24537
     collandi
    Participant
    This reply has been set as private.
    #25014
     Catalin
    Moderator

    catalin@seventhqueen.com

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?