Web Hosting Talk







View Full Version : language packs for php


rumrunner439
05-09-2009, 01:18 PM
ok does anyone know where i can find lauguage packs for a php script. Im getting where i want to add some other languages to my site and not sure where to go for this.
Site is www.1159videos.com it has a spot for languges but its japanese and english but the japanese seems only half done so im wanting to fix this to a more correct version.

Flumps
05-09-2009, 05:16 PM
not sure what your actually after here...

googling language packs for php doesnt show up anything decent either.

do you want your php apps to be in a different language is that it? - then hire people to translate the app for you or use a translator...? :eek:

HivelocityDD
05-09-2009, 06:47 PM
If you are trying to language translation, you can do it in PHP. I think you will have to keep a file which contain base language and its transaltion to other language.

You will have to make use of cookies I think.

rumrunner439
05-10-2009, 01:02 PM
wow i stumped the guru's lol No i mean if someone from a different country wants to visit your site they can view it in thier language on www.1159videos.com you can see, if you look it says language at the top right if you click the japanese it just seems half done i want to make my site better and more languages added.
Thanks for looking guys

etogre
05-10-2009, 02:47 PM
This is called localization, and there's a lot of different ways to go about it.

Here's just a b.s. example I wrote real quick,

// this is if you use a cookie, but maybe you'll use http://en.site.com/ or something instead
$cookie = (array_key_exists('lang', $_COOKIE)) ? $_COOKIE['lang'] : 'english';

switch ($cookie)
{
case 'spanish':
require 'localization/spanish.php';
break;
case 'english':
default:
require 'localization/english.php';
break;
}

echo $lang['slogan']; // probably use this for your template class variable

And then the different localizations:

// localization/english.php
$lang['slogan'] = 'Your one-stop community for media sharing';
$lang['signup'] = 'Sign Up';
$lang['login'] = 'Log in';

// localization/spanish.php
$lang['slogan'] = 'Tu gato es no muy bueno en la cama jajaja';
$lang['signup'] = 'Signo upo';
$lang['login'] = 'Loggo en';

This is how phpBB does it. Wordpress does it in essentially the same way except they encapsulate it, which would probably be the best approach.

mwatkins
05-10-2009, 07:27 PM
ok does anyone know where i can find lauguage packs for a php script.

The terminology isn't "PHP language packs", because there isn't such a thing for PHP itself, or for any programming language. Internationalization / translation depends entirely on the "script". If a "script" provides translation services at all, the methodology used often varies. The example given above is one approach; most larger projects make use of GNU gettext and language files. There are all sorts of tools available for pulling out translatable strings in an application and making them available for translation, but the app has to be written with translatable text in mind. You can't just glue-on translation to an app that isn't made for the purpose.

If your application (what is the application - a one-off custom script or something common) already has more than one translation, then that's a positive and means you can add more translations either by:

a) finding translations *for your script* that are already done. Talk to the community or company which supports the script

b) learn how to develop translation files for your application and perform the work yourself

If your app doesn't have this ability now, then someone has to retrofit it and that means development time.