Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 08:19 am EDT

Geeklog Forums

Making Geeklog Multilingual

Page navigation


Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Your wish is my command. Done.

Happy new year. Do you see how symbolic it turned out? Laughing
 Quote

Status: offline

Euan

Forum User
Full Member
Registered: 04/22/02
Posts: 292
I've updated my hack to work with 1.4.0rc1. You can now use the code on my site too if you prefer not to hack lib-common.php.

Cheers, Euan.
-- Heather Engineering
-- No job too small
 Quote

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:
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
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Boy, I remember I ran into that problem a couple of times, but forgot how I solved it. What version of GL are you testing on?

Sam
 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
 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
 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.
 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).

  • 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 Code
    if (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.
 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



 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
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Yea, Big Celebration 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.
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
 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?
 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?
 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.

Text Formatted Code
// Custom Menu Entries
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
 Quote

duvide

Anonymous
I don't understand which files do you mean now, the languages.php?

f
 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:

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!


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
 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 .
 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.

Blah Blah Blah Blah ... What a philosopher I am!

Sam
 Quote

Status: offline

Euan

Forum User
Full Member
Registered: 04/22/02
Posts: 292
My downloads are back online.

Cheers, Euan.
-- Heather Engineering
-- No job too small
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Have you guys noticed that both this and Euan's hack don't change the language if the story is in the full story mode?

Sam
 Quote

Page navigation

All times are EDT. The time is now 08:19 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content