phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

How to add a language variable?


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Sat Dec 27, 2008 9:27 pm 
Post subject: How to add a language variable?

I was thinking that I have to put something like this &lang[YOUR_TEXT] and then in language_main.php &lang[YOUR_TEXT] = 'WHAT_YOU_WANT';
But now I see that text without the &lang prefix are still modified by language variables. icon_confused.gif
And how do the forum know where to find it? It can be in language_admin. php, language_main.php... Or it looks up for it everywhere?

I have some idea about this, but not exactly, so if someone could explain it in a easy way so that everyone understands it, would be nice. icon_wink.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
espicom
Board Member



Joined: 24 Nov 2008

Posts: 55
Location: Woodstock, IL


flag
PostPosted: Sat Dec 27, 2008 10:18 pm 
Post subject: Re: How to add a language variable?

The variable name is $lang (not &lang), and yes, you put the text you want it to contain in the "appropriate" language files.

You need to address them "properly":

Code:
$lang['MY_TEXT'] = "This is the text I want to see displayed when I use this variable.";


is how you do it in the appropriate language file, and you use it as:

Code:
$message = $lang['MY_TEXT'] . "text generated by the program";


I strongly suggest you pick up a book on PHP programming, though, before you go too far; this is subject matter beyond just phpBB. Assigning and using variables, especially array variables like $lang[], is a complex subject, easily screwed up by even experienced programmers (don't ask how I know this.... icon_rolleyes.gif ).
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Sun Dec 28, 2008 11:40 am 
Post subject: Re: How to add a language variable?

So if I put is wrong, I risk breaking something? icon_sad.gif

This is something I done myself:
Code:
#-----[ OPEN ]------------------------------------------
#If you use only english language, the following change is not necesary

language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#

$lang['Word_Censor']

#-----[ AFTER ADD ]------------------------------------------
#

$lang['Post Associator'] = 'Post Associator';

Do you think is okay?

I added this because in the "Post Asociator MOD there was not a language variable for the specific link in the Admin Panel. icon_smile.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
Ptirhiik
Board Member



Joined: 19 Nov 2008

Posts: 114


flag
PostPosted: Sun Dec 28, 2008 1:11 pm 
Post subject: Re: How to add a language variable?

Why don't you simply try ? That's what a test environment is for. If there is no issue, it's ok, else, it is not. That simple.

- OoT -
I think I have spoted an issue there, and I hope you will read it the way I want to make it sound, eg very friendly: people tends to be a bit pest off when they meet someone who is asking for a ton of things, most being very basic and requiring nothing else than a try. After all, one of the funniest thing in programing is to try, fail, try another way till success icon_wink.gif.
Back to top
Nightrider
Board Member



Joined: 10 Dec 2008

Posts: 41
Location: St Petersburg, FL


flag
PostPosted: Mon Dec 29, 2008 2:15 am 
Post subject: Re: How to add a language variable?

Like Ptirhiik mentioned, it is always a good idea to try these modifications on Test board first. To be a valid test board, it should be identical to your Live board. If you have the server space and available databases to do so, it is pretty easy to set up your Test board. Here are instructions that should help you accomplish that...

Creating Test phpBB Board
  1. The first thing you want to do is download all of your board files and folders to your PC. You might be able to quickly do this by creating an archive in the Webshell in your Host CPanel. Otherwise use your favorite FTP application to download all files and folders from your phpBB forum folder...
  2. Next, create a folder on your FTP server called Test. Alternatively, if you have the ability to do so, you could create a new test subdomain too
  3. Upload all of the board files and folders that you just downloaded to your PC back to your new Test folder or test subdomain...
  4. Create a new Test database in MySql in your Host CPanel...
  5. Create a database backup of your Live board database from phpMyAdmin in your Host CPanel. You may have to enter through the MySql icon depending on how your CPanel is organized...
  6. Clone your database in phpMyAdmin or Restore your new database backup back to your new Test database. Restoring a backup could take a long time if your database is large, so if you can, Cloning the Live database would be the easiest and fastest option. If you need instructions on how to do this, just ask and I would be happy to provide them for you...
  7. Modify phpbb_config table settings in your Test database that contain a full or partial board path to match the URL path of your new Test board
  8. Open the Test config.php file in your favorite text editor and modify the dbname, dbuser, and dbpasswd settings to match your new Test Database. Then upload the modified config.php file back to your Test board folder or subdomain.
Your new Test board should be good to go at this point. My instructions above may take some time to accomplish, but it is worth it to have a Test board available to test install new MODs or make manual modifications before doing itn your Live board. That would remove any stress that you might have when making the changes and help avoid interrupting your Live community...

Image link
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Fri Jan 02, 2009 2:04 pm 
Post subject: Re: How to add a language variable?

I can't assign a language variable. icon_sad.gif

I've put this is usercp_register.php:
$message = $lang['Profile_updated'] . '<br /><br /><a href="profile.' . $phpEx . '?mode=editprofile">{L_CLICK_RETURN_PROFILE}</a><br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

And I put this in lang_main.php:
$lang['Click_return_profile'] = "Click %shere%s to return to Profile";

What am I doying wrong? icon_cry.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
espicom
Board Member



Joined: 24 Nov 2008

Posts: 55
Location: Woodstock, IL


flag
PostPosted: Fri Jan 02, 2009 2:14 pm 
Post subject: Re: How to add a language variable?

Why not spell the variable's name the same in both places? Computers can be SO literal about things like that...

Quote:
$message = $lang['Profile_updated'] . '<br /><br /><a href="profile.' . $phpEx . '?mode=editprofile">{L_CLICK_RETURN_PROFILE}</a><br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

And I put this in lang_main.php:$lang['Click_return_profile'] = "Click %shere%s to return to Profile";
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Fri Jan 02, 2009 2:26 pm 
Post subject: Re: How to add a language variable?

What do you mean? icon_confused.gif Click_return_profile and Click_return_index are different stuff.

Also, I put this in usercp_register.php:
'L_SIGNATURE' => $lang['Signature'],
'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']),
'L_CLICK_RETURN_PROFILE' => $lang['Click_return_profile'],

Still not working, Oh my God. icon_eek.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
RMcGirr83
Board Member



Joined: 02 Dec 2008

Posts: 53
Location: East Lyme, CT


flag
PostPosted: Fri Jan 02, 2009 5:04 pm 
Post subject: Re: How to add a language variable?

Code:

$message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_profile'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">','</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');


icon_question.gif

_________________
Rich McGirr
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Fri Jan 02, 2009 7:34 pm 
Post subject: Re: How to add a language variable?

Oh my God, you have done it! You are the man, RMcGirr83. icon_wink.gif
Thanks a lot!

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0294 seconds using 15 queries. (SQL 0.0023 Parse 0.0009 Other 0.0262)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo