Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Acans on September 07, 2010, 11:01:47 PM

Title: Text Strings
Post by: Acans on September 07, 2010, 11:01:47 PM
How do they work?

Basically I want to load text strings from admin.english.php to work in my subs.php, however how do i do that?
Title: Re: Text Strings
Post by: Matthew K. on September 07, 2010, 11:03:32 PM
loadLanguage('Admin');
That loads a language file. Replacing "Admin" with the name of the language file, dropping .language.php, obviously.

Then you can call up strings contained in the file below.

Labradoodle-360
Title: Re: Text Strings
Post by: Acans on September 07, 2010, 11:10:06 PM
Just pop that in subs.php?
Title: Re: Text Strings
Post by: Matthew K. on September 07, 2010, 11:11:44 PM
Well, not just anywhere. But as long as it's in the function where you need to use the strings, yes.
Title: Re: Text Strings
Post by: Acans on September 07, 2010, 11:16:55 PM
I'm tring to load it to the menu, so this function right?

function setupMenuContext()
Title: Re: Text Strings
Post by: Matthew K. on September 07, 2010, 11:20:33 PM
Try this.

./Sources/Subs.php
Code (Find) Select

function setupMenuContext()
{
global $context, $modSettings, $user_info, $txt, $scripturl;

Code (Add After) Select

// Load the Admin Language File...
loadLanguage('Admin');
Title: Re: Text Strings
Post by: Acans on September 07, 2010, 11:34:44 PM
Works perfectly, Thanks Labradoodle-360!
Title: Re: Text Strings
Post by: Matthew K. on September 07, 2010, 11:39:56 PM
Not a problem...glad you got it! :)

Marking topic as resolved.