Please upgrade here. These earlier versions are no longer being updated and have security issues.

Custom resource overrides in vanilla themes?

ddumontddumont ✭✭
edited May 2011 in Vanilla 2.0 - 2.3
Is it possible to include resource string changes bundled into a theme?

Comments

  • What do you mean by resource string changes?
  • ddumontddumont ✭✭
    edited May 2011
    Providing alternate default text and/or translations for a button or link... etc
  • In the themes themehooks file include the following
    public function Base_Render_Before($Sender) { Gdn::Locale()->Load(__DIR__ . '/definitions.php'); Gdn::Locale()->SetTranslation('Page Not Found', 'FooBar'); // or set single }

    Then in the theme folder created a php file called definitions.php which works the same as a locale file.
  • That or just override the view that contains the button. Such as:

    Creating in the theme folder /views/modules/newdiscussion.php which you can change the content of the original new discussion module.
  • ddumontddumont ✭✭
    mmm yeah I was holding out hope they had something nice that would mirror the base translation system. For instance, if a theme wanted to change a phrase, it would probably be nice to do it in all languages... so it would be desirable to provide a resource tree for supported languages with the string overrides in it.

    This will do for now...
  • ddumontddumont ✭✭
    edited May 2011
    I dug through the forum code and it looks like when you actually apply a theme ( it doesnt work in preview ), it will use your Theme/locale/(locale).php file to provide some definitions. ex: MyTheme/locale/en-CA.php

    I don't think these override text explicitly defined in the application's locale... but since those don't actually contain many of the translatable strings, it doesn't impact what I'm trying to do.

    I did end up needing to issue a pull request into vanilla... I wanted to change the text of the search button, and it wasn't a translated resource. :(
Sign In or Register to comment.