Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 09:24 pm EST
Geeklog Forums
Making Geeklog Multilingual
Page navigation
duvide
Anonymous
Thanks LWC for this great hack. This is exactly what I am looking for for my multilingual duvide.com site.
Right now I am trying it out on a fresh 1.4 rc1 install but I am getting this sql error:
Can you help?
Thanks/Frank
Right now I am trying it out on a fresh 1.4 rc1 install but I am getting this sql error:
Text Formatted Code
Tue 10 Jan 2006 23:49:32 MYT - 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE tid LIKE '%_en' ORDER BY sortnum' at line 1. SQL in question: SELECT tid,topic,imageurl FROM WHERE tid LIKE '%_en' ORDER BY sortnum Can you help?
Thanks/Frank
28
30
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
By the way, LWC,
How can I add a menu link at the top, let's say 'Gallery' using custom menu setting in lib-custom.php, to make it multilingual? How do I add an array in the language files and instruct the menu link to pick the words up from the language file?
Sam
How can I add a menu link at the top, let's say 'Gallery' using custom menu setting in lib-custom.php, to make it multilingual? How do I add an array in the language files and instruct the menu link to pick the words up from the language file?
Sam
34
32
Quote
duvide
Anonymous
I am testing it on GL 1.40 rc1.
I think it has something to do with the alterations in index.php but not sure...
Frank
I think it has something to do with the alterations in index.php but not sure...
Frank
32
37
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Hey, duvide. Well, that's an easy one. Your line says "select whatever FROM WHERE...". But FROM what? From "nothing", according to your line.
Now first of all, we've already established v1.4 changed neither the relevant lines in public_html/index.php nor in public_html/lib-common.php .
Secondly, your line looks identical to the one from public_html/lib-common.php - now take a look in my code and see it says FROM {$_TABLES['topics']} - and for some reason your output for that is null as if your Geeklog has no $_TABLES['topics']. Perhaps check system/lib-database.php
And finally, like I've already begged samstone, please use a quote box...to quote a text. It's really annoying to read it unwrapped.
Now first of all, we've already established v1.4 changed neither the relevant lines in public_html/index.php nor in public_html/lib-common.php .
Secondly, your line looks identical to the one from public_html/lib-common.php - now take a look in my code and see it says FROM {$_TABLES['topics']} - and for some reason your output for that is null as if your Geeklog has no $_TABLES['topics']. Perhaps check system/lib-database.php
And finally, like I've already begged samstone, please use a quote box...to quote a text. It's really annoying to read it unwrapped.
31
30
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Well, samstone, a menu link is not a multilingual content issue, is it? That's your standard multilingual structure that Geeklog already supports and therefore isn't related to this topic.
However, I'd help you nonetheless. See, just because Geeklog supports it doesn't mean...your plugin does!
So first of all, your plugin must have a multilingual structure itself. But unlike Geeklog, you have to know that such a plugin usually only comes with english.php (and perhaps a few other chosen languages), which means that if your language is, say, Hebrew, you must either download it from geeklog.net or from the author's page OR translate it yourself!
Guess which option is the common one...
Secondly, just because a plugin has multilingual structure...doesn't mean it implements it on its menu titles! Some plugins hardcore the titles (usually in English, if the author at least has a minimal common sense).
Last and not least...since you've mentioned the word "Gallery", I can just cut short this discussion and recommend Media Gallery, which not only is awesome in general, but happens to be using a multilingual structure and implementing it on its menu title (the latter is thanks to yours truly's personal request).
However, I'd help you nonetheless. See, just because Geeklog supports it doesn't mean...your plugin does!
So first of all, your plugin must have a multilingual structure itself. But unlike Geeklog, you have to know that such a plugin usually only comes with english.php (and perhaps a few other chosen languages), which means that if your language is, say, Hebrew, you must either download it from geeklog.net or from the author's page OR translate it yourself!
Guess which option is the common one...
Secondly, just because a plugin has multilingual structure...doesn't mean it implements it on its menu titles! Some plugins hardcore the titles (usually in English, if the author at least has a minimal common sense).
Last and not least...since you've mentioned the word "Gallery", I can just cut short this discussion and recommend Media Gallery, which not only is awesome in general, but happens to be using a multilingual structure and implementing it on its menu title (the latter is thanks to yours truly's personal request).
- A little sidenote: the Staticpages' plugin is an exception as its menu titles are really content and not structure. And it really is a problem when you want multilingual titles. The easiest solution is to choose not to display the title and instead display via HTML tags in the content itself (of course the title header would still be in one language only).
This, of course, raises the general question of multilingual content's support in staticpages.
What I do is I activate PHP scripting and then use something like:Text Formatted Codeif (substr(language(), 0, 2)) = "he") {
$display = 'Something in Hebrew';
} else {
$display = 'Something in English';
}
// Now I manipulate $display to look however I want.
// And when I'm finally done
echo $display;
(it calls my language() function from system/lib-custom.php) to determine the language and display the matching text (including a title). And I use many parameters, of course (e.g. $title), but in the end I insert them all to $display.
26
35
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Thanks for the response. I know what I am asking for is no related to your hack, but by having this, our sites can be "completely" multilingual, at least in navigation.
I fact, I am not just talking about a plugin, I am talking about any link, a Static Page, or even external link. For example if I created a staticpage "About us" and I want to include it with the top menu bar, I can use the Custom Menu that comes with Geeklog in lib-custom.php.
Currently you can add a link-word there, like "About Us", but instead of intering "About Us" there, I want it to pick up an array from the language file like [lang_aboutus] that is added by me in each language file, so that when the language change it will pick up the same word in different language.
(Talking about that, it might be a good idea to add as a feature to Geeklog to have a "custom language" module, so that the additonal words can be in seperate language files, like english_custom.php.)
In any case, for the time being, I wonder how hard it will be to add an language array in the language files, and make the Custom Menu pick it up from there. I saw Euan has done it with his Top Menu block using $page[] array. That concept might be similar, but this is for the Custom Menu to pick it up rather than being in a seperate box.
As for "Gallery" I just use it for example becuase that is the sample code in the lib-custom.php. I am aware of the Media Gallery and, in fact, I have uploaded the Chinese Translation there for v0.98b.
You know what I am talking about now? In brief, I want to make the Custom Menue to speak in different language. Then we will be fully multilingual in navigation.
Sam
I fact, I am not just talking about a plugin, I am talking about any link, a Static Page, or even external link. For example if I created a staticpage "About us" and I want to include it with the top menu bar, I can use the Custom Menu that comes with Geeklog in lib-custom.php.
Currently you can add a link-word there, like "About Us", but instead of intering "About Us" there, I want it to pick up an array from the language file like [lang_aboutus] that is added by me in each language file, so that when the language change it will pick up the same word in different language.
(Talking about that, it might be a good idea to add as a feature to Geeklog to have a "custom language" module, so that the additonal words can be in seperate language files, like english_custom.php.)
In any case, for the time being, I wonder how hard it will be to add an language array in the language files, and make the Custom Menu pick it up from there. I saw Euan has done it with his Top Menu block using $page[] array. That concept might be similar, but this is for the Custom Menu to pick it up rather than being in a seperate box.
As for "Gallery" I just use it for example becuase that is the sample code in the lib-custom.php. I am aware of the Media Gallery and, in fact, I have uploaded the Chinese Translation there for v0.98b.
You know what I am talking about now? In brief, I want to make the Custom Menue to speak in different language. Then we will be fully multilingual in navigation.
Sam
32
29
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Regarding your side note, I remember Euan has mentioned that since Staticpages (and even the blocks) use ID, we might be able to hack it with the same concept using _en, _he at the end of the StaticPage ID. What do you think?
Still it is only for the StaticPages, it doesn't solve the need of other types of links that I was talking bout.
Maybe I should post a seperate topic to see if anyone has a solution to raise the level of the current custom menu elements to multilingual.
Sam
Still it is only for the StaticPages, it doesn't solve the need of other types of links that I was talking bout.
Maybe I should post a seperate topic to see if anyone has a solution to raise the level of the current custom menu elements to multilingual.
Sam
35
35
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Yea, solved the problem, at least temporarity. I have to type in the menu words munually, so it requires UTF-8 capable editor to edit the lib-custom.php.
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
include($_CONF['path'].'languages.php');
if ( strtolower($lang) == "english" ) {
$lang = 'en';
} else {
$lang = 'tr';
}
$myentries = array ();
if ($lang == 'tr') {
$myentries[] = array ('url' => $_CONF['site_url'] . '/whatever.html',
'label' => 'Whatever in Chinese Characters');
} else {
$myentries[] = array ('url' => $_CONF['site_url'] . '/whatever.html',
'label' => 'Whatever in English Characters');
}
return $myentries;
}
This way, I can make every custom menu item multilingual. This makes your multilingual code base even more useful.
You might want to refine this and add it to your code area, so that your multilingual dream will be more complete, and other people dont' have to look all over.
Sam
Text Formatted Code
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
include($_CONF['path'].'languages.php');
if ( strtolower($lang) == "english" ) {
$lang = 'en';
} else {
$lang = 'tr';
}
$myentries = array ();
if ($lang == 'tr') {
$myentries[] = array ('url' => $_CONF['site_url'] . '/whatever.html',
'label' => 'Whatever in Chinese Characters');
} else {
$myentries[] = array ('url' => $_CONF['site_url'] . '/whatever.html',
'label' => 'Whatever in English Characters');
}
return $myentries;
}
This way, I can make every custom menu item multilingual. This makes your multilingual code base even more useful.
You might want to refine this and add it to your code area, so that your multilingual dream will be more complete, and other people dont' have to look all over.
Sam
35
33
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Since staticpages can use PHP, I rather use scripting. That way I can manage everything in one page.
Also, what's "strtolower($lang)"? You just use it as if you've declared it first, but you didn't.
I highly recommend to use the "if (substr(language(), 0, 2)) = "he") - else" structure.
As you can see in the default custom menu, you're supposed to use $LANG parameters. Your problem is that you want new words and then you have to apply a hack.
Unlike staticpages, which are UTF-8 by nature (if your site is), /public_html/lib-common.php, as you've pointed out, must be converted to UTF-8 first.
Alas, last time I tried converting any Geeklog file (except language files) to UTF-8, I've killed Geeklog...
So speaking of plugins, I'm less concerned with staticpages and more concerned with Filemgmt and Chatterblock.
Does anyone want to come up with ideas how to make them support a multilingual content?
Also, what's "strtolower($lang)"? You just use it as if you've declared it first, but you didn't.
I highly recommend to use the "if (substr(language(), 0, 2)) = "he") - else" structure.
As you can see in the default custom menu, you're supposed to use $LANG parameters. Your problem is that you want new words and then you have to apply a hack.
Unlike staticpages, which are UTF-8 by nature (if your site is), /public_html/lib-common.php, as you've pointed out, must be converted to UTF-8 first.
Alas, last time I tried converting any Geeklog file (except language files) to UTF-8, I've killed Geeklog...
So speaking of plugins, I'm less concerned with staticpages and more concerned with Filemgmt and Chatterblock.
Does anyone want to come up with ideas how to make them support a multilingual content?
30
33
Quote
duvide
Anonymous
thanks LWC, it was not so clear that some of the changes were only meant for gl 1.3.12 and not for 1.4.
Now it sort of works but not quite. I checked it with several languages but I can only switch between english and german properly with Hebrew I get an error message. And I cannot switch to french or russion which I also put into the array at all.
Would there be a way to make the block titles also multilingual?
Now it sort of works but not quite. I checked it with several languages but I can only switch between english and german properly with Hebrew I get an error message. And I cannot switch to french or russion which I also put into the array at all.
Would there be a way to make the block titles also multilingual?
29
30
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Duvide,
I remember some of the errors I encountered were because I "added" those codes to the files. You need to look carefully to find out some of the codes are for replacement of the original codes. Otherwise, there will be repeated lines of codes that could be the cause of your errors.
LWC, I found out that I didn't need the startlower line. The following is what actually working for me right now.
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
include($_CONF['path'].'languages.php');
$lang = language();
$retval = '';
$myentries = array ();
if ($lang == 'spanish_utf-8') {
$myentries[] = array ('url' => $_CONF['site_url'] . '/staticpages/index.php/information',
'label' => 'Información');
} else {
$myentries[] = array ('url' => $_CONF['site_url'] . '/staticpages/index.php/information',
'label' => 'Information');
}
return $myentries;
}
I didn't have to convert any files to utf-8, except lib-custom.php where I need to write some foreign language in. Making menue multilingual is very important for me because I have some custom links that don't look good if they don't change after changing the language.
As for Filemgmt and other plugins, the more we can make them multilingual, the merrier!
Sam
I remember some of the errors I encountered were because I "added" those codes to the files. You need to look carefully to find out some of the codes are for replacement of the original codes. Otherwise, there will be repeated lines of codes that could be the cause of your errors.
LWC, I found out that I didn't need the startlower line. The following is what actually working for me right now.
Text Formatted Code
// Custom Menu Entriesfunction CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
include($_CONF['path'].'languages.php');
$lang = language();
$retval = '';
$myentries = array ();
if ($lang == 'spanish_utf-8') {
$myentries[] = array ('url' => $_CONF['site_url'] . '/staticpages/index.php/information',
'label' => 'Información');
} else {
$myentries[] = array ('url' => $_CONF['site_url'] . '/staticpages/index.php/information',
'label' => 'Information');
}
return $myentries;
}
I didn't have to convert any files to utf-8, except lib-custom.php where I need to write some foreign language in. Making menue multilingual is very important for me because I have some custom links that don't look good if they don't change after changing the language.
As for Filemgmt and other plugins, the more we can make them multilingual, the merrier!
Sam
29
23
Quote
duvide
Anonymous
I don't understand which files do you mean now, the languages.php?
f
f
19
29
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
I was talking about this section on LWC's custom codes:
I just created another mulitlingual site (Spanish - English) using these codes and it worked without any problem. So the issue is not the codes themself, but understanding of the instruction. I guess LWC could make it clearer by showing the original codes and then comment out the original codes and adding the new codes at the same place. But, at this point as long as you understand that some codes are for adding in and others are for replacement, you should be fine.
Sam
Part II - hacks to exiting codes:
The following are (minimal as possible) modifications for existing codes. Be careful not to add them in addition to the original codes as it would create a real mess and/or end life as we know it!
The following are (minimal as possible) modifications for existing codes. Be careful not to add them in addition to the original codes as it would create a real mess and/or end life as we know it!
I just created another mulitlingual site (Spanish - English) using these codes and it worked without any problem. So the issue is not the codes themself, but understanding of the instruction. I guess LWC could make it clearer by showing the original codes and then comment out the original codes and adding the new codes at the same place. But, at this point as long as you understand that some codes are for adding in and others are for replacement, you should be fine.
Sam
28
32
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
I'm glad it wasn't clear...because there are at least 5 places where I stressed it works for both versions (except polls, to which I posted both versions)!
This is also why, samstone, I'm not about to highlight the original codes. The post with the hack is big as it is. Besides, I did leave hints of the original code (above "// custom code - start" and below "//custom code - end").
And I recommed you again to use language(), 0, 2)) so it would be compatible with languages.php .
This is also why, samstone, I'm not about to highlight the original codes. The post with the hack is big as it is. Besides, I did leave hints of the original code (above "// custom code - start" and below "//custom code - end").
And I recommed you again to use language(), 0, 2)) so it would be compatible with languages.php .
40
32
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
And I recommed you again to use language(), 0, 2)) so it would be compatible with languages.php .
It is not that I am refusing to use what you are talking about, I am just not php literate enough to put it together that way. I spoke a broken php language and the computer somehow understood my command and worked. That's why I said that you might want to refine the codes I posted and make it "professional."
As for the clearness of your posting, it was clear enough for me, but obviously not for Duvide. I belong to the STC "Society of Technical Communication" which teaches me to blame myself if a lay person doesn't understand what I am talking about. Most programmers see several steps ahead than a lay person that's why sometimes their explanations are like foreingn languages.
But you can be a good programmer and never need the skill of technical communication if you don't need to communicate your concept to lay persons. I loved OS/2 when it came out, but later Win95, a poorer operation system, took over the market because Microsoft knows better how to communicate with lay people.
Look at Geeklog, it is technically superior to many other more popular CMS, but they seem to somehow communicate better to the lay people and became popular. So success requires communication skills are much as technical skills. In Microsoft's case, the latter is even more important.
What a philosopher I am!
Sam
31
36
Quote
Page navigation
All times are EST. The time is now 09:24 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content