Hi

I am trying to configure & use User Relationships module for a non-english site. I could translate most of the strings used by the module to the target languge. However, I am stuck at one place. It appears that the title of the block 'User Relationships : All Relationships' is dynamically generated by the User Relationships Blocks module. That is it displays the value My relationships or User Name's relationships dynamically.

I checked the code of user_relationship_blocks.module. On line 251, there is a function for generating the block title named function theme_user_relationship_block_subject

It appears that the strings 'My' & 's are hardcoded in the code on line 255, so they dont appear in the translation strings list (generated by localization module)

How do I translate the output generated by this function?

Thanks for your support.

Comments

lukas2me’s picture

Hi!
There is my solution, which helped me:
Change line 255 in the theme_user_relationship_block_subject.module file to:
$user_name = ($account->uid == $user->uid) ? t('My') : $account->name.t("'s");

Which made the title translatable so you can translate it using any translation module (my favorite is: i10n_client).

Although I am Drupal beginner so I do not guarantee that it is professional solution but it works.

Prasad Shir’s picture

Thanks lulas2me. Will try the solution!

jaydub’s picture

Version: 5.x-1.1 » 5.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new869 bytes
new851 bytes

The translation of the account name is in the d6 branch via a t() placeholder @username so the patch for d5 is a backport of that.

Both the d5 and d6 branches do not have the 'My' string wrapped in a t() function so adding that in each patch.

Prasad Shir’s picture

jaydub

Thanks for the patch. I tried it for D5. It is partially working. That is, from the block title the word 's is now getting translated, but not the word Relationships

I think the patch needs a small ammendment.

the second line below the changed line is currently

$type_name = 'Relationships';

it should be

$type_name = t('Relationships');

I tried this & it seems to be working with this change.

jaydub’s picture

alex.k’s picture

Status: Needs review » Fixed

Committed in http://drupal.org/cvs?commit=279822, thank you. The 6.x branch has been made translatable meanwhile.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.