News:

Wondering if this will always be free?  See why free is better.

Main Menu

Language strings and drop menus

Started by Antechinus, October 13, 2008, 07:04:27 PM

Previous topic - Next topic

Antechinus

Got a question here: If we want to use custom language strings in the menus for SMF 2 are they required to be in Themes/default/languages/index.english.php  ?

The reason I ask is because apparently they can't be called from the custom theme's languages/ThemeStrings.english.php file any more (unlike SMF 1.1.x). So what's the correct location for SMF 2?

Nathaniel

They probably can't be called from 'ThemeStrings.english.php' because they are used before you actually load that language file. You could put them in either you 'index.english.php' or 'modifications.english.php' files, both of those language files are loaded for every SMF page.

You should also be able to use 'ThemeStrings.english.php' if you add this code to the start of the 'setupMenuContext' function, where you create the buttons.
loadLanguage('ThemeStrings');
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Antechinus

Hmmm. No worries. So what this means is that to get them to load it'd require a custom edit by the site admin rather than having them load automatically from a file in the custom theme itself. Not necessarily a drama.

Btw, yes I'm aware Modifications.english.php would work as a custom theme file but from the mod installation point of view it's better if that is avoided. In the long run just providing instructions for that code edit (or custom strings that can be dropped into index.english.php) would be less work for the admin.

Antechinus

Hey, I just had an idea. It may be possible for the devs to make that edit a standard feature of SMF 2! That would solve the problem for everyone: just call ThemeStrings early in the piece and there's no drama. I'll turn that into a request. ;)

Nathaniel

Well, it would work. Except that not every theme has the 'ThemeSettings' language. In fact, the only reason that it works for SMF 1.1.x, is that the themes that have/use that language file actually load it within their own 'index.template.php' file, before the rest of the templates are loaded. That means that it was never included in SMF 1.1.x, it was only ever a good way of adding extra language strings for a particular theme.

In this particular case, we are dealing with language strings that are needed by all themes, to show the buttons. So its probably better to create your own language file called 'Site' or something similar and then put it in the language folder for your default theme, so that its loaded by all themes by default. I believe that this is the best solution to your issue, as its unlikely that it will be added to the SMF core when the modifications file already is loaded for every page.

If you want I can show you where to add your language file loading, so that it loads for every page like the 'modifications' language.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Advertisement: