4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on March 21, 2003, 11:14:14 PM

Title: [MOD] Language select
Post by: V@no on March 21, 2003, 11:14:14 PM
*Works with all 4images versions*

This MOD was created by Jan, but never "officialy" was published:
http://www.4homepages.de/forum/index.php?topic=3351.0
(and I'm getting PMs very often with questions how did I do that.)

------ Overview -------------------
With this MOD your site visitors will be able chose language for the interface.

There are two versions of this MOD:

A: Using dropdown menu
B: Using images/text as links


----- Installation -------------------
Step 1.

--- Version A ---

Open /includes/page_header.php
Find:
Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,
  "thumb_url" => THUMB_PATH,
Add before:
Code: [Select]
$query_string = '';
if (!empty($HTTP_GET_VARS)) {
  foreach ($HTTP_GET_VARS as $key => $val) {
    if ($key != "l") {
      $query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
    }
  }
}
// We add the session id with "&" not "&"
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');

// Now we can better remove the "l" parameter
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);

// We replace "&" with "&" to make it valid XHTML
$lang_url = str_replace("&", "&", $lang_url);

$lang_select  = "<form action=\"".$lang_url."\" method=\"post\">\n";
$lang_select .= "<select class=\"select\" name=\"l\" onChange=\"submit()\">\n";

// Now we open the "lang" folder, read out all available languages
// and add it as options to the dropdown.
$handle = opendir(ROOT_PATH."lang");

while ($folder = @readdir($handle)) {

  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {

    $lang_select .= "<option value=\"".$folder."\"";

    // If the folder name matches the current language,
    // show the option as selected
    if ($folder == $config['language_dir']) {
      $lang_select .= " selected=\"selected\"";
    }

    $lang_select .= ">".$folder."</option>\n";
  }
}

$lang_select .= "</select>\n</form>";

// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);


--- Version B ---

Open /includes/page_header.php
Find:Find:
Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,
  "thumb_url" => THUMB_PATH,
Add before:
Code: [Select]
$query_string = '';
if (!empty($HTTP_GET_VARS)) {
  foreach ($HTTP_GET_VARS as $key => $val) {
    if ($key != "l") {
      $query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
    }
  }
}
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');
$lang_url = preg_replace("'&(amp|#38);'i", "&", $lang_url);
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);
$lang_url = str_replace("&", "&amp;", $lang_url);
$handle = opendir(ROOT_PATH."lang");
$lang_select = "";
while ($folder = @readdir($handle)) {
  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
    if ($folder != $config['language_dir']) {
      $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";
    }else{
    $lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\">&nbsp;";
    }
  }
}
// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);


Step 2. (for both versions)

Open a temlate where u want your language selector be showed (i.e. /templates/<yourtemplate>/home.html) and add this tag:
{lang_select}



------- Final -----------------------
This script scans /lang/ folder and if it finds any folders inside it, it will add them in the selection.


------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language


This version is based on sessions, that means as soon as browser is closed, the language sellection will be lost.
If u wish have cookies based version, so it would "remmember" the last selected language, then u will need apply these changes:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555
Title: It didn't work out with English version choice?
Post by: noyou on May 11, 2003, 05:37:28 AM
I tried your mod B method, It works fine with my Chinese version, Taiwan version, but didn't work out with the third choice : English version, could tell me how to correct it?
Title: [MOD] Language select
Post by: V@no on May 11, 2003, 06:09:07 AM
try again the code in page_header.php
It displayed some smile emoticon inside the code, I just turned smiles off, should be fine now.
Title: [MOD] Language select
Post by: noyou on May 11, 2003, 07:01:36 AM
It's not the problem of emotion function.

I just tried again, didn't work out.

when I press the English button, it did nothing, the interface was the same as Chinese version. I think your version B script only takes into account of two choice,
Title: [MOD] Language select
Post by: V@no on May 11, 2003, 07:03:57 AM
hmmm...can I see it in action? I bet u did something wrong...exactly this code I use at my site and it works just perfectly
Title: [MOD] Language select
Post by: V@no on May 11, 2003, 07:08:00 AM
I think I know what's the problem ;)
if u said, that your default language is not english, then u'll also need change:
Code: [Select]
preg_match("/english/i"to whatever is your default language
hope that's what it is
Title: [MOD] Language select
Post by: noyou on May 11, 2003, 02:28:45 PM
Quote from: V@no
I think I know what's the problem ;)
if u said, that your default language is not english, then u'll also need change:
Code: [Select]
preg_match("/english/i"to whatever is your default language
hope that's what it is


where to change this code? Or where to put it?
Title: [MOD] Language select
Post by: V@no on May 11, 2003, 02:41:39 PM
Quote from: noyou
where to change this code? Or where to put it?

change it in this MOD code ;)
Title: [MOD] Language select
Post by: noyou on May 12, 2003, 01:26:11 AM
Quote
------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language
_________________[

 
what about the third language image link? Which one is for the third language image link?
Title: [MOD] Language select
Post by: V@no on May 12, 2003, 01:30:46 AM
Quote from: noyou
what about the third language image link? Which one is for the third language image link?

do u see broken image or something? because as I said, it will show as many emages as many folders it can find in /lang/ dir. I have 5 languages at my site, and it works just perfectly.
Title: [MOD] Language select
Post by: noyou on May 13, 2003, 03:23:08 AM
So do I have to create small country flag file *.gif in each /lang/dir?

why *.gif image is broken? didn't show up as an image
Title: [MOD] Language select
Post by: V@no on May 13, 2003, 03:38:15 AM
no, u need the images be placed into /templates/<yourtemplate>/images/ dir.
the filename format must be as it explained in the mod.
Title: [MOD] Language select
Post by: noyou on May 13, 2003, 05:12:34 AM
could you show me how to name *.gif file? Like 1.gif, 2.gif, 3.gif, 4.gif etc?
Title: Re: [MOD] Language select
Post by: V@no on May 13, 2003, 11:03:11 AM
ouh, c'mon :? :wink:
Quote from: V@no
------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language

so, for example for english and french languages u must have:
english.gif
english2.gif
french.gif
french2.gif
Title: [MOD] Language select
Post by: noyou on May 16, 2003, 11:21:14 PM
sorry to bother you V@no, can you tell me the size for the gif file, 80*60 is good? :)
Title: [MOD] Language select
Post by: V@no on May 17, 2003, 06:57:42 AM
Quote from: noyou
can you tell me the size for the gif file, 80*60 is good? :)
:lol: hehe whatever your eyes would enjoy :wink:
Title: [MOD] Language select
Post by: V@no on May 24, 2003, 02:01:02 AM
This little addon could help to someone who likes to add lots of new stuff into 4images (like myself :D).
Sometimes I work with /english/main.php, add some new lang text, but dont have time or wish, at the moment, add/translate that text for the rest of languages I use on my site. So, this addon will use "default" language text to replace missing translation for other languages. Otherwise if there is missing some translation text, it will display just empty blank spaces.

Open /global.php
Find:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
Replace with:
Code: [Select]
$lang_eng = "";
if ($config['language_dir'] != $config['language_dir_default']) {
include(ROOT_PATH.'lang/'.$config['language_dir_default'].'/main.php');
$lang_eng = $lang;
}
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
if ($lang_eng) {
foreach ($lang_eng as $key => $val) {
$lang[$key] = ($lang[$key]) ? $lang[$key] : $lang_eng[$key];
}
}
Title: i think
Post by: mantra on May 24, 2003, 03:39:42 AM
Quote
Open /includes/global.php


I think global.php in root directory V@no.

 :wink:

Thanks this was good hack
Title: Re: i think
Post by: V@no on May 24, 2003, 03:48:06 AM
Quote from: mantra
Quote
Open /includes/global.php


I think global.php in root directory V@no.

ooopss....u are right...wasnt pay attention on that...thx, corrected.
Title: [MOD] Language select
Post by: stephanesantodom on June 16, 2003, 05:13:36 PM
Hello,

On my  website, any of these two mods wants to run... :(   whyyyy??
who wants to help me ?  :cry:
Tanks !
Stephane.
Title: [MOD] Language select
Post by: V@no on June 16, 2003, 09:50:12 PM
Quote from: stephanesantodom
who wants to help me ?  :cry:

I dont...:roll: unless u tell us what exactly the problem is.
Title: Re: [MOD] Language select
Post by: martrix on March 29, 2005, 12:14:50 AM
wonderful feature :) Thank you V@no.

On my page the user does not stay on the "right" language if clicking on certain links - e.g.: "Delete lightbox" or any link with an extra template (in my case index.php?template=help or index.php?template=mods) and goes back to the default language :(
How could I arrange it, that the user stays on "his" language and is not sent back to default  :?:
Title: Re: [MOD] Language select
Post by: V@no on March 29, 2005, 12:30:41 AM
that's because these links are hard-coded into templates, you will have to parse those links through $site_sess->url(); function and then register the result as tags. or u can try add php code directly in your template:
Code: [Select]
<a href="
<?php
global $site_sess;
echo 
$site_sess->url(ROOT_PATH."index.php?template=help");
?>

">Help</a>
Title: Re: [MOD] Language select
Post by: martrix on March 29, 2005, 12:49:19 AM
Fast and reliable :) Thank you again V@no! It works fine.

I'll try to figure out, how to use the $site_sess->url() function, because I don't like PHP in the template files :)
Title: Re: [MOD] Language select
Post by: V@no on March 29, 2005, 12:57:20 AM
u can look how its done in includes/page_header.php
just do same thing ;)
Title: Re: [MOD] Language select
Post by: martrix on March 29, 2005, 01:01:53 AM
OK. TNX  :D

BTW: what about the "Clear Lightbox" link?
That's made with some javascript, asking you, if you really want to clear the lightbox... (default 4images behaviur? I don't remember I've changed that) and if the user clears the lightbox, then he's redirected to the default language too  :o
Title: Re: [MOD] Language select
Post by: V@no on March 29, 2005, 01:03:57 AM
I belive its in lightbox.html template...
Title: Re: [MOD] Language select
Post by: martrix on April 01, 2005, 12:18:26 AM
yes it is :)

The strange thing on it is, that the url is running throught the $site_sess->url(); function, but somehow it looses the lang-attribute  :(
So: deleting lightbox causes going back to the main-language.

One more question: May I somehow save the lang-setting for the visitor - so he gets the same language when visiting the page next time (well, unless he doesn't delete his cookies) I guess I saw such a topic here on the forum, but can't re-find that
Title: Re: [MOD] Language select
Post by: V@no on April 01, 2005, 01:36:29 AM
One more question: May I somehow save the lang-setting for the visitor - so he gets the same language when visiting the page next time (well, unless he doesn't delete his cookies) I guess I saw such a topic here on the forum, but can't re-find that
its possible, try this:
in global.php find:
4images v1.7:
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
    $config['language_dir'] = $l;
  }
}

4images v1.7.x:
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if ($requested_l != $config['language_dir'] && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
    $l = $requested_l;
    $config['language_dir'] = $l;
  }
}

Replace it with:
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (!preg_match('#\.\.[\\\/]#', $requested_l) && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php'))
  {
    if ($requested_l != $config['language_dir'])
    {
      $l = $requested_l;
    }
    $config['language_dir'] = $requested_l;
    setcookie('4images_lang', $requested_l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
  }
}
else
{
  if (isset($HTTP_COOKIE_VARS['4images_lang']) && !preg_match('#\.\.[\\\/]#', $HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.trim($HTTP_COOKIE_VARS['4images_lang']).'/main.php'))
  {
    $l = $config['language_dir'] = trim($HTTP_COOKIE_VARS['4images_lang']);
  }
}
define("LANG_URL", !(isset($HTTP_COOKIE_VARS['4images_lang']) && trim($HTTP_COOKIE_VARS['4images_lang']) == $config['language_dir']));

And if u are using version B of this mod, then replace in includes/page_header.php
Code: [Select]
    $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";with this:
Code: [Select]
    $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";
If you don't want always see l=blah in the url, then in includes/sessions.php find:
    if (!empty($l)) {

Replace it with:
    if (!empty($l) && LANG_URL) {



P.S.
I've updated the code to include the security fix (http://www.4homepages.de/forum/index.php?topic=24526.0)
For these who installed this mod before, you'll need find and replace this block in global.php:
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
    $config['language_dir'] = $l;
    setcookie('4images_lang', $l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
  }
}
else
{
  if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
  {
    $l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
  }
}
Title: Re: [MOD] Language select
Post by: martrix on April 01, 2005, 08:54:28 AM
P.S. I havent test it though.

Then I will  :wink:

I'll report the results as soon as I try that out.
Thank you
Title: Re: [MOD] Language select
Post by: martrix on April 03, 2005, 10:28:23 PM
the cookie works nice :)
thank you.

And there's a wonderful side-effect:  the lightbox problem isn't there anymore tnx to this :)
Title: Re: [MOD] Language select
Post by: V@no on April 03, 2005, 10:34:47 PM
hmmm..actualy I just looked into fresh 4images code and I dont see why it wouldnt use proper language...
Title: Re: [MOD] Language select
Post by: martrix on April 03, 2005, 10:44:40 PM
that's the strange thing I was writing about: I looked into the code of my page and there's also no reason why it should not use the actually chosen language if deleting the lightbox (to url-code is generated by the site_sess fc), but it did not :|
But after applying the cookie-save fc it works fine - because it seems, that the lang attribute is taken from the cookie and not from the ?l=swahili attribute
Title: Re: [MOD] Language select
Post by: V@no on April 03, 2005, 10:54:48 PM
actualy I just checked your site with cookies blocked - I couldnt add any images into the lightbox anymore...ok I unblocked the cookies, added few images in the lightbox, blocked cookies, went to lightbox, clicked clear lightbox - and it redirected me to the page with correct language...without cookies it worked just fine for me (using IE)
Title: Re: [MOD] Language select
Post by: martrix on April 03, 2005, 11:08:35 PM
yes - as I said - now it works fine after I added the few lines for saving the lang with cookies.
But before it did not work on
Win98 (IE5.5/Mozilla,NC)
Win2k (IE6/Firefox)
WinXP (IE6/Firefox)

But I never tried to disallow/allow cookies. I always used the actual setting of the workstation.
That's nothing to think about anymore as it works. Thank you. :)
Title: Re: [MOD] Language select
Post by: Lucifix on April 07, 2005, 09:56:10 AM
I liked this mode, but when I installed dynamics links for googlebot, this mod doesn't work. Yes, with some extra modifications which takes to many time.

Last 3 years I'm using PHPnuke and they have very "simple" system how to change language: cookies! :)

Saidly my php knowledge isn't good enought to insert that mod in 4images system gallery, but maybe someone else could do it. I'm sure that will save many users trouble ;)

Title: Re: [MOD] Language select
Post by: martrix on April 07, 2005, 10:30:50 AM
why don't you read through the replies on page 2?
V@no posted the solution already...  :wink:
Title: Re: [MOD] Language select
Post by: Lucifix on April 09, 2005, 07:34:21 PM
why don't you read through the replies on page 2?
V@no posted the solution already...  :wink:

Gosh, how did I miss that  :roll: thx
Title: Re: [MOD] Language select
Post by: martrix on April 11, 2005, 12:14:14 AM
hm... there's a strange server-dependend behaviour of the flag-sequence if using version B:

on my home-system the flags are shown this way:

1) czech 2) german 3) english

but if uploading it on the *nix server the flags are shown

1) german 2) czech 3) english

 8O

Hm. How comes?
Title: Re: [MOD] Language select
Post by: V@no on April 11, 2005, 12:36:57 AM
I know! that's a first thing I've noticed when moved to linux system...

Lets try sort them through PHP, not through the system:
replace in version A or B:
Code: [Select]
while ($folder = @readdir($handle)){
  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
with:
Code: [Select]
$folders = array();
while ($folders[] = @readdir($handle)) {;}
sort($folders);
foreach ($folders as $folder)
{
  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..")
  {
Title: Re: [MOD] Language select
Post by: TXtaholic on April 26, 2005, 01:46:10 PM
Hi v@no i've asked this question before  :oops: but unfortentaly it got lost with all the threads that has been deleted
kindly on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
i apperciate if u could write the code again
thanks and regards
 
Title: Re: [MOD] Language select
Post by: martrix on April 26, 2005, 03:55:22 PM
Do you really need a completely different template?

Don't the lang-images do the trick? :)
Title: Re: [MOD] Language select
Post by: TXtaholic on April 27, 2005, 10:04:40 AM
Do you really need a completely different template?

Don't the lang-images do the trick? :)

well yeah it might do but once v@no gave me the answer and i think it's better if i use a different table since i use alot of other scripts with 4images
Title: Re: [MOD] Language select
Post by: TXtaholic on May 08, 2005, 03:56:49 PM
I have the files!
i'm trying to trace the code vano wrote earlier  it in order to know how does it work to make it work with fresh gallery,so can anyone help me out?
where should i search besides pager_header.php??
is it global.php?? index??
here's the codes i have
page_header.php
Code: [Select]
[REMOVED]
just give me hint please
Title: Re: [MOD] Language select
Post by: V@no on May 10, 2005, 01:20:04 AM
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!

u'll need delete from global.php:
Code: [Select]
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
and this:
Code: [Select]
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

And then find:
4images older then v1.7.3:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');4images v1.7.3 or newer:
Code: [Select]
include_once(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
insert above:
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish


P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)
Title: Re: [MOD] Language select
Post by: TXtaholic on May 10, 2005, 09:02:07 AM
thank u vano really thank u i will never loose this code again lol i printed it out :D
Title: Re: [MOD] Language select
Post by: TXtaholic on May 10, 2005, 10:57:17 AM
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!

u'll need delete from global.php:
Code: [Select]
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
And then find:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');and insert above this:
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish


P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)

i have this error
Template Error: Couldn't open Template-Pack TEMPLATE_PATH

you may view the gobal if it is ok with u the link it listed bleow
http://immsu.com/global.phps

Note: it's on a fresh 1.7.1 file!!!

and also  i have uploaded the old golbal where the code is working fine  8O
u may please view it here
http://immsu.com/oldglobal.phps



Title: Re: [MOD] Language select
Post by: V@no on May 10, 2005, 02:26:37 PM
sorry, my bad. I've updated the my post.
Title: Re: [MOD] Language select
Post by: TXtaholic on May 12, 2005, 04:17:55 PM
thank you v@no (http://www.1024x768wallpapers.com/smilies/clap.gif)
prefect it's working
Title: Re: [MOD] Language select
Post by: V@no on July 10, 2005, 07:05:23 PM
#p.s. i paste the code on line 129 a shown above.....
where?
please show 3 lines above and 3 lines below the "error" line.
Title: Re: [MOD] Language select
Post by: V@no on July 10, 2005, 08:54:43 PM
I dont see anything wrong with the code u've showed...perhaps u've made a mistake somewhere else.
Title: Re: [MOD] Language select
Post by: IWS_steffen on August 27, 2005, 11:11:52 PM
Hi 4images Gemeinde

Der MOD klappt super. Auch mit 1.7.1.
Die Gallery wechselt ohne Probleme die Sprachen.

Nun noch eine Frage.

Ich möchte auch einige Beschreibungen der Bilder und Kategoerien sowohl in deutsch als auch in englisch anzeigen lassen.
Muss ich die Texte in der main.php (english und deutsch) abspeichern?
Was muss ich auf der Website einbauen, um dies anzuzeigen?
Ein kleines Beispiel wäre sehr hilfreich.

Danke

Grüsse aus Hamburg

Steffen
Title: Re: [MOD] Language select
Post by: Matthias70 on September 10, 2005, 07:52:43 PM
Quote
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish

Hi V@no I've a small problem, with this  :wink:

On my site deutsch is the default language, but I don't need three templates but four  :roll:
When I'm using only three templates, I'm asked for blah_deutsch
So I need four templates like this

blah (Default deutsch)
blah_deutsch
blah_english
blah_spanish[/b]

What do I have to change to get rid of the
blah_deutsch or is everythin O.K.

???

Matthias
Title: Re: [MOD] Language select
Post by: TheOracle on September 10, 2005, 10:38:01 PM
Quote

What do I have to change to get rid of the
blah_deutsch


My personal thanks for requesting this. I have just found out how to do so. ;)

In your includes/page_header.php file,

find :

Quote

while ($folder = @readdir($handle)) {


add below :

Code: [Select]

if ($folder != "blah_deutsch") {


Note : I assume your blah_deutsch folder is definitely not the actual name folder. Simply rename the name from the quote initial. ;)

Then, find :

Quote

$lang_select .= ">".$folder."</option>\n";   
  }
}


replace with :

Code: [Select]

$lang_select .= ">".$folder."</option>\n";
    }
  }
}

Title: Re: [MOD] Language select
Post by: Matthias70 on September 10, 2005, 11:58:46 PM
Hhmm, my page_header.php code looks like this :?:

Code: [Select]
$lang_select = "";
while ($folder = @readdir($handle)) {
 if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
   if ($folder != $config['language_dir']) {
     $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";
   }else{
   $lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\">&nbsp;";
   }
 }
}
Title: Re: [MOD] Language select
Post by: TheOracle on September 11, 2005, 12:56:38 AM
Ok. Let's try this one more time.

Find :

Quote

while ($folder = @readdir($handle)) {

  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {

    $lang_select .= "<option value=\"".$folder."\"";

    // If the folder name matches the current language,
    // show the option as selected

    if ($folder == $config['language_dir']) {
      $lang_select .= " selected=\"selected\"";
    }

    $lang_select .= ">".$folder."</option>\n";
  }
}

$lang_select .= "</select>\n</form>";


replace with :

Code: [Select]

while ($folder = @readdir($handle)) {

if ($folder != "blah_deutsch") {

  if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {

    $lang_select .= "<option value=\"".$folder."\"";

    // If the folder name matches the current language,
    // show the option as selected

    if ($folder == $config['language_dir']) {
      $lang_select .= " selected=\"selected\"";
    }

    $lang_select .= ">".$folder."</option>\n";
    }
  }
}

$lang_select .= "</select>\n</form>";


Remember to modify the blah_deutsch inside the quotes.
Title: Re: [MOD] Language select
Post by: Matthias70 on September 11, 2005, 01:30:37 AM
Hi TheOracle
it does'nt work.

But you are although on the wrong way.
I dont have a problem with the language folder but a problem with the different template folders for different languages

I have a template language folder for english and a template language folder for german.
It's just an addon for the language select mod

Matthias
Title: Re: [MOD] Language select
Post by: TheOracle on September 11, 2005, 01:34:30 AM
Quote

But you are although on the wrong way.


The other way around - look at the topic subject and what you requested. It would seems that it is you who posted on the wrong topic. There's a topic called : ' Members Templates select ' since it looks like you're looking for to customize a template folder selection rather than a language folder.
Title: Re: [MOD] Language select
Post by: Matthias70 on September 11, 2005, 01:43:45 AM
Hi theOracle
I mean this part in the mod language select
http://www.4homepages.de/forum/index.php?topic=4743.msg35908#msg35908

Matthias
Title: Re: [MOD] Language select
Post by: TheOracle on September 11, 2005, 02:06:52 AM
Ah ! I see. ;)

It has already been integrated in the past. Thanks for advising.

Unfortunitely, I cannot give a response on this one at this time since I did not inspect this part of the MOD closely yet.
Title: Re: [MOD] Language select
Post by: Xyu BAM on September 11, 2005, 08:02:07 AM
I've experienced this issue too, its a "bug" in vano's code...
you will need replace
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l; with:
Code: [Select]
if ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "_".$l;
Title: Re: [MOD] Language select
Post by: martrix on September 11, 2005, 11:42:51 AM
Hi X yu, what problem did the bug cause?
Title: Re: [MOD] Language select
Post by: Xyu BAM on September 11, 2005, 12:36:18 PM
The condition V@no used  would return true when l=<lang> was append to the url so, if you append l=<default lang> it would also require additional template for default lang...
Title: Re: [MOD] Language select
Post by: Matthias70 on September 11, 2005, 12:53:41 PM
The condition V@no used  would return true when l=<lang> was append to the url so, if you append l=<default lang> it would also require additional template for default lang...

That's my problem but I have'nt got this code
Replace
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;with:with
Code: [Select]
if ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "_".$l;
That's the code from V@nos extension
http://www.4homepages.de/forum/index.php?topic=4743.msg32679#msg32679

I don't use this extension code, but I've the problem you described.
Any suggestions how I can change the original language select code?

Matthias


Title: Re: [MOD] Language select
Post by: Xyu BAM on September 11, 2005, 07:49:52 PM
I have no idea what are u talking about, but this is what you wrote before:
Hi theOracle
I mean this part in the mod language select
http://www.4homepages.de/forum/index.php?topic=4743.msg35908#msg35908

Matthias
Title: Re: [MOD] Language select
Post by: Matthias70 on September 11, 2005, 08:15:50 PM
I have no idea what are u talking about, but this is what you wrote before:

Sorry it was my fault. I was searching for your code in page_header and functiosn.php but not in global.php  :roll:

Your code is perfect. I just had some problems with my template names so I had to change your code to
Code: [Select]
if ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "".$l;
The problem was just an _ . So 4images was looking for a default_  template.
When I renamed my template to default_ 4images was looking for default...

What do you think? Is this O.K. to take out the _ from yopur code, or could it cause some problems.
It seems to me everything is O.K.

Thank you
Matthias
Title: Re: [MOD] Language select
Post by: IWS_steffen on September 11, 2005, 11:10:33 PM

Nun noch eine Frage.

Ich möchte auch einige Beschreibungen der Bilder und Kategoerien sowohl in deutsch als auch in englisch anzeigen lassen.
Muss ich die Texte in der main.php (english und deutsch) abspeichern?
Was muss ich auf der Website einbauen, um dies anzuzeigen?
Ein kleines Beispiel wäre sehr hilfreich.

Danke

Grüsse aus Hamburg

Steffen

Hallo

Hat denn wirklich keiner einen Tipp für mich:-)

Ohne dass ich auch alle relevanten Daten (Kategoriename, Beschreibung, Schlüsselbegriffe)  sowohl in deutsch als auch in englisch abspeichern kann ist dieser MOD doch nur halb so gut....

Gibt es da nicht eine Lösung?

Danke

Steffen
Title: Re: [MOD] Language select
Post by: Matthias70 on September 11, 2005, 11:17:39 PM
Hallo Steffen,
ich habe zwei Language Ordner.
Einen für Deutsch und einen für Englisch.

Dann habe ich dieses Mod hier installiert und jeder User kann nun zwischen Englisch und Deutsch wählen.

Anschließend habe ich noch das Mulitlanguage Mod installiert und nun ist es auch möglich die Kategorien und Bildernamen in Deutsch und Englisch anzuzeigen. Allerdings nicht gleichzeitig, sondern je nachdem welche Sprache der User wählt.

Ich muss aber zugeben, dass der Einbau des Multilanguage Mod sehr abenteuerlich war. Hab es immer noch nicht vollkommend zufriedenstellend geschafft.

viele Grüße
Matthias
Title: Re: [MOD] Language select
Post by: Xyu BAM on September 12, 2005, 08:16:18 AM
What do you think? Is this O.K. to take out the _ from yopur code, or could it cause some problems.
It seems to me everything is O.K.

as long as your template folder does not contein " _ " in it, (i.e. defaultdeutsch) its fine.
Title: Re: [MOD] Language select
Post by: Matthias70 on September 12, 2005, 11:43:16 AM
as long as your template folder does not contein " _ " in it, (i.e. defaultdeutsch) its fine.

Thank you, for your help
Matthias
Title: Re: [MOD] Language select
Post by: IWS_steffen on September 12, 2005, 09:55:04 PM
Hallo Matthias.

Danke für den Tipp. :)


Anschließend habe ich noch das Mulitlanguage Mod installiert und nun ist es auch möglich die Kategorien und Bildernamen in Deutsch und Englisch anzuzeigen.

Ich habe den MOD gefunden http://www.4homepages.de/forum/index.php?topic=6749.0

Werde ihn die Woche mal ausprobieren. Auf den ersten Blick wirklich etwas undurchsichtig. Werde mal posten wie die Installation geklappt hat.

Bis dann

Steffen
Title: Re: [MOD] Language select
Post by: Matthias70 on September 19, 2005, 03:55:34 PM
I'm using this extension (see code below) for Language Select.
My language-settings are saved for visitors by cookies.
May I somehow save the template-setting for the visitor - so he gets the template for his language, when visiting the page next time (well, unless he doesn't delete his cookies)
At the moment, the language is saved by cookie (code below) but the default_english or default_german folder is not saved...
So visitors which choose english language come back to my site. They see the english language-file but the german default-template.
Difficult I know, but perhaps somebody can understand and help me???

Matthias

on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!

u'll need delete from global.php:
Code: [Select]
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
and this:
Code: [Select]
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

And then find:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');and insert above this:
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
Title: Re: [MOD] Language select
Post by: Xyu BAM on September 20, 2005, 01:43:31 AM
the new code from first step in this topic:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555

try to move it above
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
Title: Re: [MOD] Language select
Post by: Matthias70 on September 20, 2005, 03:38:42 PM
the new code from first step in this topic:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555

try to move it above
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;

Hi, I have some problems with your suggestion.
The relevant code from my global.php looks like this:

Code: [Select]
$config['language_list'] = "(".implode("|", $config['language_list_array']).")";
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
    $config['language_dir'] = $l;
    setcookie('4images_lang', $l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
  }
}
else
{
  if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
  {
    $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
  }
}
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");


What should I change?
Matthias
Title: Re: [MOD] Language select
Post by: Xyu BAM on September 21, 2005, 12:56:15 AM
oh, I see...
what if you replace
Code: [Select]
    $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];with:
Code: [Select]
    $l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
Title: Re: [MOD] Language select
Post by: Matthias70 on September 21, 2005, 01:47:51 PM
oh, I see...
what if you replace
Code: [Select]
    $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];with:
Code: [Select]
    $l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];

That's it  :D
Thank you very much X yu BA M for the time you spent on my problem

Matthias
Title: Re: [MOD] Language select
Post by: martrix on September 21, 2005, 03:38:09 PM
:D nice solution of writing X yu BAM, Matthias :)
Title: Re: [MOD] Language select
Post by: Matthias70 on September 21, 2005, 03:48:08 PM
:D nice solution of writing X yu BAM, Matthias :)

When X yu BAM helps me, I just want to thank X yu BAM and not Xyu BAM  8)
By the way. Your solution is better  :D
Do you know why the name is changed automatically? Did I miss somthing?
Matthias
Title: Re: [MOD] Language select
Post by: martrix on September 21, 2005, 03:59:04 PM
When X yu BAM helps me, I just want to thank X yu BAM and not tra-la-la-la BAM  8)
That's the right way to do it :)

I'd guess the letters x y and u in one row might be on the "word-black-list" because of the possibility of being used as a short form for a vulgarism like tra-la-la or tra-la-la ;) (X yu BAM: nothing against you or your nick... ;) )

have a fun-tra-la-laing-tastic nice time!  :lol:
Title: Re: [MOD] Language select
Post by: mawenzi on September 21, 2005, 04:40:58 PM
(X yu BAM: nothing against you or your nick... ;) )

I think you also know who is X yu BAM ... :mrgreen:
Title: Re: [MOD] Language select
Post by: martrix on September 22, 2005, 01:19:16 PM
I think you also know who is X yu BAM ... :mrgreen:

 8O do I?
Title: Re: [MOD] Language select
Post by: V@no on September 22, 2005, 02:35:34 PM
(X yu BAM: nothing against you or your nick... ;) )
in russian their nick doesn't sound very nice...at all...8O

As of that little fix X yu BAM found, its a little bug ;)
I've updated my orginal post.
Title: Re: [MOD] Language select
Post by: hyde101 on September 22, 2005, 06:08:47 PM
not related to language select mod, but the language select itself.

How can I use {something_language} to parse correctly in a regular section of the site,

Can't we take anything out of main.php, and use it in another part of the template?
Please see what I mean:
http://www.4homepages.de/forum/index.php?topic=6854.0
 
Title: Re: [MOD] Language select
Post by: bibabobu on October 25, 2005, 05:52:45 PM
Thanks all for this great MOD!!!   8)

I think it is working perfect for me. But i am not really sure.
Because i am a little bit confused.

Please could someone have a look at my URL chosing language on top of my site.

Is it true that i must have three template folders for two languages :?:
I have made these 3 folders:
- templates/default
- templates/default_deutsch
- templates/default_english

Because if i delete the templates/default_deutsch folder it does not work for me.

One more question.
If i would like to change for example the background color.
What and where must i make these changings :?:
Do i have to change every css file or home.html of each template folder???

And one more question.
What is the content of these folders :?:
Has there to be all template images in every folder???
Or it is enough only to have them in the default template folder???

Title: Re: [MOD] Language select
Post by: hyde101 on October 25, 2005, 06:32:49 PM
your lanugage seems to be working fine..

for the background, just change the background image and overwrite with same name.

templates/YOURTEMPLATE/images/back1.jpg (or whatever is set by your template!)
Title: Re: [MOD] Language select
Post by: Matthias70 on October 25, 2005, 06:59:43 PM
Please could someone have a look at my URL chosing language on top of my site.


Hallo bibabobu,
deine Laguage-Select Mod läuft.
Das mit den drei Template Ordnern ist bei mir genauso.
Ich habe ebenfalls anfangs versucht, auf zwei Ordner zu reduzieren (die Diskussion müsste noch irgendwo im Forum sein). Habe es dann aber bleiben lassen, da es Probleme gab.

Na ja jetzt passe ich halt ein Template mehr an. So schlimm ist es nicht ;-)
Matthias
Title: Re: [MOD] Language select
Post by: V@no on October 26, 2005, 12:28:03 AM
you must have copy of all your flags in each template.
http://www.industrie-gravuren.de/galerie/templates/default_english/images/french.gif - doesnt exists.
Title: Re: [MOD] Language select
Post by: bibabobu on October 26, 2005, 12:39:19 AM
 :oops:
Thanks V@no!!!
I found out myself. I missed to copy the flags twice to a different folder.
I deleted the former posting.

Now I am very happy. :lol:

Good night!
Title: Re: [MOD] Language select
Post by: MEXX on January 29, 2006, 05:11:30 PM
У меня при смене языка все отображается в неправильной кодеровке. Есть способ исправить? :cry:
Quote
Îáìåíèâàòüñÿ ëè÷íûìè ñîîáùåíèÿìè ñ ëþáûì ïîëüçîâàòåëåì ñàéòà,
Title: Re: [MOD] Language select
Post by: V@no on January 29, 2006, 05:30:28 PM
кодировка в lang/russian/main.php в переменной $lang['charset'] правильная?
в header.html таг {charset} есть?
Title: Re: [MOD] Language select
Post by: MEXX on January 29, 2006, 07:09:31 PM
кодировка в lang/russian/main.php в переменной $lang['charset'] правильная?
в header.html таг {charset} есть?
Кодировка в lang/russian/main.php в переменной $lang['charset'] стоит "windows-1251".
В браузере стоит Кирилица (Windows). Когда меняю язык с русского на английский, то кодировка меняется на Западноевропейскую(ISO).
Меняю обратно вручную- все нормально. Но при переходе на другую страницу- опять иероглифы :(
В header.html тага {charset} нет. :(
Title: Re: [MOD] Language select
Post by: V@no on January 29, 2006, 07:54:50 PM
В header.html тага {charset} нет. :(
В этом и проблема. Проблема решена.
Title: Re: [MOD] Language select
Post by: MEXX on January 29, 2006, 11:54:56 PM
В header.html тага {charset} нет. :(
В этом и проблема. Проблема решена.
Может проблема не в этом? Пробовал по разному. Просто копировал:
<meta http-equiv="content-type" content="text/html; charset={charset}" />
И полностью менял файл header.html. Все без изменений.  :|
Title: Re: [MOD] Language select
Post by: V@no on January 30, 2006, 12:26:07 AM
И полностью менял файл header.html. Все без изменений.  :|
я конечно извиняюсь, но я не верю :P
Надеюсь проверяли не в Опере...
Title: Re: [MOD] Language select
Post by: MEXX on January 30, 2006, 09:50:06 AM
я конечно извиняюсь, но я не верю :P
Надеюсь проверяли не в Опере...
Нет, проверял не в Опере. Для себя еще раз проверил и поменял файл header на оригинал. Все равно ничего не дает.
Русский язык отображается иероглифами пока вручную не поменяешь кодировку. :(
Title: Re: [MOD] Language select
Post by: bibabobu on March 16, 2006, 12:46:14 AM
@vano

Thanks for the great language selection Mod.  I think it is working great on my site.

But now I am trying to validate my site.
Please have a short look according with my w3c validation link at the bottom of my site. On home.html i have no mistakes and  i received the validation.
Going on with validation on other pages for example the anfahrt.html i receive errors by trying to get the validation.
I cannot find the mistakes in the code.
Please could you have a look at this. Because these mistakes are also on other pages where i put in the {lang_select} code.
I am really confused :cry:

Title: Re: [MOD] Language select
Post by: V@no on March 16, 2006, 12:55:51 AM
sorry, I have no knowlege about w3c standarts...
Title: Re: [MOD] Language select
Post by: IcEcReaM on March 16, 2006, 01:00:05 AM
try to replace &l with &amp;l

Title: Re: [MOD] Language select
Post by: bibabobu on March 16, 2006, 07:24:29 AM
In which file?  I think in the page-header. Right?
Title: Re: [MOD] Language select
Post by: Optimum on March 24, 2006, 11:27:47 AM
Hi,

how can I select the display language?

What I mean is, I have a site in two languages. English and Slovenian. User "selects" the overall language at first visit or by which domain he/she enters my page. So for English I'd like to display the 4images in English, but for Slovenians I'd like to use Slovenian language set (which I already created and works fine). I'm only interested in the 4images "front", not the admin area. That can be in English all the time. I'm actually only using a few files (deleted a bunch of stuff): index, menu, categories, detail and search.
How could I do that?

If it's important: I have a "Gallery" button inside my site, which links to 4images index page. You have to think of my site as two different (separate) sites, not one site with two language sets. Two independent sites, on same server, different domain name, one 4images system.

Please help.

TIA,
Mat
Title: Re: [MOD] Language select
Post by: V@no on March 24, 2006, 02:20:31 PM
In global.php replace
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {with:
Code: [Select]
if (!defined('IN_CP') && (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l']))) {
Title: Re: [MOD] Language select
Post by: Optimum on March 24, 2006, 03:05:36 PM
Hi V@no..

thx for helping me again..

ok, I did that.. Hmm.. now what?
How can I "call" English language from English site and Slovenian language from Slovenian site?

TIA!
Mat
Title: Re: [MOD] Language select
Post by: V@no on March 24, 2006, 03:16:21 PM
Now, I'm confused, as I undertstood your question, you wanted ACP stay in same language, while the rest of the site can have two langauges...
what is the question? just adding to the url l=your language is not enough?
Title: Re: [MOD] Language select
Post by: Optimum on March 24, 2006, 03:16:48 PM
With the  "?l=slovenian" or "?l=english" right?

I told you, I'm a total newbie when it comes to php, but I learn fast :)

Pls confirm that it's the right way.


As usual, THANKS A LOT!!

Regards,
Mat


EDIT: Sorry, you replied while I typed. Yeah, it works great! Thanks. I'm a newbie at php and I didn't know the "?l=language" adition to the url, sorry..  :oops:

Thanks!!
Title: Re: [MOD] Language select
Post by: V@no on March 24, 2006, 03:18:30 PM
yes, thats all you need add l=language to the url ;)
Title: Re: [MOD] Language select
Post by: wallpapers on March 24, 2006, 06:57:08 PM
I have a question.

If a member choose a language that not complete is (there were missing some rules in the lang file)
what do a member or visitor see then, a "blank place" or the "default language" (in my case dutch)
I hope you will understand my english  :lol:

thanks
Title: Re: [MOD] Language select
Post by: V@no on March 24, 2006, 11:57:40 PM
the default language
Title: Re: [MOD] Language select
Post by: wallpapers on March 25, 2006, 12:11:46 PM
thanks V@no.
I install the mod soon.
Title: Re: [MOD] Language select
Post by: wallpapers on March 26, 2006, 06:25:37 PM
I have the mod installed on a 1.7.2 version and it works perfect :D
thanks V@no :lol:
Title: Re: [MOD] Language select
Post by: idijotaz on May 22, 2006, 07:55:37 PM
ik i installed it, but is it possible to make categories names in two languages?  (in english: cats, in lithuanian: kates)...
Title: Re: [MOD] Language select
Post by: V@no on May 23, 2006, 03:02:04 AM
there is another mod for that "multi-language for any text"
Title: Re: [MOD] Language select
Post by: V@no on July 21, 2006, 03:27:24 AM
Replace
Code: [Select]
  if ($requested_l != $config['language_dir'] && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
With:
Code: [Select]
  if (file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
Title: Re: [MOD] Language select
Post by: son_gokou on September 26, 2006, 03:47:21 PM
Allright, I Have the language select on my 4images page. But the categories are still in "default language". How can I change that just for language 2?
Title: Re: [MOD] Language select
Post by: V@no on September 27, 2006, 03:30:44 AM
[MOD] Multi-language for any text
Title: Re: [MOD] Language select
Post by: tansamalaja on November 02, 2006, 11:21:38 AM
/index.php&l=deutsch
File Not Found!

Error 404

Sometimes this error appears if I click on "Home" from different categories or detail-sites.
Title: Re: [MOD] Language select
Post by: tansamalaja on November 05, 2006, 04:23:25 PM
How can I fix that a "?" instead of the "&" appears? Possibly is that the solution...
Title: Re: [MOD] Language select
Post by: tansamalaja on November 05, 2006, 06:38:16 PM
We changed the server an since then we got this problem, it's not reproducible, that's the problem - sometimes the error 404 appears, sometimes not. And we got a hint, that the "&" could be the problem
Title: Re: [MOD] Language select
Post by: fgabriel on November 15, 2006, 08:54:14 PM
i put {lang_select} on home.html works fine, select english and works
BUT :?
when  i go to another page like search last images the language backs to the inital that is portuguese

note: im not log in, the page is for guests only

anyone????
regards
Title: Re: [MOD] Language select
Post by: fgabriel on November 16, 2006, 03:28:57 AM
i put {lang_select} on home.html works fine, select english and works
BUT :?
when  i go to another page like search last images the language backs to the inital that is portuguese

note: im not log in, the page is for guests only

anyone????
regards




i have a direct link for last images like that: search.php?l="what variable put in there"&search_new_images=1&sessionid=1ea71ea4fc9eddb69eeed9f69c035158
Title: Re: [MOD] Language select
Post by: KurtW on November 16, 2006, 06:14:37 AM
Hi,

yes, but your links in your page are wrong...
Everythin with your integration is wrong
No link have the: &l=english after the sessionid

Alos your links in home.html are fixed with the link to the categories.
This kind of link is not working :wink:
Every link must comming from php with session and language ... not fixed by yourself

cu
Kurt
Title: Re: [MOD] Language select
Post by: fgabriel on November 16, 2006, 01:16:34 PM
yes i know that but im a initial php user  8)
do you know  how :roll: i resolve this with php, like add/call your variable on every php.file...index, search,categories, etc....
i will very gratefull fot that :)
regards

Title: Re: [MOD] Language select
Post by: giusi83 on November 21, 2006, 11:54:54 AM
Hi all,

Can someone tell me, what i have to change if i want the language drop down menu on the right side?

http://www.gm-photo.ch/4images

thanks a lot in advance.

Giuseppe
Title: Re: [MOD] Language select
Post by: mawenzi on November 21, 2006, 12:46:01 PM
... only on the right side ... than try this in your template ...  :wink:
Code: [Select]
... <tr><td align="right">{lang_select}</td></tr> ...
Title: Re: [MOD] Language select
Post by: giusi83 on November 21, 2006, 01:28:08 PM
in wich file??
Title: Re: [MOD] Language select
Post by: KurtW on November 21, 2006, 04:16:28 PM
... only on the right side ... than try this in your template ...  :wink:
Code: [Select]
... <tr><td align="right">{lang_select}</td></tr> ...

Hi,
this is a little bit wrong....
{lang_select} is in his template not in a table

Search in templates/4dark/home.html:
Code: [Select]
{header}
{lang_select}

replace with this:
Code: [Select]
{header}
<div align="center"><center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" align="right">{lang_select}</td>
  </tr>
</table>
</center></div>

TEST: Put the new code in the end of the code from the header.html
Delete {lang_select} in home.html. Now you have the language in every page



cu
Kurt
Title: Re: [MOD] Language select
Post by: giusi83 on November 21, 2006, 05:00:47 PM
Hi Kurt,

Thank you very much.

So hmmm.. I want the language drop down under the search field.. And now it takes to much place on my site.
Title: Re: [MOD] Language select
Post by: giusi83 on November 23, 2006, 08:46:36 AM
Wie kann das Sprachmenu unterhalb vom Suchfeld platzieren?
Es stört mich auch, das so viel Platz unterhalb und oberhalb ist.

http://www.gm-photo.ch/4images/

Title: Re: [MOD] Language select
Post by: mawenzi on November 23, 2006, 10:19:17 AM
@ giusi83
... platziere dein Sprachmenue doch platzsparend in der "user_box" ...
... setze dazu den Tag {lang_select} in der user_loginform.html und user_logininfo.html ein ...
... damit wird das Menue auch auf allen Seiten angezeigt ...
Title: Re: [MOD] Language select
Post by: giusi83 on November 23, 2006, 10:36:08 AM
Hallo mawenzi,

Danke vielmals für die Lösung!! Finde ich sehr gut! Genau das wollte ich!

Danke vielmals.

Muss mich noch ein bisschen mit HTML befassen.. :-)

Hast du eine gute Referenz?
Title: Re: [MOD] Language select
Post by: mawenzi on November 23, 2006, 10:43:24 AM
... na sieht doch bestens aus ...  :wink:
Title: Re: [MOD] Language select
Post by: KurtW on January 04, 2007, 10:22:01 AM
Hi all, hallo an alle,

D: mit diesem Mod wird beim Auswählen einer anderen Sprache gleichfalls das tempate/Design gewechselt.
E: With this MOD your site visitors will be able chose language and automatically a different template/style.

1:
D: Als erstes den "Language select" MOD einbauen.
E: First integrate the "Language select" MOD

2:
Open global.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
        FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
  echo $lang['no_settings'];
  exit;
}
while ($row = $site_db->fetch_array($result)) {
  $config[$row['setting_name']] = $row['setting_value'];
}
$site_db->free_result();

after add:
Code: [Select]
// registering global variable "user_template"

if (!isset($user_template))
   session_register("user_template");

// check global variable for Empty

 if ($user_template=="" || empty($user_template))
   $user_template = $config['template_dir'];


// set the Template if QueryString is not nothing
if (!empty($l) || $l != "")
$user_template = $l;   

  $config['template_dir'] = $user_template;

3:
D:
Als letztes müssen die neuen template Ordner mit den neuen styles hochgeladen werden.
Namen der jeweiligen template Ordner entsprechen der jeweiligen sprache (deutsch, english, usw.)
Jede Sprache hat nun sein eigenes Style.
Um den nun überflüssigen default Ordner löschen zu können, muss im Admin Controll Panel der
template Ordner "deutsch", bzw. die Standart Sprache, gewählt werden.  Fertig  :wink:

E:
in the last step you must upload the new template directories with the new styles.
The names of the directories must have the language names ( like: english, deutsch, ...)
Now every langugae have a different style.
Now you dont need the default template directory. Before you delete them, go into
your admin controll panel and chose for your default template in the dropdownform this
template with the standart page language. Finish  :wink:


Vorher / before:

www.yourDomain.de
 4images             
   |-- templates 
          |-- default (dein / your standard template)

Nachher / after:

www.yourDomain.de
 4images             
   |-- templates 
          |-- deutsch (dein / your standard template)
          |-- english
          |-- und so weiter / and so on


cu
Kurt

   
Title: Re: [MOD] Language select
Post by: tansamalaja on February 22, 2007, 04:10:46 PM
/index.php&l=deutsch
File Not Found!

Error 404

Sometimes this error appears if I click on "Home" from different categories or detail-sites.
After changing the server weg got this problem the first time, it's not really reproducible,
that's the problem - sometimes the error 404 appears, sometimes not. And we got a hint,
that the "&" could be the problem.

Sometimes we have an "?" before the "l=deutsch", sometimes we have the "&" - is this
okay so?
Title: Re: [MOD] Language select
Post by: bibabobu on March 04, 2007, 09:53:23 PM
@kurtw and all others

how can i get the lang templates go working with 4images version 1.7.4 :?:

I had it working perfect under 1.7.1

Under 1.7.4 it is not changing the templates.
I receive the error that it is not possible to open the choosed template.

Any solutions :?:

EDIT : 8) Ok it is working now again under 1.7.4.
It was the modifcation for template change on page 3 by v@no not the mod by kurtw.
Title: Re: [MOD] Language select
Post by: Acidgod on April 10, 2007, 01:30:32 PM
You also can try this solution:

Code: [Select]
<form name="javascript:location.reload()" id="form1">
  <select name="l" onchange="javascript:submit()">
  <option value="">Sprache</option>
    <option value="english">english</option>
    <option value="deutsch">deutsch</option>
  </select>
</form>

Very simple but it works with 1.7.4... (o:
Title: Re: [MOD] Language select
Post by: Charliexiong on April 14, 2007, 03:09:20 AM
Can anyone help me with this?

if I want (language variable == english)
{ do something}

if (language variable == chinese)
{do something else}

what is the language variable, it seems that $l is not recognized.

thanks
Title: Re: [MOD] Language select
Post by: The Sailor on April 16, 2007, 11:04:06 PM
- hi all i have some problems i need to fix it! because i didnt find the last Mod code to select language evry time theres some error's!
am using 1.7.4 !!!!!

- how can i change evry icone and logo of the script when i change the language!!!

- how can i change the direction of pages to "RTL because evry time i choose the arabic language the direction of pages still "LTR"??????
Title: Re: [MOD] Language select
Post by: Pierre on May 19, 2007, 11:27:52 PM
 
Hello everybody,

About the basic use of this mod, this line:

Code: [Select]
foreach ($HTTP_GET_VARS as $key => $val) {
always returns this error:

Code: [Select]
Parse error: syntax error, unexpected T_AS in /home.xx.x/xxxx/www/x/includes/page_header.php on line 86
I tried to write $_GET, I tried another server provider, I tried some strange and funny lines of code, but the same error is still happening...
Do you know about this unexpected behaviour? Thank you and have a nice day.
 
Title: Re: [MOD] Language select
Post by: zerozero on May 28, 2007, 05:22:48 PM
Hello,

i have a small problem... well... i had 4images 1.7 and had this mod installed. I put 8 textes in the main.php in every language... and put them in the home.html with a "{text1}"
Now i copied the 1.7.4 files in the 4images folder and installed the MOD and the text isn't there... it takes the space but you can't see the text  8O

here my gallery www.mangacardatabase.de.vu (http://www.mangacardatabase.de.vu)

I hope anybody can help me... if not i upload the 1.7 backup so i don't have these problems  :cry:

Thank you very much!

philipp4321
zerozero
--

Hallo,

Ich hab ein kleines Problemchen... Ich hatte vor kurzem noch das 4images 1.7 mit diesem MOD. Hatte zusätzlich noch Texte in die main.php geschrieben und mit {text1} in die home.html eingebunden. Man hat sie auch in jeder Sprache gesehn.
Jetzt hab ich die 1.7.4 version in den 4.images Ordner kopiert und nochmal installiert und man sieht die texte nicht. Es nimmt den Platz den es bräuchte aber man sieht keinen text...   8O

Das ist maine Gallery www.mangacardatabase.de.vu (http://www.mangacardatabase.de.vu)

Ich hoffe es kann mir jemand helfen... ansonsten kopier ich das backup wieder auf den space.

Danke im vorraus

philipp4321
zerozero
Title: Re: [MOD] Language select
Post by: KurtW on May 28, 2007, 05:54:18 PM
Hallo,

in includes/page_header.php

suche:
Code: [Select]
  "charset" => $lang['charset'],danach einfügen:
Code: [Select]
  "text1" => $lang['text1'],usw....


Gruß
Kurt
Title: Re: [MOD] Language select
Post by: zerozero on May 28, 2007, 07:09:02 PM
 :oops:
den hab ich wohl glatt vergessen... konnt mich gar nicht mehr dadran errinern :?

danke nochmal!

achso... deine styles rulen Kurt!

MfG
Philipp4321
Title: Re: [MOD] Language select
Post by: flyfreak on November 09, 2007, 09:52:58 PM
Hey

I have a problem with creating a "headline" (Please have a look at my screenshot)

I have set up the tool, but i don´t know the way to create a "headline"

My code is like this:

Code:
Code: [Select]
                    <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_vaelg_sprog}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    <br />
                        {lang_select}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
Flyfreak
Title: Re: [MOD] Language select
Post by: thunderstrike on November 09, 2007, 10:08:37 PM
// Step 1

Change:

Code: [Select]
<tr>
   <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_vaelg_sprog}</td>
</tr>

for:

Code: [Select]
<tr>
   <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_select_title}</td>
</tr>

// Step 2

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['select_title'] = "Select language";

// Step 3

In includes/page_header.php file,

find:

Quote
"charset" => $lang['charset'],

add after:

Code: [Select]
"lang_select_title" => $lang['select_title'],

Finish.
Title: Re: [MOD] Language select
Post by: flyfreak on November 10, 2007, 09:26:01 AM
Thanks a lot!!
Title: HTML in lang_main.php for multi-language
Post by: mato72 on December 05, 2007, 05:05:44 PM
Hie there...
I use this mod:
http://www.4homepages.de/forum/index.php?topic=4743.0
So the Content-Text is saved/written in the directory "lang", main.php
If I do so, I could not use normal html-hyperlinks.
If I do, there will be nothing shown on the Site.
What can I do?
What do I wrong?

EDITH:
Now I get this error-message by using html-hyperlinks:
Parse error: syntax error, unexpected T_STRING in

Hallo
Ich nutze diesen Mod:
http://www.4homepages.de/forum/index.php?topic=4743.0
Wenn ich meinen text in die main.php im Ordner "lang" schreibe und dabei html-links verwende, wird in der normal Seite nichts angezeigt.
Was mache ich verkehrt?
Was muss ich anders machen?

EDIT
jetzt bekomme ich fehlermeldungen wenn ich html-hyperlinks nutze:
Parse error: syntax error, unexpected T_STRING in
Title: Re: HTML in lang_main.php for multi-language
Post by: mato72 on December 05, 2007, 05:25:03 PM
Ok, habs selber über google herausgefunden.
Es liegt an den Gänsefüsschen: "
Das darf man nur mit einem Hochkomma machen : '
Ein Link sieht dann eben nicht mehr so aus:
<a href="http://www

sondern:
<a href='http://www

Das muss man ja erstmal wissen...
Somit schliesse ich den Thread auch gleich wieder....
Title: Re: [MOD] Language select & Sessions
Post by: shadowhunter on January 24, 2008, 11:36:50 AM
Hallo!
Ich habe gemerkt, dass in der Session die ausgewählte Sprache nicht angezeigt wird.
Somit sieht man z.B im ACP die ausgewählte Sprache nicht.
Mich würde noch wunder nehmen welche Sprache die Besucher benutzen!
Wie könnte man dies machen, dass wenn die ausgewählte Sprache nicht der Standartsprache entspricht diese dann in der Session (in session_location mit "&l=*******") anzeigen?
Ich benutze: Vers 1.7.4 & die Variante B mit Bilder dieses MODs
Ich bin euch dankbar für Antworten!
Schönen Tag & Gruss
Title: Re: [MOD] Language select
Post by: Alessio on August 27, 2008, 03:49:52 PM
Is it possible to detect automatically the language (by IP or by OS language) if are not present cookie?
Title: Re: [MOD] Language select
Post by: metal_brain on October 12, 2008, 09:22:47 AM
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!

u'll need delete from global.php:
Code: [Select]
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
and this:
Code: [Select]
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

And then find:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');and insert above this:
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish


P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)


Hi V@no
kindly is it possible to update the code so it works with 4images 1.7.6
Apparently  the global.php is 1.7.6 is not the same as the old one  :oops:
i have tried using KurtW code which is found here
http://www.4homepages.de/forum/index.php?topic=4743.msg85742#msg85742
but it didn't work
time & again we apperciate your help & your prompt replies
thanks in advance
Title: Re: [MOD] Language select
Post by: V@no on October 12, 2008, 09:45:03 AM
is it possible to update the code so it works with 4images 1.7.6
Apparently  the global.php is 1.7.6 is not the same as the old one  :oops:
Done (http://www.4homepages.de/forum/index.php?topic=4743.msg35908#msg35908)
Title: Re: [MOD] Language select
Post by: metal_brain on October 12, 2008, 10:33:11 AM
V@no thank you very much   :D
 :thumbup:
Title: Re: [MOD] Language select
Post by: Alessio on October 12, 2008, 08:30:36 PM
Is it possible to detect automatically the language (by IP or by OS language) if are not present cookie?

Any solution?
Title: Re: [MOD] Language select
Post by: V@no on October 13, 2008, 02:47:22 AM
Is it possible to detect automatically the language (by IP or by OS language) if are not present cookie?

Assuming you are using this code:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555

Replace the code in global.php with this:
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
    if (!isset($HTTP_COOKIE_VARS['4images_lang'])) $l = $requested_l;
    $config['language_dir'] = $requested_l;
    setcookie('4images_lang', $requested_l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
  }
}
else
{
  if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
  {
    if ($HTTP_COOKIE_VARS['4images_lang'] != $config['language_dir']) $l = $HTTP_COOKIE_VARS['4images_lang'];
    $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
  }
  else
  {
    //http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
    $lang_codes = array(
      "aa"=>"afar","ab"=>"abkhazian","ae"=>"avestan","af"=>"afrikaans","ak"=>"akan","am"=>"amharic","an"=>"aragonese","ar"=>"arabic","as"=>"assamese","av"=>"avaric","ay"=>"aymara","az"=>"azerbaijani",
      "ba"=>"bashkir","be"=>"belarusian","bg"=>"bulgarian","bh"=>"bihari","bi"=>"bislama","bm"=>"bambara","bn"=>"bengali","bo"=>"tibetan","br"=>"breton","bs"=>"bosnian",
      "ca"=>"catalan","ce"=>"chechen","ch"=>"chamorro","co"=>"corsican","cr"=>"cree","cs"=>"czech","cu"=>"church_slavic","cv"=>"chuvash","cy"=>"welsh",
      "da"=>"danish","de"=>"deutsch","dv"=>"divehi","dz"=>"dzongkha",
      "ee"=>"ewe","el"=>"greek","en"=>"english","eo"=>"esperanto","es"=>"spanish","et"=>"estonian","eu"=>"basque",
      "fa"=>"persian","ff"=>"fulah","fi"=>"finnish","fj"=>"fijian","fo"=>"faroese","fr"=>"french","fy"=>"frisian",
      "ga"=>"irish","gd"=>"gaelic","gl"=>"galician","gn"=>"guarani","gu"=>"gujarati","gv"=>"manx",
      "ha"=>"hausa","he"=>"hebrew","hi"=>"hindi","ho"=>"hiri_motu","hr"=>"croatian","ht"=>"haitian","hu"=>"hungarian","hy"=>"armenian","hz"=>"herero",
      "ia"=>"interlingua","id"=>"indonesian","ie"=>"interlingue","ig"=>"igbo","ii"=>"sichuan_yi","ik"=>"inupiaq","io"=>"ido","is"=>"icelandic","it"=>"italian","iu"=>"inuktitut",
      "ja"=>"japanese","jv"=>"javanese",
      "ka"=>"georgian","kg"=>"kongo","ki"=>"kikuyu","kj"=>"kuanyama","kk"=>"kazakh","kl"=>"kalaallisut","km"=>"khmer","kn"=>"kannada","ko"=>"korean","kr"=>"kanuri","ks"=>"kashmiri","ku"=>"kurdish","kv"=>"komi","kw"=>"cornish","ky"=>"kirghiz",
      "la"=>"latin","lb"=>"luxembourgish","lg"=>"ganda","li"=>"limburgan","ln"=>"lingala","lo"=>"lao","lt"=>"lithuanian","lu"=>"luba-katanga","lv"=>"latvian",
      "mg"=>"malagasy","mh"=>"marshallese","mi"=>"maori","mk"=>"macedonian","ml"=>"malayalam","mn"=>"mongolian","mo"=>"moldavian","mr"=>"marathi","ms"=>"malay","mt"=>"maltese","my"=>"burmese",
      "na"=>"nauru","nb"=>"norwegian","nd"=>"ndebele","ne"=>"nepali","ng"=>"ndonga","nl"=>"dutch","nn"=>"norwegian","no"=>"norwegian","nr"=>"ndebele","nv"=>"navajo","ny"=>"chichewa",
      "oc"=>"occitan","oj"=>"ojibwa","om"=>"oromo","or"=>"oriya","os"=>"ossetian",
      "pa"=>"panjabi","pi"=>"pali","pl"=>"polish","ps"=>"pushto","pt"=>"portuguese",
      "qu"=>"quechua",
      "rm"=>"romansh","rn"=>"rundi","ro"=>"romanian","ru"=>"russian","rw"=>"kinyarwanda",
      "sa"=>"sanskrit","sc"=>"sardinian","sd"=>"sindhi","se"=>"sami","sg"=>"sango","si"=>"sinhala","sk"=>"slovak","sl"=>"slovenian","sm"=>"samoan","sn"=>"shona","so"=>"somali","sq"=>"albanian","sr"=>"serbian","ss"=>"swati","st"=>"sotho","su"=>"sundanese","sv"=>"swedish","sw"=>"swahili",
      "ta"=>"tamil","te"=>"telugu","tg"=>"tajik","th"=>"thai","ti"=>"tigrinya","tk"=>"turkmen","tl"=>"tagalog","tn"=>"tswana","to"=>"tonga","tr"=>"turkish","ts"=>"tsonga","tt"=>"tatar","tw"=>"twi","ty"=>"tahitian",
      "ug"=>"uighur","uk"=>"ukrainian","ur"=>"urdu","uz"=>"uzbek",
      "ve"=>"venda","vi"=>"vietnamese","vo"=>"volapük",
      "wa"=>"walloon","wo"=>"wolof",
      "xh"=>"xhosa",
      "yi"=>"yiddish","yo"=>"yoruba",
      "za"=>"zhuang","zh"=>"chinese","zu"=>"zulu",
    );
   
    //http://www.thefutureoftheweb.com/blog/use-accept-language-header
    $langs = array();
   
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        // break up string into pieces (languages and q factors)
        preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
   
        if (count($lang_parse[1])) {
            // create a list like "en" => 0.8
            $langs = array_combine($lang_parse[1], $lang_parse[4]);
       
            // set default to 1 for any without q factor
            foreach ($langs as $key => $val) {
                if ($val === '') $langs[$key] = 1;
            }
   
            // sort list based on value
            arsort($langs, SORT_NUMERIC);
        }
    }
    foreach ($langs as $key => $val)
    {
      $key = explode("-", $key);
      if (isset($lang_codes[$key[0]]) && file_exists(ROOT_PATH.'lang/'.$lang_codes[$key[0]].'/main.php'))
      {
        $config['language_dir'] = $lang_codes[$key[0]];
        if ($lang_codes[$key[0]] != $config['language_dir']) $l = $lang_codes[$key[0]];
        setcookie('4images_lang', $lang_codes[$key[0]], time()+ 60 * 60 * 24 * 365, "/", "", 0);
        break;
      }
    }
    unset($langs);
    unset($lang_codes);
  }
}
Title: Re: [MOD] Language select
Post by: Alessio on October 13, 2008, 08:05:36 PM
Thank you Vano!
One question. My website is available in two languages only, what happens with the others? Is the default language selected?
Title: Re: [MOD] Language select
Post by: V@no on October 13, 2008, 11:43:29 PM
Yes, if visitor's language not detected or site doesn't have such language, then default language used (set in the settings)
Title: Re: [MOD] Language select
Post by: robertx on October 25, 2008, 08:27:01 PM
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!

u'll need delete from global.php:
Code: [Select]
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
and this:
Code: [Select]
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

And then find:
4images older then v1.7.3:
Code: [Select]
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');4images v1.7.3 or newer:
Code: [Select]
include_once(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
insert above:
Code: [Select]
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);

With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish


P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)


I have try that it s working perfect but i have a BIG problem . I have installed Buddy Mod and that is working only for default template . I mean that the icon don t show in another template just in default template .
How could i resolve that ?

Thanks
Title: Re: [MOD] Language select
Post by: V@no on October 25, 2008, 09:28:01 PM
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.
Title: Re: [MOD] Language select
Post by: Jan-Lukas on October 25, 2008, 10:34:41 PM
Klappt perfekt in Version 1.7.6  :thumbup:
man muss nur die images in den richtigen Ordner packen.

LG Harald
Title: Re: [MOD] Language select
Post by: robertx on October 26, 2008, 02:15:34 PM
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.

Hello V@no and thanks for your support .
The Buddy mod is here http://www.4homepages.de/forum/index.php?topic=19755.0.
Also please see atached 2 screenshots from english and romanian language (http://)
Title: Re: [MOD] Language select
Post by: om6acw on October 26, 2008, 05:36:39 PM
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.

Hello V@no and thanks for your support .
The Buddy mod is here http://www.4homepages.de/forum/index.php?topic=19755.0.
Also please see atached 2 screenshots from english and romanian language (http://)

You have to upload your romanian button in to your_template/images_romanian folder if you don't have one you should create him.
Title: Re: [MOD] Language select
Post by: robertx on October 26, 2008, 06:36:53 PM
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.

Hello V@no and thanks for your support .
The Buddy mod is here http://www.4homepages.de/forum/index.php?topic=19755.0.
Also please see atached 2 screenshots from english and romanian language (http://)

You have to upload your romanian button in to your_template/images_romanian folder if you don't have one you should create him.

Hello . Thanks . That was the problem . Thanks for help .

What you think will me the best sollution for set up the romanian language as default ?
Title: Re: [MOD] Language select
Post by: V@no on October 26, 2008, 07:30:22 PM
What you think will me the best sollution for set up the romanian language as default ?
It is really up to you. ;)
Title: Re: [MOD] Language select
Post by: robertx on October 26, 2008, 09:44:59 PM
What you think will me the best sollution for set up the romanian language as default ?
It is really up to you. ;)

Hello V@no  . I have setup from admin romanian as default . the default template default and for english template default_ english . It 's working ok for romanian but when i try to select english the language is unchanged , in this mode will work just romanian . why ?
Title: Re: [MOD] Language select
Post by: robertx on October 29, 2008, 09:29:26 AM
What you think will me the best sollution for set up the romanian language as default ?
It is really up to you. ;)

Hello V@no  . I have setup from admin romanian as default . the default template default and for english template default_ english . It 's working ok for romanian but when i try to select english the language is unchanged , in this mode will work just romanian . why ?

Could any1 help me whit that ?
Title: Re: [MOD] Language select
Post by: V@nо on October 29, 2008, 06:31:08 PM
whitch code exactly do you use? did you try reinstal, maybe you made a misstake?
Title: Re: [MOD] Language select
Post by: Omsky on November 15, 2008, 12:23:24 AM
possible make, individual photo language names and description on other languages pages, for all photos?

example
english link:
http://site.com/r-p-40-paris-hilton-41-paris-hilton---celebrity-star-photo-(010)-5359.htm
photo name: Paris Hilton - celebrity star photo
Description:     Paris Hilton - celebrity star photo
Keywords:    Paris, Hilton, star, photo, shoot

example
russian link:
http://site.com/r-p-40-paris-hilton-41-paris-hilton---celebrity-star-photo-(010)-5359.htm?l=russian
photo name: Пэрис Хилтон - фотография знаменитости
Описание: Пэрис Хилтон - фотка
Слова для поиска:    Пэрис, Перис, звезда, фото, снимок
Title: Re: [MOD] Language select
Post by: V@no on November 15, 2008, 01:47:37 AM
Try [MOD] Multi-Language support for any text (http://www.4homepages.de/forum/index.php?topic=6749.0)
Title: Re: [MOD] Language select
Post by: nhomauhoaphuong on November 16, 2008, 03:30:05 AM
hi,
i changed the charset for my vietnamese font from ISO- to utf-8 and now in ACP and also on some images when i viewed it's showing this error too.  it's showing this error .. please help me to solved this.
thanks


Quote
Warning: Cannot modify header information - headers already sent by (output started at /home1/chuahuon/public_html/hinhanh/lang/vietnamese/main.php:1) in /home1/chuahuon/public_html/hinhanh/admin/admin_functions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at /home1/chuahuon/public_html/hinhanh/lang/vietnamese/main.php:1) in /home1/chuahuon/public_html/hinhanh/admin/admin_functions.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home1/chuahuon/public_html/hinhanh/lang/vietnamese/main.php:1) in /home1/chuahuon/public_html/hinhanh/admin/admin_functions.php on line 170

Warning: Cannot modify header information - headers already sent by (output started at /home1/chuahuon/public_html/hinhanh/lang/vietnamese/main.php:1) in /home1/chuahuon/public_html/hinhanh/admin/admin_functions.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at /home1/chuahuon/public_html/hinhanh/lang/vietnamese/main.php:1) in /home1/chuahuon/public_html/hinhanh/admin/admin_functions.php on line 172
Title: Re: [MOD] Language select
Post by: V@no on November 16, 2008, 03:42:27 AM
As you've noticed your previous reply no longer under this topic anymore. It's because your issue has nothing to do with this topic.
http://www.4homepages.de/forum/index.php?topic=21404.0
Title: Re: [MOD] Language select
Post by: nhomauhoaphuong on November 16, 2008, 04:01:57 AM
i noticed that but i though i was wrong. but i dont think any body answer nor helping me over that topic, please help me out. 
Title: Re: [MOD] Language select
Post by: AntiNSA2 on April 01, 2009, 12:58:58 PM
This has always been a great  mod, but for some reason it stops the Flash Keyword Cloud mod from working in every language except for English... .any one have any ideas on 1.7.6 ???
Title: Re: [MOD] Language select
Post by: AntiNSA2 on April 01, 2009, 01:13:19 PM
Can you clarify this? you said to use this code:
Code: [Select]
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
  $requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
  if (file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
    if (!isset($HTTP_COOKIE_VARS['4images_lang'])) $l = $requested_l;
    $config['language_dir'] = $requested_l;
    setcookie('4images_lang', $requested_l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
  }
}
else
{
  if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
  {
    if ($HTTP_COOKIE_VARS['4images_lang'] != $config['language_dir']) $l = $HTTP_COOKIE_VARS['4images_lang'];
    $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
  }
  else
  {
    //http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
    $lang_codes = array(
      "aa"=>"afar","ab"=>"abkhazian","ae"=>"avestan","af"=>"afrikaans","ak"=>"akan","am"=>"amharic","an"=>"aragonese","ar"=>"arabic","as"=>"assamese","av"=>"avaric","ay"=>"aymara","az"=>"azerbaijani",
      "ba"=>"bashkir","be"=>"belarusian","bg"=>"bulgarian","bh"=>"bihari","bi"=>"bislama","bm"=>"bambara","bn"=>"bengali","bo"=>"tibetan","br"=>"breton","bs"=>"bosnian",
      "ca"=>"catalan","ce"=>"chechen","ch"=>"chamorro","co"=>"corsican","cr"=>"cree","cs"=>"czech","cu"=>"church_slavic","cv"=>"chuvash","cy"=>"welsh",
      "da"=>"danish","de"=>"deutsch","dv"=>"divehi","dz"=>"dzongkha",
      "ee"=>"ewe","el"=>"greek","en"=>"english","eo"=>"esperanto","es"=>"spanish","et"=>"estonian","eu"=>"basque",
      "fa"=>"persian","ff"=>"fulah","fi"=>"finnish","fj"=>"fijian","fo"=>"faroese","fr"=>"french","fy"=>"frisian",
      "ga"=>"irish","gd"=>"gaelic","gl"=>"galician","gn"=>"guarani","gu"=>"gujarati","gv"=>"manx",
      "ha"=>"hausa","he"=>"hebrew","hi"=>"hindi","ho"=>"hiri_motu","hr"=>"croatian","ht"=>"haitian","hu"=>"hungarian","hy"=>"armenian","hz"=>"herero",
      "ia"=>"interlingua","id"=>"indonesian","ie"=>"interlingue","ig"=>"igbo","ii"=>"sichuan_yi","ik"=>"inupiaq","io"=>"ido","is"=>"icelandic","it"=>"italian","iu"=>"inuktitut",
      "ja"=>"japanese","jv"=>"javanese",
      "ka"=>"georgian","kg"=>"kongo","ki"=>"kikuyu","kj"=>"kuanyama","kk"=>"kazakh","kl"=>"kalaallisut","km"=>"khmer","kn"=>"kannada","ko"=>"korean","kr"=>"kanuri","ks"=>"kashmiri","ku"=>"kurdish","kv"=>"komi","kw"=>"cornish","ky"=>"kirghiz",
      "la"=>"latin","lb"=>"luxembourgish","lg"=>"ganda","li"=>"limburgan","ln"=>"lingala","lo"=>"lao","lt"=>"lithuanian","lu"=>"luba-katanga","lv"=>"latvian",
      "mg"=>"malagasy","mh"=>"marshallese","mi"=>"maori","mk"=>"macedonian","ml"=>"malayalam","mn"=>"mongolian","mo"=>"moldavian","mr"=>"marathi","ms"=>"malay","mt"=>"maltese","my"=>"burmese",
      "na"=>"nauru","nb"=>"norwegian","nd"=>"ndebele","ne"=>"nepali","ng"=>"ndonga","nl"=>"dutch","nn"=>"norwegian","no"=>"norwegian","nr"=>"ndebele","nv"=>"navajo","ny"=>"chichewa",
      "oc"=>"occitan","oj"=>"ojibwa","om"=>"oromo","or"=>"oriya","os"=>"ossetian",
      "pa"=>"panjabi","pi"=>"pali","pl"=>"polish","ps"=>"pushto","pt"=>"portuguese",
      "qu"=>"quechua",
      "rm"=>"romansh","rn"=>"rundi","ro"=>"romanian","ru"=>"russian","rw"=>"kinyarwanda",
      "sa"=>"sanskrit","sc"=>"sardinian","sd"=>"sindhi","se"=>"sami","sg"=>"sango","si"=>"sinhala","sk"=>"slovak","sl"=>"slovenian","sm"=>"samoan","sn"=>"shona","so"=>"somali","sq"=>"albanian","sr"=>"serbian","ss"=>"swati","st"=>"sotho","su"=>"sundanese","sv"=>"swedish","sw"=>"swahili",
      "ta"=>"tamil","te"=>"telugu","tg"=>"tajik","th"=>"thai","ti"=>"tigrinya","tk"=>"turkmen","tl"=>"tagalog","tn"=>"tswana","to"=>"tonga","tr"=>"turkish","ts"=>"tsonga","tt"=>"tatar","tw"=>"twi","ty"=>"tahitian",
      "ug"=>"uighur","uk"=>"ukrainian","ur"=>"urdu","uz"=>"uzbek",
      "ve"=>"venda","vi"=>"vietnamese","vo"=>"volapük",
      "wa"=>"walloon","wo"=>"wolof",
      "xh"=>"xhosa",
      "yi"=>"yiddish","yo"=>"yoruba",
      "za"=>"zhuang","zh"=>"chinese","zu"=>"zulu",
    );
   
    //http://www.thefutureoftheweb.com/blog/use-accept-language-header
    $langs = array();
   
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        // break up string into pieces (languages and q factors)
        preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
   
        if (count($lang_parse[1])) {
            // create a list like "en" => 0.8
            $langs = array_combine($lang_parse[1], $lang_parse[4]);
       




            // set default to 1 for any without q factor
            foreach ($langs as $key => $val) {
                if ($val === '') $langs[$key] = 1;
            }
   
            // sort list based on value




            arsort($langs, SORT_NUMERIC);
        }
    }
    foreach ($langs as $key => $val)
    {
      $key = explode("-", $key);
      if (isset($lang_codes[$key[0]]) && file_exists(ROOT_PATH.'lang/'.$lang_codes[$key[0]].'/main.php'))
      {
        $config['language_dir'] = $lang_codes[$key[0]];
        if ($lang_codes[$key[0]] != $config['language_dir']) $l = $lang_codes[$key[0]];
        setcookie('4images_lang', $lang_codes[$key[0]], time()+ 60 * 60 * 24 * 365, "/", "", 0);
        break;
      }
    }
    unset($langs);
    unset($lang_codes);
  }
}


If you wanted to automatically detect the language of the visitor. BUT
How do you use this code if you are using version B of this mod and 1.7.6 ?

With great appreciation thanks----
Robert
Title: Re: [MOD] Language select
Post by: V@nо on April 01, 2009, 04:01:22 PM
1) I've asked you once before, please do not reply twice to the same topic, edit your previous reply with additional info, questions, unless someone replied after you or if no one replied for a long time. I ask you that, because if you look at the history of your replies, you'd see that almost all your recent replies to any topics are following by one to three additional replies by you.  It is called "flood". Even though flooding is not in our forum's rules, I bet it's not granted on any forums.

2) more often then not it's more helpful see the original reply instead of just a quote from it, aka provide a link to the message you are referring to, along with the quote if you feel like it.. The original replies and replies before them can provide more useful information. A link to a specific reply can be found at it's headline or icon.

3) did you try the code? from what I recall it has nothing to do with version A or B and from what I see it should work on v1.7.6 as well.


P.S.
Please don't get offended by what I said or will say, it wasn't my intention. But you seems to rush into post a reply without first checking if it's a mistake you made, then after 5 minutes with "gee I forgot something" post another reply...please don't do that, edit your previous post instead.
I understand you don't have enough time to do everything you'd like to do, we all like that, but if you'd spent the same amount of time that required to post a message on the forum, to actually double check your steps, you'd probably save a lot of time for yourself then waiting for the other's replies ;)
Sorry for the lecture.
Title: Re: [MOD] Language select
Post by: AntiNSA2 on April 08, 2009, 01:43:03 PM
1) I've asked you once before, please do not reply twice to the same topic, edit your previous reply with additional info, questions, unless someone replied after you or if no one replied for a long time. I ask you that, because if you look at the history of your replies, you'd see that almost all your recent replies to any topics are following by one to three additional replies by you.  It is called "flood". Even though flooding is not in our forum's rules, I bet it's not granted on any forums.

so.... if I edit a previous poist will it reappear at the end of the thread as a new post would? I think for now on unless I have some information that helps I will delete all previous posts and have only one post... the linear fashion of this forum is lacking... I think internet forums need an evolutionary advancement....


Quote
2) more often then not it's more helpful see the original reply instead of just a quote from it, aka provide a link to the message you are referring to, along with the quote if you feel like it.. The original replies and replies before them can provide more useful information. A link to a specific reply can be found at it's headline or icon.
 

I will try something different soon.

Quote
3) did you try the code? from what I recall it has nothing to do with version A or B and from what I see it should work on v1.7.6 as well.

I am in a hurry working on other things... I will try it soon... the serious issue is it prevents flash keywords from working in other languages but english... willl get back with more feedback asap.
Quote

P.S.
Please don't get offended by what I said or will say, it wasn't my intention. But you seems to rush into post a reply without first checking if it's a mistake you made, then after 5 minutes with "gee I forgot something" post another reply...please don't do that, edit your previous post instead.
I understand you don't have enough time to do everything you'd like to do, we all like that, but if you'd spent the same amount of time that required to post a message on the forum, to actually double check your steps, you'd probably save a lot of time for yourself then waiting for the other's replies ;)
Sorry for the lecture.


hmmm... I know you are the masta hacka (err master hacker)......

I dont know about you but I spend like 150 hours a week working and like 90% is on this 4images site I am trying to make and others......


I dont have the super fly secret coding power skills you clearly possess.... so even the simple shit can sometimes take me hours and hours...............

I dont just doible check.. I am doing in like 10 times check or something....

I am trying to get better at it.

My kids don not get to see me at all because I am double checking so much.....


I mean if I could solve all the problems myself than why even come to the forum :)

Ill try to be ever more efficient...
Title: Re: [MOD] Language select
Post by: V@no on April 08, 2009, 03:01:31 PM
Hi Vano
this Mod ist not compatibel with
http://www.4homepages.de/forum/index.php?topic=24526.0

problem with cookies
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555
http://www.4homepages.de/forum/index.php?topic=24526.msg134385#msg134385

can you help us?
I've updated the cookie code. For people previously installed that code I've left the old code at the bottom of the post, so they know what to search for.


so.... if I edit a previous poist will it reappear at the end of the thread as a new post would?

If your previous post is the last post of the thread then yes, it will appear at the end of the thread. If your previous post is not the last post of the thread feel free post a new reply.

Anyways, if you have any other questions regarding posting on this forum, please post them in chit-chat section or PM me directly.

Let's stay on-topic here ;)
Title: Re: [MOD] Language select
Post by: V@no on April 09, 2009, 02:05:32 AM
ops, sorry. that is part of a file I had opened at the time of posting...my bad. code fixed.
Title: Re: [MOD] Language select
Post by: V@no on April 10, 2009, 03:00:23 AM
Would you please test again, I've removed && $requested_l != $config['language_dir']
it should work now.
P.S. I don't have this mod installed, can't test it myself.
Title: Re: [MOD] Language select
Post by: crs on April 14, 2009, 03:27:04 AM
Hello, the "url" of the links is for example know: "details.php?image_id=11191&l=deutsch"

Is there any way to hide the "&l=deutsch" or "&l=english" from all links on the 4images website?

Thanks for help
Title: Re: [MOD] Language select
Post by: egyptandy on April 20, 2009, 10:11:16 AM
Hello,
I have implemented this MOD and it works fine.
But I have still one problem.
In my "menue" I have 3 extra lines for "Links", "Imprint" and "Contact"
How should I change the code in the menue.php to have also those lines to switch between the two languages german and english.
I have already included in the lang.dir=> Deutsch=> main.php the ranslation for Contact and Imprint

This is the code for the menue.php

<table class="menue" width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td valign="top" align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top" align="center">

<p align="left">

» <a href="index.php?template="Imprint">Imprint</a><br />
» <a href="index.php?template="Contact">Contact</a><br />
» <a href="index.php?template=Links">Links</a><br />

</p>

</td></tr></table></td></tr></table>

Thank you for your help.

 
Title: Re: [MOD] Language select
Post by: V@no on April 20, 2009, 02:44:18 PM
Code: [Select]
<?php
global $site_sess;
?>

» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=imprint")?>">Imprint</a><br />
» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=contact")?>">Contact</a><br />
» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=links")?>">Links</a><br />
Title: Re: [MOD] Language select
Post by: egyptandy on April 21, 2009, 08:09:34 AM
Thank you for your fast reply V@no.
But I am a newbe and now i am not not sure what to do.
Only to change the lines in the menue.html or to change something also on the global.php?
I have not found the mentioned line in my global.php.
Do I have to include this and at which position?
Or does the position do not matter?
Please give me an advise.
Title: Re: [MOD] Language select
Post by: V@no on April 21, 2009, 02:10:42 PM
just add these into your menue.html
Title: Re: [MOD] Language select
Post by: egyptandy on April 21, 2009, 04:05:15 PM
Including that in the menue.php directly before those 3 lines?

<?php
global $site_sess;
?>

This were the items, I have no idea what to do with them.
By the way, this menu part is in my case a .php and not a .html.

Sorry, to bother you again with my "stupid " question. Bu I am working hard to understand 4images better.
Best regarrds

Title: Re: [MOD] Language select
Post by: V@no on April 22, 2009, 01:18:36 AM
The code you showed is 100% html and doesn't contain any PHP.

So, leave your code intact and add the code I've posted at the end of the file or in the place you need.

P.S.
The best way to understand is try and see what happens.
but remember to always backup any files you change.
Title: Re: [MOD] Language select
Post by: egyptandy on April 22, 2009, 02:28:30 AM
Hello, thanks again.
I did what you suggested, but beside having 3 new lines in my menue nothing happened. No language change when I switch the language tab. So something is still missing.
You are right with your remark about the html code, but the name of this file is menue.php and not menue.html.
And it is not in the templates section but in the main section where you also find the global.php but no html files.
Maybe this is a mistake in the template itself.
But when I changed the name of the file after including your changes into menue.html and moved it to the templates part, I received several mistake warnings and the menue was gone in this part.
Now I am getting confused.
Title: Re: [MOD] Language select
Post by: crs on April 30, 2009, 11:33:43 PM
Hello, the "url" of the links is for example know: "details.php?image_id=11191&l=deutsch"

Is there any way to hide the "&l=deutsch" or "&l=english" from all links on the 4images website?

Thanks for help

Would that be possible? Has anyone an idea?
Title: Re: [MOD] Language select
Post by: crs on May 29, 2009, 07:48:25 PM
When i change my language in the Control Panel, i get redirected to the "Lost Password Page"... o.0
But the language i´ve selected is active.

It would be better to get a message like: "Language has been changed" or something like that.

Anyone can help?
Title: Re: [MOD] Language select
Post by: V@no on May 30, 2009, 02:08:09 AM
What version of the mod did you install and if possible, link to the site could be helpful (with test login info)
Title: Re: [MOD] Language select
Post by: crs on May 30, 2009, 12:44:58 PM
Hello V@no
Now i´ve tested both versions again and i have another problem  :roll:
Version A is now installed on my 4images, but i´ve the same new problem also with version B:

If i change my language once to german, im not able to change the language again to english.

U can test the function oft this mod on my site under:

http://autospotter.de/
User: test
pw: 123

Big thx for help.
Title: Re: [MOD] Language select
Post by: V@no on May 30, 2009, 09:07:57 PM
I don't see where I can change the language...can't test it without it ;)
Title: Re: [MOD] Language select
Post by: crs on May 31, 2009, 04:01:55 PM
Sorry, you can change the language in the Control Panel under "Select your language:".

As I said, i changed the language from english to german - that worked well.
But if i want to change the language again from german to english, it doesn´t work.

Thanks
Title: Re: [MOD] Language select
Post by: V@no on June 01, 2009, 06:42:35 AM
I think the problem is that by default 4images prioritizes "GET" over "POST" when it comes to selecting language and in your case that is what causing this.

Try replace in global.php:
  $requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);

with this:
  $requested_l = (isset($HTTP_POST_VARS['l'])) ? trim($HTTP_POST_VARS['l']) : trim($HTTP_GET_VARS['l']);
Title: Re: [MOD] Language select
Post by: crs on June 05, 2009, 12:08:27 AM
Yes, that works!
Thank you!  8)
Title: Re: [MOD] Language select
Post by: crs on July 16, 2009, 02:34:41 AM
Hello, the "url" of the links is for example now: "details.php?image_id=11191&l=deutsch"

Is there any way to hide the "&l=deutsch" or "&l=english" from all links on the 4images website?

Thanks for help
Title: Re: [MOD] Language select
Post by: Carpfish on October 25, 2009, 09:29:08 AM
Habe den Mode auch ausprobiert, aber ich bekomme immer diese Fehlermeldung dazu wenn ich auf den English Button Drücke

Warning: Invalid argument supplied for foreach() in /home/.sites/75/site627/web/4images/includes/page_header.php on line 519

Warning: Invalid argument supplied for foreach() in /home/.sites/75/site627/web/4images/includes/page_header.php on line 527

in line 519 steht Original   foreach ($image_order_optionlist as $key => $val) {
in line 527 steht Original   foreach ($image_sort_optionlist as $key => $val) {

Gruß Andy
Title: Re: [MOD] Language select
Post by: V@no on October 25, 2009, 04:21:02 PM
Please attach your page_header.php
Title: Re: [MOD] Language select
Post by: Sun on October 28, 2009, 11:34:05 AM
I want to show one part of page only if choose russian language. How to do this?
Title: Re: [MOD] Language select
Post by: V@no on October 28, 2009, 01:42:48 PM
use something like this:
Code: (HTML template) [Select]
<?php
global $config;
if (
$config['language_dir'] == "russian")
{
?>


this text/html will be only visible when selected russian


<?php
}
?>


P.S.
if you are planning add this code more then once in the same template, leave global $config; only at first instance, it only needed once
Title: Re: [MOD] Language select
Post by: shadowhunter on February 16, 2010, 03:55:54 PM
Hello!

I use this MOD with version "B" (images) and I have a question:

Is it possible to add the cookies based version (http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555 ) with this little extra modification:

URLCOOKIE VALUE
index.php"deutsch"  or  "" [no cookie]
index.php?l=english"english"
index.php?l=french"french"
--> German (deutsch) is my default language!
--> I don't want to have the "?l=deutsch" at the end uf the url if default language is selected.


The original posted version is like this:
URLCOOKIE VALUE
index.php?l=deutschdeutsch
index.php?l=englishenglish
index.php?l=frenchfrench


I have the following code in page_header.php:
Code: [Select]
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/deutsch/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a>&nbsp;";

Can anyone help me please?
Thanks in advance!
Greetings
Title: Re: [MOD] Language select
Post by: _qp_ on April 02, 2010, 06:16:44 PM
And i have a question: is it possible in the mod to remove showing this part (red) in the url and still have the language selection working?

index.php?l=english
index.php?l=russian

?

So it would change the language and show just index.php without the language part in the url?
Title: Re: [MOD] Language select
Post by: V@no on July 17, 2010, 12:19:26 AM
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555

I just updated the code and added a new step for sessions.php

Note, the l=blah will be displayed right after the language switched.
Title: Re: [MOD] Language select
Post by: alex9193 on July 17, 2010, 01:54:29 AM
Hi V@no, could you please help me with my problem?
For example: if you change language eng -> rus, URL нisn't changed (picture 1),
but if you change language rus -> eng, Url is chaged for a russian one (picture 2)??????
Title: Re: [MOD] Language select
Post by: V@no on July 17, 2010, 02:42:41 AM
I think you got it backwards.
eng -> rus = url changed
rus -> eng = no url changed.
This is done that way because your gallery's default language is english, therefor no point adding l=english to the url.

if you don't like that way and want always have l=english, then replace in sessions.php
$l = null;

with:
$l = $config['language_dir'];
Title: Re: [MOD] Language select
Post by: alex9193 on July 17, 2010, 08:04:45 AM
V@no.
You probably didn't understand me.  :)
The problem is URL body itself isn't changed.
If you chanage ENG -> RUS (somewhere not on index page) URL isn't changed to RUS
(URL is just added by ?l=russian - http://max-pix.com/cat-alsou-1378.htm?l=russian), and after if you change RUS to some other language 
(German or English) URL body is chaged to RUS for some reason - http://max-pix.com/cat-Алсу-1378.htm?l=deutsch.
Title: Re: [MOD] Language select
Post by: V@no on July 17, 2010, 05:58:08 PM
That's because how it works, it will no change url name to russian until it already switched to russian, not before.
What you are trying do is to show url when however over language select icon in the language you are about to switch to - this is never going to happen, and besides, that is more related to the SEO mod you are using ;)
Title: Re: [MOD] Language select
Post by: alex9193 on July 20, 2010, 09:58:22 PM
V@no? спасибо за раз'яснения!
Последний вопрос  :D, а можно сделать так, чтобы переключение на всех страницах работало как на главной, (переключаешь язык и тебя на главную кидает, что-бы боты по этим неправильным урлам не ходили)
А то у меня столько дублей получается - три языка + вариации с урлами!  8O
Title: Re: [MOD] Language select
Post by: V@no on July 21, 2010, 02:19:03 AM
Да, очень просто делается:
В /includes/page_header.php замените
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');


На это:
$lang_url = $site_sess->url(ROOT_PATH."index.php", "&");
Title: Re: [MOD] Language select
Post by: alex9193 on July 21, 2010, 05:14:29 AM
Попробовал, все равно получается каша, например переключился с английского по умолчанию на русский, теперь:
Ссылка переключения на немецкий такая http://...../?l=russian&l=deutsch
на английский такая http://...../?l=russian
Мистика :lol:

Вот здесь посмотреть можно http://max-pix.com/search.htm
Title: Re: [MOD] Language select
Post by: V@no on July 21, 2010, 08:10:55 AM
Ой что-то я об-этом не подумал..исправил мой предыдущий ответ. Удалите предыдущие изменения, а потом измените только одну линию.
Title: Re: [MOD] Language select
Post by: alex9193 on July 21, 2010, 01:56:44 PM
Сасибо V@no! Работает.  :)
Title: Re: [MOD] Language select
Post by: relu on October 01, 2010, 06:33:22 PM
How about to make different fields in admin panel with title and description for each language?
Is possible to select diferent languages without changing url?
Title: Re: [MOD] Language select
Post by: Rembrandt on October 01, 2010, 06:51:19 PM
How about to make different fields in admin panel with title and description for each language?
http://www.4homepages.de/forum/index.php?topic=6749.msg29540#msg29540
Title: Re: [MOD] Language select some flags
Post by: x23piracy on October 14, 2010, 02:53:19 AM
Hi,


currently iam using 25 different languages for my galery...
here are the flags i use with method b:

Preview:
(http://www1.xup.in/tn/2010_10/20472542.png) (http://www.xup.in/dl,20472542/flags.png/)

Download: see post attachments


Greetz X23
Title: Re: [MOD] Language select
Post by: bergblume on December 30, 2010, 12:12:02 PM
gibt es bei der verwendung dieses MODs eigentlich für die suchmaschinen einen duplicate content problem?
falls ja, wie kann man dies vermeiden, dass standardmäßig über die sumas immer nur die "normalen seiten" ohne das "Anhängsel" ?l=english ausgegeben wird?


edit:
ich denke ich habe des rätsels lösung schon gefunden (http://www.4homepages.de/forum/index.php?topic=24405.msg133712#msg133712)... es ist DEFINITIV DC und somit schädlich fürs ranking... abhilfe schafft hier folgender Eintrag in der robots.txt

Code: [Select]
User-agent: *
Disallow: /*?l=english(&|$)
Disallow: /*?l=italian(&|$)
Disallow: /*?l=spanish(&|$)
Disallow: /*?l=french(&|$)
Disallow: /*?search_keywords(&|$)
Title: Re: [MOD] Language select
Post by: Rembrandt on December 30, 2010, 12:16:51 PM
gibt es bei der verwendung dieses MODs eigentlich für die suchmaschinen einen duplicate content problem?
nein gibt es keine, bei der standard sprache hast du das anhängseln nicht, und google klickt nicht auf eine andere sprache.  :)

auf meiner seite kannst du dir das ansehn...
Title: Re: [MOD] Language select
Post by: bergblume on December 30, 2010, 12:28:44 PM
gibt es bei der verwendung dieses MODs eigentlich für die suchmaschinen einen duplicate content problem?
nein gibt es keine, bei der standard sprache hast du das anhängseln nicht, und google klickt nicht auf eine andere sprache.  :)

auf meiner seite kannst du dir das ansehn...

doch - eben schon (s. mein Edit oben)... du kannst das auch bei deinen seiten sehr leicht nachvollziehen => schau dir mal diese SERP an => Link (http://www.google.de/search?hl=de&q=http%3A%2F%2Fwww.vienna-pictures.com%2Fdetails.php%3Fimage_id%3D2898&aq=f&aqi=&aql=&oq=&gs_rfai=) (deine Seite mit gleichen Inhalten sowohl auf deutsch als auch auf englisch gelistet => das wird definitiv von gogle abgestraft!)
Title: Re: [MOD] Language select
Post by: Rembrandt on December 30, 2010, 01:35:04 PM
...deine Seite mit gleichen Inhalten sowohl auf deutsch als auch auf englisch gelistet.....
das hätte ich nicht gedacht..

Quote
....das wird definitiv von gogle abgestraft!)
nein google ist das vollkommen egal.
Title: Re: [MOD] Language select
Post by: bergblume on December 31, 2010, 11:56:58 AM
Quote
Quote
....das wird definitiv von gogle abgestraft!)
nein google ist das vollkommen egal.

servus andi,

da muss ich dir deutlich widersprechen - ich konnte bei etlichen seiten einen deutlichen ranking-verlust bei google feststellen... somit sollte man deutlich darauf achten hier - wie von mir oben beschrieben - DC zu vermeiden!

Guten rutsch ins neue Jahr und danke für deine guten tipps, die du mir (uns allen hier) im laufe des jahres gegeben hast!

Ralf
Title: Re: [MOD] Language select
Post by: paule on March 23, 2013, 12:23:33 PM
Hallo,

ich bekomme beim Test meiner Seite (www.kosecki.de) die im Anhang sichtbare Fehlermeldung.
Die muss mit dem MOD Language select zusammenhängen.
Wie kann ich die Fehlermeldung vermeiden?

paule
Title: Re: [MOD] Language select
Post by: Rembrandt on March 23, 2013, 04:38:02 PM
Hi!
...Wie kann ich die Fehlermeldung vermeiden?
..

Wenn du Version B hast versuche im Code in der page_header.php,anstatt:
((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder)
das hier:
((preg_match("/\?/", $lang_url) ? '&amp;' : "?")."l=".$folder)

mfg Andi
Title: Re: [MOD] Language select
Post by: paule on March 23, 2013, 05:52:46 PM
Hi Andi,

vielen Dank für die wie immer perfekte schnelle Hilfe!!!!
Das ist die Lösung.

Beste Grüße
paule