Welcome to the Browser-Base Game Zone forums!
<?php// + LineArray ( FileName : string ) : string arraypublic function LineArray( $FileName ) { return array_map( 'rtrim' , file( $FileName ) ) ; } ?>
<?php//--- Language: en $_lang = array (  '_extension_system_' => '_extension_system_',  '_plugin_system::checkin_' => '_plugin_system::checkin_',  '_plugin_system::extension_manager_' => '_plugin_system::extension_manager_',  '_plugin_system::index_' => '_plugin_system::index_',  '_plugin_system::user_manager_' => '_plugin_system::user_manager_',  '_user_email_' => '_user_email_',  '_user_login_' => '_user_login_',  '_user_logout_' => '_user_logout_',  '_user_name_' => '_user_name_',  '_user_password_' => '_user_password_',);?>
<div><?=$GLOBALS['lang']['_plugin_system::checkin_']?></div>
Nearly more than 5 years all of my new code has multilang capability.
Keep the international versions of the game separate, no templates, no text replacements just convert the game to the language for the target audience. Not only will this produce the fastest code but will also create a better community. We've come a across problems with running and administering games that had users that could speak multiple languages. The community itself fragments based on the language barrier.
- are there any tricks/tips for increasing the maintainability for variable approach?
<?php $text = parse_ini_file( 'DE.ini' , false );?><?php echo $text['Username']; ?> <input type="text" ...<?php echo $text['Password']; ?> <input type="text" ...
Load them when you need. And if they where too many language file. First concat them, then include one file.
<?phpif (empty($GLOBALS['lang']) || !is_array($GLOBALS['lang'])) { $GLOBALS['lang'] = array();}$GLOBALS['lang'] = array_merge($GLOBALS['lang'], array(//New data here));
<?php/*** k5_get_language_file#* gets Requested language file** Variables: $o['mbase']:  modlue base* $o['lang_key']: current language key (en, tr, de etc)** @author Sancar Saran <saran@delifisek.net>* @version 1.0*/function k5_get_language_file($o) { $file = $o['mbase'].'language/language_'.$o['lang_key'].'.php'; if(is_file($file)) : require_once($file); endif; if(isset($_lang) and is_array($_lang)) : $GLOBALS['k5']['lang'] = array_merge($GLOBALS['k5']['lang'],$_lang); endif;}?>
Second, note that it does add a layer of complication across the board for all of your future coding. You will be paying for it in small amounts forever. Not that it's a problem if you have enough users to support it, but if nobody ends up using it, it can be a permanent slowdown for your development, albiet small.
Not sure what you mean by library or function, a bit if both I guess. Basically I went with the approach Zeggy first mentioned. I went with arrays for each page.
(in theory, we still lack someone who went that route and could confirm how it works in practice...)
I'm a bit short on time, but when I get home I could perhaps make a small guide if you want to?