Hi everybody,
This is my first post.I need a help from you.
i have to display some contents from database in different languages.
This is depends on the EndUser.
He/She shall like to view in Chinese or Japanese or arebian. Whatever
it is, i have to provide the facility to convert to the desired language
from english.
how can i achive in PHP.
anybody can help!, please.
thankyou...
Language Converter
Moderator: General Moderators
Language Converter - reply
hello jito,
your understand is correct.
that is my requirement.i have to produce in different language
at runtime.
your understand is correct.
that is my requirement.i have to produce in different language
at runtime.
PHP will not convert languages by using a set of functions. You would have to define your data in the different languages you will be allowing, and then call the correct data from the database.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
One option is to have the text to be used defined (as constants) based on the language desired. After that, define constants or a hash table that represents bits of the text you wish to use. For example:
The above is just an example. But as far as examples go, it's not entirely a good one. The reason being that we are talking about language. Your site will need a lot of definitions for the various bits of text that will be used on the site. A better option would be ...
Lastly, you may not want to use constants. Setting up hundreds of these may be a bit slower then creating a big hash table (associative array).
Hope that helps.
Cheers,
BDKR
Code: Select all
switch($language)
{
'English':
{
define('PAGE_TITLE', 'Hello!');
define('SHOW_LOVE', 'I Love You');
}
'Spanish':
{
define('PAGE_TITLE', 'Hola!');
define('SHOW_LOVE', 'Te Amo');
}
'Dutch':
{
define('PAGE_TITLE', 'Halo!');
define('SHOW_LOVE', 'Ik houd van u');
}
}Code: Select all
switch($language)
{
'English':
{ require_once('english_definitions.php'); }
'Spanish':
{ require_once('spanish_definitions.php'); }
'Dutch':
{ require_once('dutch_definitions.php'); }
}Hope that helps.
Cheers,
BDKR
Should be 'Hallo' and 'Ik hou van jou'BDKR wrote:Code: Select all
'Dutch': { define('PAGE_TITLE', 'Halo!'); define('SHOW_LOVE', 'Ik houd van u'); } }
Thanx! My Dutch is really rusty as you can see.timvw wrote:Should be 'Hallo' and 'Ik hou van jou'BDKR wrote:Code: Select all
'Dutch': { define('PAGE_TITLE', 'Halo!'); define('SHOW_LOVE', 'Ik houd van u'); } }