Skip to main content
Topic: Using another text/string  (Read 1426 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using another text/string

Hi!

I  "splitted" the information about the number of likes in the user info in portal into two parts, because there will be a break in this portalblock, if someone has given or recieved more than 99 likes:

Userinfo_likes1.jpg

The first line shows now the likes the user has given, the second line the likes the user has recieved:

Userinfo_likes2.jpg

Code: [Select]
if ($data['show_likes'])
{
echo '
    <li ', sp_embed_class('dot'), '>
', $txt['likes'], ': <a href="', $scripturl, '?action=profile;area=showlikes;sa=given;u=', $user_info['id'], '">', $data['member_info']['likes']['given'], ' <span ', sp_embed_class('given'), '></span></a>
</li>
<li ', sp_embed_class('dot'), '>
', $txt['likes'], ': <a href="', $scripturl, '?action=profile;area=showlikes;sa=given;u=', $user_info['id'], '">', ' <a href="', $scripturl, '?action=profile;area=showlikes;sa=received;u=', $user_info['id'], '">', $data['member_info']['likes']['received'], ' <span ', sp_embed_class('received'), '></span></a>
</li>';
}

Is it possible to change this $txt['likes'] in the second line in the user info? O:-)

The german translation for "likes" is "Gefällt mir", which means "I like it" .
It would be nice to use another text in the second line, something like "recieved", "They like it" or "liked by others".

How can I use or create another string for this line?

Re: Using another text/string

Reply #1

Do you need the string to work both in English and German?
If no then just replace:
Code: [Select]
	', $txt['likes'], ':
with:
Code: [Select]
	like received:
If instead you need it to work witg English, then it's a bit more complicated.
Fist you use for example:
$txt['sp_like_received']
instead of the $txt['likes'] in the second row.
The you edit the English sp language file and add at the end:
Code: [Select]
$txt['sp_like_received'] = 'likes received';
then you edit the German file and do the same wusing the German text:
Code: [Select]
$txt['sp_like_received'] = 'german text goesbhere';
Bugs creator.
Features destroyer.
Template killer.

 

Re: Using another text/string

Reply #2

Thank you very much for the explaination, Emanuele! :)

I took the second possibillity and added it in the language files...very easy to do, if you know, how to do it. ;)