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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | user_relationship_blocks.module.260319.patch | 1.12 KB | jaydub |
| #5 | user_relationship_blocks-d6.module.260319.patch | 1.15 KB | jaydub |
| #3 | user_relationship_blocks.module.260319.patch | 851 bytes | jaydub |
| #3 | user_relationship_blocks-d6.module.260319.patch | 869 bytes | jaydub |
Comments
Comment #1
lukas2me commentedHi!
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.
Comment #2
Prasad Shir commentedThanks lulas2me. Will try the solution!
Comment #3
jaydub commentedThe 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.
Comment #4
Prasad Shir commentedjaydub
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.
Comment #5
jaydub commentedre-rolled
Comment #6
alex.k commentedCommitted in http://drupal.org/cvs?commit=279822, thank you. The 6.x branch has been made translatable meanwhile.