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.

Language Variables

HI,
I'm a theme developer and need to create multi language themes, is there a way to use a language variable instead of static words? I want dynamic codes. for example {Lang_Discussions}

Thanks

Comments

  • KasperKasper Vanilla Staff

    You can use {t c="Foo"} in Smarty to utilize Vanilla's localization functionality. More info can be found here: http://docs.vanillaforums.com/theming/smarty/i18n/

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • Thanks Kasper,
    Can you explain more? Where can I find all {t} strings? i am interested using the default ones.

  • KasperKasper Vanilla Staff

    No problem! All default locale strings can be found on Transifex (account required): https://www.transifex.com/projects/p/vanilla/language/en/

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • edited February 2015

    Thanks Again Master,

    for example :
    $Definition['xctivity'] = 'Xctivity';
    {t c="xctivity"}
    Is that correct?

    Also can i add custom strings?
    themefolder/locale/en-CA.php

    Sorry if I ask too much ... Your information can open a door.
    Sincerely

  • @ThemeSteam said:
    Thanks Again Master,

    for example :
    $Definition['xctivity'] = 'Xctivity';
    {t c="xctivity"}
    Is that correct?

    Also can i add custom strings?
    themefolder/locale/en-CA.php

    Sorry if I ask too much ... Your information can open a door.
    Sincerely

    You should be able to add locale definitions via your theme.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • KasperKasper Vanilla Staff

    No problem! You're spot on, yes; that would be the correct use of {t}. Custom locale strings can indeed be put in the locale/en-CA.php file of your theme. You can of course also add other languages than en-CA.

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • edited February 2015

    Thanks both,

    There is a problem! I create a php file in theme/locale/en-CA.php and wrote:

    <?php if (!defined('APPLICATION')) exit();
    
    $LocaleInfo['skeleton'] = array( // make sure the key of this array is the same as its folder name.
       'Locale'       => 'en-CA',
       'Name'         => 'example',
       'Description'  => 'example',
       'Version'      => '1.0.0',
       'Author'       => "Charlie",
       'AuthorEmail'  => 'Your Email',
       'AuthorUrl'    => 'http://your.domain.com',
       'License'      => 'Your choice of license'
    );
    
    $Definition['Hithere'] = 'Hi there';
    

    Then i wrote this in default.master.tpl:
    {t c="Hithere"}

    But vanilla still shows Hithere!
    Where is my mistake?

    Many Thanks

  • Get rid of the the locale info array. That is not needed.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.