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.

Locale files included in plugins

Hey all, I was tinkering with https://open.vanillaforums.com/addon/oneallsociallogin-plugin, and I noticed that something was odd with the settings page.

Everything was basically CONSTANT_NAME instead of actual text.

When I forced php to include the locale file included in the plugin (require_once 'C:\xampp\htdocs\vanilla23\plugins\OneallSocialLogin\locale\en.php'; ), everything worked smoothly (even after I then removed that command. Does it cache locales or something?).

Oh, and to get it to work with 2.3 I had to replace these lines

        $Sender->AddCssFile($this->GetResource('design/settings.css', FALSE, FALSE));
        $Sender->AddJsFile($this->GetResource('js/settings.js', FALSE, FALSE)); 

With these.

        $Sender->AddCssFile('settings.css', 'plugins/oneallsociallogin');
        $Sender->AddJsFile('settings.js', 'plugins/oneallsociallogin'); 

Haven't filed a pull request yet since I don't know what's going on with the translation.

Comments

  • One thing I could imagine is that they are using two locale files, that's kind of strange and there is no need for the old definition files.

    The location of locale files are cached, yes. If you use memcached, you will not see that. Otherwise you will find a file called /cache/locale_map.ini. If you open that file and look into it, you would find the path to the OneAll plugin

    Concerning that getResource proble, you might find that informative: https://github.com/vanilla/vanilla/issues/3017

    I guess it is better to make two pull requests instead of one, since you address two different problems: one PR with deleting the old language definitions and one with the getResource elimination

  • Really weird. Deleted the cached locations in /cache/locale_map.ini, then the CONSTANT_NAME problem returned (as one would expect, since I expect locales are only loaded when plugins are switched on).

    Disabled the plugin, reenabled the plugin: everything looks good.

    So the initial problem with locales was probably a fluke. I at least can't replicate it.

    Created a pull request for the getResource bit at least.

Sign In or Register to comment.