• [MOD] Language select 4 0 5 1
Currently:  

Author Topic: [MOD] Language select  (Read 296626 times)

0 Members and 1 Guest are viewing this topic.

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #30 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 :)
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Language select
« Reply #31 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...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #32 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
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Language select
« Reply #33 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)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #34 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. :)
MAяTRIX


Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Language select
« Reply #35 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 ;)


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #36 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:
MAяTRIX


Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Language select
« Reply #37 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

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #38 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?
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Language select
« Reply #39 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 != "..")
  {
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline TXtaholic

  • Jr. Member
  • **
  • Posts: 67
  • life is ours we live it our way!
    • View Profile
    • i MMS u
Re: [MOD] Language select
« Reply #40 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
 

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Language select
« Reply #41 on: April 26, 2005, 03:55:22 PM »
Do you really need a completely different template?

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


Offline TXtaholic

  • Jr. Member
  • **
  • Posts: 67
  • life is ours we live it our way!
    • View Profile
    • i MMS u
Re: [MOD] Language select
« Reply #42 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

Offline TXtaholic

  • Jr. Member
  • **
  • Posts: 67
  • life is ours we live it our way!
    • View Profile
    • i MMS u
Re: [MOD] Language select
« Reply #43 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
« Last Edit: May 08, 2005, 08:51:45 PM by V@no »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Language select
« Reply #44 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)
« Last Edit: October 12, 2008, 09:43:53 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)