HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Change banner's language
Foloex
New
in Localization
Hello,
I'm starting a forum that will be used in more than one language. How can I serve a different banner depending on the locale used by the user ?
I installed the Multilingual plug-in and the french locales so far.
BTW: is it me or the forum doesn't detect the user's preferred language set in the web browser ?
0
Comments
in vanilla 2.1 you could do this (perhaps the same thing if 2.2 doesn't change it for you).
you could make a request on Github to make it translateable.
you might be able to replace function with a bootstrap config file.
or you request A core change via github ...
to replace the Logo Function in /library/core/class.theme.php
to (use the translation T )
with the above change ....
then you could change your config.php to
$Configuration['Garden']['Title'] = 'BannerTitle';
then you would need to add the definition to each of your locales
e.g. in the French Locale
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
in vanilla 2.2 you could make a feature request for translation to be added to right side config statements similar to above since the function has changed.
you could add a T before all of the C( functions
and do something similar as above and change the respective config statement in config.php
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
You could hook into the app startup, check the local and change the config option in memory.
Tested as working in 2.2. You will need to put your logos in the upload path, but this makes you not need to overwrite core files. You could also set the site title (
Garden.Title
) config based on the locale set.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.
Seems like if you are going to have a multilingual forum. Things should be translateable via locales and not need more plugins for the Title itself. Perhaps better in core. similar to issue a while back for need of user translateable categories.
they were amenable here for categories:
http://vanillaforums.org/discussion/28130/translating-category-names
https://github.com/vanilla/vanilla/issues/2159
https://github.com/vanilla/vanilla/commit/f476a4744303a34379989466a6c748c321b6bad8
similar core change in future version of vanilla could be done for banners one would think.
with regards to your logo image method, a good possiblity until core is amended.
perhaps you could mitigate need for case statement
(not tested).
use same hook and replace entire switch with ...
$localeAbbrev = $sender->Locale . "logo.png";
saveToConfig('Garden.Logo', $localeAbbrev, array('Save' => false));
then you wouldn't need revisit method to update when adding a new locale.
and name all images
frlogo.png
enlogo.png
logo.png - the default.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thank you all for all those solutions. I hoped I missed a configuration that would do that, I guess it's not that simple
I'll try to ask for the feature on github, it's not very urgent and I don't really have time to dive into vanilla's code.