Author Topic: [MOD] Multi-Language support for any text (updated 05-11-2005)  (Read 215664 times)

0 Members and 1 Guest are viewing this topic.

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Multi-Language support for any text
« Reply #15 on: June 05, 2005, 04:45:54 PM »
Sheon
cat_name
cat_description
 :wink:



Hi V@no,

tnx for that modification - but I can't find out what to change to have the category name shown in the right language in the admin category list...
a simple change of
Code: [Select]
$category_list .= ">".$lang['after']." ".multilang($cat_cache[$val]['cat_name'])."</option>\n";did not help and the result is still not what I expect :(

MAяTRIX


Offline demontech

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [MOD] Multi-Language support for any text
« Reply #16 on: June 05, 2005, 07:08:30 PM »
http://www.4homepages.de/forum/index.php?topic=6749.0
can anyone help me?
look @ the buttom of the page...

//Demon

Offline demontech

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [MOD] Multi-Language support for any text
« Reply #17 on: June 05, 2005, 07:55:39 PM »
Okey i can even donate a few $
to 4images crew if they help me with this
as free help feels out on this one.

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] Multi-Language support for any text
« Reply #18 on: June 05, 2005, 08:14:53 PM »
Hello Vano,

maybe i'm stupid but i don't understand in witch file and how i shoud write to explain for the gallery that
lattvia=lettland in swedish. And in this case is for my catigories i want to change to the swedish name when someone choose "swedish" on www.demontech.net
\me has no idea what do u mean....
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 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] Multi-Language support for any text
« Reply #19 on: June 05, 2005, 09:52:02 PM »
tnx for that modification - but I can't find out what to change to have the category name shown in the right language in the admin category list...
a simple change of
Code: [Select]
$category_list .= ">".$lang['after']." ".multilang($cat_cache[$val]['cat_name'])."</option>\n";did not help and the result is still not what I expect :(


I'm confused..."admin category list"? what is it? in ACP? the screenshot u showed is dropdown on "regular" page...

for the categories names, u'll need search in files (mostly in includes/functions.php) for ['cat_name'] (which is only a part of a variable)
for example the full variable could look like: $cat_cache[$category_id]['cat_name'] or $cat_cache[$cat_id]['cat_name']
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] Multi-Language support for any text
« Reply #20 on: June 06, 2005, 06:51:33 PM »
yep - if you edit a category in the ACP, you may choose if to change the cat into a subcategory - and the screenshot was this list.

I solved it - I missed to change cat_name variable in the get_category_dropdown_bits function in includes/functions.php
because I thought it will be somewhere in the admin-files  :roll:

TNX
MAяTRIX


Offline demontech

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [MOD] Multi-Language support for any text
« Reply #21 on: June 15, 2005, 03:02:52 PM »
Hello Vano,

maybe i'm stupid but i don't understand in witch file and how i shoud write to explain for the gallery that
lattvia=lettland in swedish. And in this case is for my catigories i want to change to the swedish name when someone choose "swedish" on www.demontech.net
\me has no idea what do u mean....


Well I mean as you have on your site http://gallery.vano.org
When i change the language to russian your catigories change to russian.
I have add all phpcode to all files functions.php and so on. But i don't know what todo next to proceed.
and get it work.

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] Multi-Language support for any text
« Reply #22 on: June 15, 2005, 03:13:09 PM »
next, u'll need rename your categories, image names, etc
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] Multi-Language support for any text
« Reply #23 on: June 17, 2005, 02:34:55 PM »
nice thing - there's a lot to change, to have this feature working flawless :)

But there's one little problem I could not solve on my own:


If you have a category and you set sorting by image name - it will absolutely mess up the sorting in there, if you rename some of the pictures to support more languages...
See here: http://photo.overlord.cz/categories.php?cat_id=38

How would it be possible to sort the images by the shown image name, not by the "whole image name" containing [czech] etc.?
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] Multi-Language support for any text
« Reply #24 on: June 18, 2005, 12:18:07 AM »
that actualy a side effect of this method...the sorting being made directly in mysql, but the language select is in php...I have no sollution for this...by the way this affects anything sorted by name with multilang support...
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] Multi-Language support for any text
« Reply #25 on: June 18, 2005, 08:59:51 PM »
that's a pitty... the feature itself is great, but this is the only little flaw...
 :(
MAяTRIX


TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #26 on: August 02, 2005, 12:10:45 AM »
Quote

but I can't find out what to change to have the category name shown in the right language in the admin category list


Is your objective to change the following method - from admin/categories.php file :

Quote

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">$cats['cat_name']."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";


to this :

Code: [Select]

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">".multilang($cats['cat_name'])."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";


Then, at the : "savecat" action :

Quote

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


to :

Code: [Select]

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


Then :

Quote

show_input_row($lang['field_category_name'], "cat_name", "", $textinput_size);
show_textarea_row($lang['field_description_ext'], "cat_description", "", $textarea_size);


to :

Code: [Select]

show_input_row($lang['field_category_name'], multilang("cat_name"), "", $textinput_size);
show_textarea_row($lang['field_description_ext'], multilang("cat_description"), "", $textarea_size);


Then, at the : "updatecat" action :

Quote

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


to :

Code: [Select]

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


Then :

Quote

show_input_row($lang['field_category_name'], "cat_name", $result['cat_name'], $textinput_size);
show_textarea_row($lang['field_description_ext'], "cat_description", $result['cat_description'], $textarea_size);


to :

Code: [Select]

show_input_row($lang['field_category_name'], multilang("cat_name"), multilang($result['cat_name']), $textinput_size);
show_textarea_row($lang['field_description_ext'], multilang("cat_description"), multilang($result['cat_description']), $textarea_size);


?

If not, then my apologize in advance. However, it works great for me. ;)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Multi-Language support for any text
« Reply #27 on: August 02, 2005, 12:22:41 PM »
I get a strange error, since I've implemented this MOD...

When I upload a picture and add a quite long description in 3 languages (or just edit a long image description), I get this:
Quote
Processing image [czech]Hláška[english]MessageDialog[deutsch]Dialogfenster, ID 3333 ...
DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 1, 0, 0 FROM 4images_wordlist WHERE word_text = 'dne'
Duplicate entry '3333-10029' for key 1

DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 0, 1, 0 FROM 4images_wordlist WHERE word_text = 'take'
Duplicate entry '3333-9486' for key 1

DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 0, 1, 0 FROM 4images_wordlist WHERE word_text = 'schön'
Duplicate entry '3333-10824' for key 1

Maybe it is just the case, when the image-description gets toooo long.
The description is saved without problems - so it seems to be an error somewhere 'round the search-index...
MAяTRIX


TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #28 on: August 02, 2005, 02:15:49 PM »
Strange. I can't reproduce this error. It doesn't even seem to be related with this addition. :|

Replace back :

Quote

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


to :

Code: [Select]

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


Will it work ?

There's also a line I forgot to comment out - in your admin/home.php file :

find :

Quote

".$row['cat_name']."


replace with :

Code: [Select]

".multilang($row['cat_name'])."


Offline Alex01

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: [MOD] Multi-Language support for any text
« Reply #29 on: September 01, 2005, 10:15:41 PM »
What can I do that I can add texts in more languages to the picture when I upload it?

GER - PIC NAME
-----TEXT BOX------

ENG - PIC NAME
-----TEXT BOX------


Thanks