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.

Custom resource overrides in vanilla themes?

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

There was an error rendering this rich post.

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

    There was an error rendering this rich post.

  • 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...

    There was an error rendering this rich post.

  • 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. :(

    There was an error rendering this rich post.

Sign In or Register to comment.