The following message string:

You haven't made any @buddies, yet.

You can add a @buddy by visiting a user's profile page.

is not translatable.

This string is provided in buddylist.module, line 1717-1723.

The providing function buddylist_empty_text_default() seems to be not ok.

CommentFileSizeAuthor
#11 buddylist_default_text_163947.patch2.13 KBdldege

Comments

dldege’s picture

The issue here is that the default message gets translated and then stored into the variables table. Its not translated dynamically. If you want to change it, simply put your translated text into the text area on the buddylist settings page.

  $form['block_settings']['buddylist_empty_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Show this text in "My @buddies list" if @buddylist is empty', buddylist_translation()),
    '#weight' => 3,
    '#default_value' => variable_get('buddylist_empty_text', t(buddylist_empty_text_default(), buddylist_translation())),
    '#description' => t('If a user has no @buddies and the above checkbox is checked, this message is shown instead of a list.', buddylist_translation()),
  );

OR

you have to clear that variable from the variables table, change your translation words, then revisit the buddylist settings page so that the default string gets the new substitutions.

It might be considered that the untranslated string should be stored in the variables table. I'll see what the other maintainers think about that.

haus’s picture

Thanks very much for your quick reply.

Yes, your suggestion above works for now.

But how can I do it for a multi lingual site?

dldege’s picture

You can't - which is why I think we need to change how this written. I'm hoping for feedback from other maintainers but I think that the solution is to store the template in variables and then translate it when used

For example,

Current way ...

            $block['content'] = variable_get('buddylist_empty_text', t(buddylist_empty_text_default(), buddylist_translation()));

Proposed way ...

            $block['content'] = t(variable_get('buddylist_empty_text', buddylist_empty_text_default()), buddylist_translation());

We'd need to just change a couple lines to make this work.

dldege’s picture

Are you up for creating a patch for this?

haus’s picture

Thanks for your quick reply, again.
I'm afraid that I will not be able to supply a path because I'm not familiar with Drupal-conform programming. I'm just learning, asking and trying to get my site to do what I want.

Therefore I will only be able to change the message texts by using the admin page.

dldege’s picture

OK, no problem - I'll fix this as soon as I talk it over with the other developers.

yngens’s picture

The same problem with 'You currently do not have any pending buddies requests from other users.' and 'You do not have any pending buddies requests that you have made.' on /buddylist/user/buddies/requests

I tried the above suggested methods. It helped with 'You haven't made any @buddies, yet.', but not with these two strings.

dldege’s picture

This would be a slightly different issue where the strings used in the module are missing the translation support needed to convert buddy and buddies. If you can look at give me some line numbers that would be quite helpful.

You'll be looking at the various drupal_set_message() calls in the code and whenever you want buddy/buddies translated it should be @buddy or @buddies and inside a call to the t() function.

yngens’s picture

It is line 847:

  $output = '<p>'. t("!someone currently !does_or_do not have any pending @buddy requests from other users.", array('!someone' => ($viewing_own_account ? t('You') : $account->name), '!does_or_do' => $viewing_own_account ? t('do') : t('does')) + buddylist_translation()) .'</p>';

It correctly gives !someone, but can not find the words in between (currently, not have any pending, requests from other users) in localization module. I tried different ways of putting t( but unfortunately could not figure out the right way.

dldege’s picture

Please submit a new issue for this other problem - this issue will only address the problem with buddylist_empty_text_default()

dldege’s picture

Assigned: Unassigned » dldege
Status: Active » Needs review
StatusFileSize
new2.13 KB

Here is a patch for this made against the current DRUPAL-5 head version of the module.

Please test and report back your outcome.

Thanks.

yngens’s picture

It works, but it is extremely hard to translate into other languages with structures not similar to English. I think it would be much better if you would leave buddies not separately translatable, but together with a string. Anyway, I worked my way out. Thank you very much!

dldege’s picture

Could you please elaborate - I don't follow. The string is user settable and run through the t() function so I don't see why its not translatable in other languages. I don't have any real experience with doing translations so I apologize for my lack of understanding.

yngens’s picture

The structure of the sentences in other languages can be very different or even opposite to English. And sometimes with an order of expressions (words) defined in original code it is real headache to provide sounding translation. The problem with @buddies arises not only with regard to sentence structure, but also with applying different grammatic cases. For example, simple English word "buddies" in Russian will have different forms in different cases:

buddies - друзья (who?), друзей (from whom?), друзьям (to whom?), друзьями (with whom), etc. And it is just impossible to translate one word (as it is suggested now in the module) for it to fit to every different case. That is why I believe that @buddies and other strings that might have different cases in other languages should not be translated separately, but together with the whole expressions.

Anyway, as I said before now it is, at least, possible to translate. Thank you very much!

dldege’s picture

Assigned: dldege » Unassigned
Status: Needs review » Fixed

Thanks for the details. I understand what you mean know. That problem happens even in English - for example I used member/members for buddy/buddies and you get sentences that don't make sense like "Contgratulations, Joe is now your member".

I hope to do more work on how the message confirmations and the strings are handled to address this and other issues.

I've committed this patch though to fix this particular issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)