THT Community

Full Version: Language support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I'm now creating a multiple language support for THT.

How it works:
-The compile.php file (this file gets always loaded) loads english.php.inc
-english.php.inc contains the language array
-if THT needs text, it gets the text out of the language array
PHP Code:
<?
$lang 
= array(
#-----------------------------#
#         ORDER FORM          #
#-----------------------------#
#-----------------------------#
# order/index.php             #
#-----------------------------#
 
'order_name' => "Order Form",
 
'order_sub' => "Account Creation",
 
'order_info' => "IP Logged: ",
 
'order_error_ipexists' => "IP Already Exists!",
 
'order_error_ipexists2' => "Your IP already exists in the database!",
 
'order_error_nopackages' => "No packages",
 
'order_error_nopackages2' => "Sorry there are no packages on this server!",
  ) ;
 
?>
Cool! And maybe a language class to go with it? Like:
PHP Code:
<?php
$lang
->set("English");
echo 
$lang->string("order_name");
?>
Ok, good idea!
Alfaleader, I still go with my idea, it's the best due to new versions and basically all files being replaced. You should go in the output file and use the preg_replace function with all the HTML searching for words and then replacing them with their foreign counterparts.
Doesn't that slows the server to much? But OK, I'll try to do this. And don't it gives problems?

if 'hello test test' must be replaces, but for this 'test' gets replaced to 'blabla', then will 'hello test test' become 'hello blabla blabla' and it won't get replaced.
(12-14-2008, 06:12 AM)Jonny Wrote: [ -> ]Alfaleader, I still go with my idea, it's the best due to new versions and basically all files being replaced. You should go in the output file and use the preg_replace function with all the HTML searching for words and then replacing them with their foreign counterparts.

Some languages have different sentence structures. So that wouldn't work. MyBB pulls of multiple language support quite nicely. It wouldn't be a bad idea to model that system.
I don't think you grasp, like the language class, it does the same, searches for that sentence eg: "Page doesn't exist" then replaces it with it's counterpart. It would work for all versions, with tweaks. I won't be changing output.php soon. Minus the next version anyway.
Ah. I see. I though you meant having it done word-by-word. Sorry, Jonny. Tongue
Ok, i'll try to do this.
Well, how about that be implemented near v2.0? :p I'm talking too far anyway? :p
Pages: 1 2 3