Advertisement:

Author Topic: Language strings and drop menus  (Read 1981 times)

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,471
  • Master of BBC Abuse
Language strings and drop menus
« on: October 13, 2008, 07:04:27 PM »
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?

Offline Nathaniel

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,117
  • Gender: Male
    • Verbtest.com
Re: Language strings and drop menus
« Reply #1 on: October 14, 2008, 03:27:18 AM »
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.
Code: [Select]
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.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,471
  • Master of BBC Abuse
Re: Language strings and drop menus
« Reply #2 on: October 14, 2008, 03:51:09 AM »
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.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,471
  • Master of BBC Abuse
Re: Language strings and drop menus
« Reply #3 on: October 14, 2008, 03:55:33 AM »
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. ;)

Offline Nathaniel

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,117
  • Gender: Male
    • Verbtest.com
Re: Language strings and drop menus
« Reply #4 on: October 14, 2008, 05:09:33 AM »
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.