Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED] Internationalization of custom member profile page field

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 366 Views
  • vodoomoth
    Avatar
    Community Member
    22 Posts

    [SOLVED] Internationalization of custom member profile page field Link to this post

    Hi all,

    I've succeeded in adding a custom "TheWebsite" field to the member profile and it appears fine, whether in the database or on the member profile page. However, I can't seem to find a place where to specify which label should appear on the page.

    I've now spent a few hours trying to find out where to act so as to modify the label. The weird thing is that all it takes to modify the "Email" label is to change it in sapphire/lang/FR.php

    Can someone tell me how I can change the label of a custom member profile field? I'm using version 2.4.7 of SilverStripe.
    Thanks.

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: [SOLVED] Internationalization of custom member profile page field Link to this post

    For information on internationalization check out http://doc.silverstripe.org/framework/en/topics/i18n

    In this case: supposing you have something somewhere that resembles this:

    ... new TextField('TheWebsite', 'The website')

    Internationalize that by doing:

    ...new TextField(
       'TheWebsite',
       _t('Member.THEWEBSITE', 'The website')
    )

    Next in your module or mysite create a file lang/fr_FR.php like this:

    <?php
    global $lang;

    $lang['fr_FR']['Member']['THEWEBSITE'] = 'Something French';

  • vodoomoth
    Avatar
    Community Member
    22 Posts

    Re: [SOLVED] Internationalization of custom member profile page field Link to this post

    Thanks. I was coming back to report that I had succeed and post the details of how when I saw your answer! That's exactly what I did.

    I was missing the 'Member.' fragment. Instead of _t('Member.TheWebsite', 'Website URL'), I was using _t('TheWebsite', 'Website URL').

    366 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.