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.

Better differentiation between a PM and an Activity comment?

MasterOneMasterOne ✭✭
edited June 2014 in Vanilla 2.0 - 2.8

Interestingly my forum members confuse the Message and Add Comment buttons on a member's profile page quite often, which means that a lot of messages meant as PM land on our Activity page.

I'd like to rename the two buttons to something more distinctive, like Send a Private Message and Add a public Activity comment.

I just rgrep'ed through the code, Add Comment only appears once hardcoded in applications/dashboard/views/profile/activity.php, but was unable to find the Message button (too many "Message" results).

What's best practice to change those two button wordings?


  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Look at the source of the page and you'll find better strings to look up - for example "SpMessage". That will lead you to that part of code: echo Anchor(Sprite('SpMessage').' '.T('New Message'), '/messages/add', 'Button NewConversation Primary');
    So you have to make a custom translation for 'New Message' in order to change the text of the button

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    For "Add Comment" you'll find that in the sources: .Anchor(T('Activity.Comment', 'Comment') so you have to translate 'Activity.Comment'

  • Options

    I have now tried to add the following to conf/locale.php:

    $Definition['New Message'] = 'Send a new Private Message';
    $Definition['Activity.Comment'] = 'Add a new Public Message';

    but that did not work, because these two go to different places. New Message gets replaced at the top of Inbox in the MeMenu, and I could not find the other one to show up anywhere.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Well, I've used this site to look both things up. Use your browser and the "Inspect element" menu entry in the context menu of the browser in order to find meaningful strings that most probably will result in only a few search results. Then search for that text in the vanilla source code. I'll bet you'll find the T('something') that you need.

    By the way: maybe you are faster if you search inside of the language file for "Message". There shouldn't be as much hits as in the source code.

  • Options
    MasterOneMasterOne ✭✭
    edited June 2014

    Didn't get any closer so far, @R_J, and your mentioning of the language file got me puzzled, because localization is what I was struggling with more than a year ago when I set up our forum:

    Additional locale definition files not working?

    Problem with "Welcome Aboard" e-mail being empty in 2.1b1?

    This may be OT here, but as far as I remember I tried switch from the default locale en-CA to en-US and failed, and I just took a look, in my locales folder there is only the skeleton. Any idea where I can find up-to-date info on localization?

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Since you shouldn't edit any of the core files, you have to add your own language file. Language files of Vanilla are spread around the applications folder and so it would be easier and more clever to look at any language translation file. It could even be a Chinese language file because you are only interested in the left part of each line. Take a look at what I've found in the German language file when I do a search for "message" (I have done a little sorting already):

        Line 137: $Definition['Add a Message'] = 'Eine Nachricht schreiben';
        Line 145: $Definition['Add Message'] = 'Nachricht hinzufügen';
        Line 600: $Definition['Message'] = 'Nachricht';
        Line 846: $Definition['Send a New Message'] = 'Neue Nachricht senden';
        Line 847: $Definition['Send Message'] = 'Nachricht Senden';
        Line 646: $Definition['New Message'] = 'Neue Nachricht';
        Line 44: $Definition['%s message'] = '%s Nachricht';
        Line 45: $Definition['%s messages'] = '%s Nachrichten';
        Line 70: $Definition['(empty message)'] = '(leere Nachricht)';
        Line 74: $Definition['1 message'] = '1 Nachricht';
        Line 105: $Definition['Activity.ConversationMessage.FullHeadline'] = '%1$s hat dir eine %8$s gesendet.';
        Line 106: $Definition['Activity.ConversationMessage.ProfileHeadline'] = '%1$s hat dir eine %8$s gesendet.';
        Line 218: $Definition['Blank Message'] = 'Leere Nachricht';
        Line 502: $Definition['GuestModule.Message'] = 'Es sieht so aus als wärst du neu hier. Wenn du teilnehmen willst, wähle eine der folgenden Optionen:';
        Line 598: $Definition['message'] = 'Nachricht';
        Line 602: $Definition['messages'] = 'Nachrichten';
        Line 604: $Definition['Messages'] = 'Nachrichten';
        Line 668: $Definition['Notify me of private messages.'] = 'Bei privaten Nachrichten benachrichtigen.';
        Line 702: $Definition['PageDetailsMessage'] = '%1$s bis %2$s';
        Line 703: $Definition['PageDetailsMessageFull'] = '%1$s bis %2$s von %3$s';
        Line 718: $Definition['PermissionErrorMessage'] = 'Du hast hierfür keine Berechtigung.';

    See what I mean? You do not have to speak one single word of German because you can understand the term that should be translated ;)

    But that's just a workaround. The better way is to find the correct place in Vanilla code. If you do not understand the structure of Vanilla, it is hard to guess where HTML you are looking at has been generated. Searching the source for some unique words that you can see in the HTML source near the word you want to translate is a good trick that will almost always get you to the php file where you can see the text that you want to translate. It will most probably enclosed in the function T(). Some form elements like Label doesn't need that translation function (because their content is always passed through that function) but you will see the text to translate there nevertheless.

    And to your ancient problem of multiple definition files: why don't you create as many as you like and make one single "master" definitions.php file where you include all others?

Sign In or Register to comment.