Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Language support
#1
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!",
  ) ;
 ?>
Reply
#2
Cool! And maybe a language class to go with it? Like:
PHP Code:
<?php
$lang
->set("English");
echo 
$lang->string("order_name");
?>
Kevin Mark - TheHostingTool Lead Developer
Reply
#3
Ok, good idea!
Reply
#4
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.
Jonny H - THT Main Developer & Founder


Reply
#5
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.
Reply
#6
(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.
Kevin Mark - TheHostingTool Lead Developer
Reply
#7
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.
Jonny H - THT Main Developer & Founder


Reply
#8
Ah. I see. I though you meant having it done word-by-word. Sorry, Jonny. Tongue
Kevin Mark - TheHostingTool Lead Developer
Reply
#9
Ok, i'll try to do this.
Reply
#10
Well, how about that be implemented near v2.0? :p I'm talking too far anyway? :p
Jimmie Lin - Community Manager & THT.Next Developer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)