Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 08:52 am EST
Geeklog Forums
Multiple Translations of a Static Page.
Status: offline
kingsley
Forum User
Junior
Registered: 03/17/05
Posts: 29
I am wondering if this is possible. I have tried several different ideas but nothing has come close to working yet.
I have a Center Blocked static page on my home page. I would like to have multiple translations of this page and have the proper translation appear based on the Language setting of the user.
I have thought about setting up multiple pages and using that. I have also thought about having the entire translation in the language files but I can't figure out how to access those files from the Static Page.
If anyone has any ideas it would be very appretiated.
Thanks,
Eric
I have a Center Blocked static page on my home page. I would like to have multiple translations of this page and have the proper translation appear based on the Language setting of the user.
I have thought about setting up multiple pages and using that. I have also thought about having the entire translation in the language files but I can't figure out how to access those files from the Static Page.
If anyone has any ideas it would be very appretiated.
Thanks,
Eric
7
8
Quote
Status: offline
mevans
Forum User
Full Member
Registered: 02/08/04
Posts: 393
Location:Texas
I think the language file might be the best approach. You will need to enable PHP on the static page first. Then, as a test, I did the following:
I placed the following in my english.php language file:
0 => 'This is the english translation',
);
Then, created a static page like this:
echo $LANG_mystaticpage[0];
For the settings on the php page, I have this:
PHP: execute php
That should do it.
Let me know how it works out.
Thanks!
Mark
I placed the following in my english.php language file:
Text Formatted Code
$LANG_mystaticpage = array(0 => 'This is the english translation',
);
Then, created a static page like this:
Text Formatted Code
global $LANG_mystaticpage;echo $LANG_mystaticpage[0];
For the settings on the php page, I have this:
PHP: execute php
That should do it.
Let me know how it works out.
Thanks!
Mark
7
7
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
It's much easier if you just install my multilingual hack (soon to be official).
Then you could use this PHP in the staticpage:
// language parameters
if ($lang == "he") {
$text = something in Hebrew...
} else if ($lang == "fr") {
$text = something in French...
} else {
$text = something in English...
}
// Display the page
echo $text;
language() is taken from the hack.
Obviously that's the most simplistic way. I use more than one parameter for each language, do all sorts of things and only in the end inject everything into $text.
Then you could use this PHP in the staticpage:
Text Formatted Code
$lang = substr(language(), 0, 2);// language parameters
if ($lang == "he") {
$text = something in Hebrew...
} else if ($lang == "fr") {
$text = something in French...
} else {
$text = something in English...
}
// Display the page
echo $text;
language() is taken from the hack.
Obviously that's the most simplistic way. I use more than one parameter for each language, do all sorts of things and only in the end inject everything into $text.
8
8
Quote
All times are EST. The time is now 08:52 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content