Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
mgy93
New Member
New Member



Joined: Jan 18, 2008
Posts: 20

PostPosted: Wed Sep 17, 2008 1:21 pm Reply with quote

hi, i make modules a lot but only for english, and was looking over how the site handles for multiple languages


I noticed in the coding it was something like __WELCOME__ , and was wondering how to incorporate this and also what function of php this is so i can read up on it some more


I guess it would be some sort of variable but i am puzzled Question Question Question
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Wed Sep 17, 2008 2:40 pm Reply with quote

In your module index page;
after you 'include' mainfile.php
ensure you name the module, it could be
Code:


$module_name = 'whatever';

then to get the languages you simply do
Code:
 get_lang($module_name);

Don't forget to make sure you have a 'language' folder in the modules directory and atleast the lang-english.php file or it will fall over.

You then need to replace ALL hard coded text in the module with constants and then define each constant in the language file.
The __WELCOME__ you refer to in your post is the language constant - this is the bit that gets translated.

Within nuke there is a naming convention you have to stick to - constants must start with an underscore and the rest of it must in all in uppercase, so the example you gave should actually be _WELCOME

Just for some free extra advice;
Do not include any HTML formating in your language files
Do not use any variables in your language files

Anything else I can help you with with regard to using languages, just ask, it is no problem.

Edit Note: I fixed $module to $module_name in the get_lang() call.
 
View user's profile Send private message Send e-mail
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

PostPosted: Wed Sep 17, 2008 2:40 pm Reply with quote

lang-french.php

define('_WELCOMETO','Bienvenue sur');

lang-dutch.php
define('_WELCOMETO','Welkom');

etc etc

Depanding how you use php define calls can be used various however the are alway's use CAPS.
example:
$modifiedSitename = _WELCOMETO.' '.$sitename;
or:
echo '<a href="index.php"><img src="themes/Anagram/images/logo.gif" align="left" alt="'._WELCOMETO.' '.$sitename.'" border="0" /></a></td>';




A good methode to use for example a downloads module is to use:

define('_DOWNLOAD_WELCOME','Welcome ....etc etc');

Like this you avoid mixing up definitions

Grtzzz wHiTeHaT
 
View user's profile Send private message Send e-mail
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Wed Sep 17, 2008 2:50 pm Reply with quote

All the underscore names are definitions in your language files
They are all in the files
modules/MODULENAME/languages/lang-LANGUAGE.php

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©