Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Display Username instead of "You"

edited November 2011 in Vanilla 2.0 - 2.8
Hey!

I have a problem translating Vanilla into german because you can't translate everythink 1:1 ...
For example, when a user changes his/her picture, I can't use the concept which works for the english language..
Therefore I would need to be able to use the username:

$Definition['Activity.PictureChange.FullHeadline'] = 'USERNAME Profilbild wurde geändert.';
$Definition['Activity.PictureChange.ProfileHeadline'] = 'USERNAME Profilbild wurde geändert.';

So, how can I use the username as a variable in local.php?

Thanks a lot!

Clemens

Best Answer

  • UnderDogUnderDog MVP
    Answer ✓
    You have to use a variable, but then the problem is that you need to change some things in the source too. I will give you an example. No guarantees that it works out of the box.

    $Definition['Activity.PictureChange.FullHeadline'] = '%s Profilbild wurde geändert.';See the %s that's the variable. Now in the source you need to change it so that the variable is used. Most likely with the sprintf function.
    There are also some examples in the source already and some threads on the forum with some examples.

Answers

  • UnderDogUnderDog MVP
    Answer ✓
    You have to use a variable, but then the problem is that you need to change some things in the source too. I will give you an example. No guarantees that it works out of the box.

    $Definition['Activity.PictureChange.FullHeadline'] = '%s Profilbild wurde geändert.';See the %s that's the variable. Now in the source you need to change it so that the variable is used. Most likely with the sprintf function.
    There are also some examples in the source already and some threads on the forum with some examples.
  • edited November 2011
    Thanks, but I don't really get it. I wonder why it isn't possible to say somthink like
    $user = THE_USERNAME and then..

    $Definition['Activity.PictureChange.FullHeadline'] = '$user Profilbild wurde geändert.';

    The problem is I don't know where to start to solve the problem, my PHP skills are very... bad.. :)

    Thx
  • ToddTodd Chief Product Officer Vanilla Staff
    We don't have an option for this. Just to be clear though. When you are looking at an activity that you did then you will see "You". Everyone else will see your username.

    I don't know if this helps, but %9$s will be replaced with a gender suffix which some users requested and put in the code. Perhaps you can put that in your headline and see what comes out.
  • fh111fh111 Vanilla Padawan ✭✭

    i am also interested in this. where can i change which variable is used in the source?

Sign In or Register to comment.