1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Multilingual module

Discussion in 'Modification Release' started by darek, Mar 31, 2009.

  1. darek Customer



    Description

    This is something I missed. I want to have full translation to 2 languages for my upgrade to v4. After creating Virtual Tour module, I gave it a try to create multi language module. I just wanted to have my 68c in polish and english. What it has:
    - totally independent page creation and edition, and more, it uses real files, so after creating languages and pages, you may download all pages files, edit them on your pc and upload back, however, it is still possible to edit the pages using admin (see files).
    - category translation in as many languages as you want
    - extra fields translation in as many languages as you want
    if you have any ideas about such module, let me know

    I forgot, what it will do:
    - generate language buttons for available languages
    - display available pages for a chosen language
    - display translated categories/breadcrumbs for a chosen language
    - display translated extra fields for a chosen language

    all will be nicely edited in the admin area

    if anyone wants to contact me quickly, please PM me or go to my page: http://lookdigital.pl and send me a mail

    Click here to view the full details.

    If you have any questions or need support please reply below.
  2. DGiscombe Graphic / Web Desginer

    Works GREAT

    With only a few changes to a few pages my site is now multilingual!

    At the moment, it conflcts with LHotch's Cat_Tree module, but I'm sure that can be fixed with a few lines of code, other than that I can not detect any other problems with this mod.

    Well done!
  3. darek Customer

    for developers:

    this is how categories/extrafields are changed in original Categories.php
    PHP:

    //db
    global $db,$lang;
            if (
    $lang != "" && $lang != $default_lang && file_exists(FILESYSTEM_PATH .'language/'.$lang.'.php'))
            {
            
    $sSQL="SELECT id,name,slug,parent_id,cLink,".$lang."_slug,".$lang."_name,".$lang."_description FROM ".PREFIX."categories WHERE id='".$node."'";
            } else {
    //original code
            
    $sSQL="SELECT id,name,slug,parent_id,cLink FROM ".PREFIX."categories WHERE id='".$node."'"
            }
            
    $result=$db->query($sSQL);
            
    $row=$result->fetch();
            
    $path = array();
            
            
    //changing original name
                    
    if($row[''.$lang.'_slug']!="")
                    {
                    
    $row['slug'] = $row[''.$lang.'_slug'];
                    }
                    if(
    $row[''.$lang.'_name']!="")
                    {
                    
    $row['name'] = $row[''.$lang.'_name'];
                    }
                    if(
    $row[''.$lang.'_description']!="")
                    {
                    
    $row['description'] = $row[''.$lang.'_description'];
                    }
  4. wabugi Customer

    I bought the Multilingual Module and it works fine as far as I can see

    I have a question concerning the language buttons. I am able to create dynamic language buttons with this code:
    Code:
    {foreach from=$MultiResults item="lang"}
    <a href="{$lang.changeLang}">{$lang.langName}</a> | 
    {/foreach}
    But I have a custom navigation and want to make my own buttons with different images. I can set the language to "english" for example by adding a link like href="?language=english". In this case my website is completely translated to english but the visitor is thrown back to the start site (index.php).

    Is there a variable for "the current visited url" or something like that? I'd like to set up a link that changes the language and redirects to the current url. It's nearly the same as the code posted above with the difference that I can manually define which language is to choose.
  5. darek Customer

    I am glad, this is just a technical question

    the code is to generate word buttons automatically, nothing more

    instead of this you should be able to add buttons manually,

    what I would do is:
    generate the code automatically,
    see the code that changes the language the use the href for your own button that is from the automatic word buttons

    the module is designed this way that if there are 2 the same pages in 2 different languages when changing the language the parallel page will open in other language, however if the parallel page is not existant it will open index.php

    first make pages for both languages then they should open, however if you give pages different slugs for example in german- land, in english- country when changing the language the module will look for the previously used slug, if it is not there it will open index.php

    I think this is the problem, let me know how it goes

    the module has several protection codes, user can forget to add a page or a translation or may not want to have a particular page for both languages, if there is something wrong the module will use the code from 68c

    let me know if this is it

    Darek
  6. wabugi Customer

    I'm really bad at php scripting. I will try to tell you again what my problem is. Missing content for other languages is not the problem.

    I have a drop down menu. In this menu I have one title which shows an image of a flag. This flag should always show which language is currently displayed. On mouseover I get the drop down menu which should includes more images of flags. And by clicking one of the flags the website should load another language and redirect to the current URL.

    What I did:
    I added two code lines to the "get all languages"-part of langinit.php:
    Code:
    $rs['chlangenglish'] = "?lang=english&redirect=".urlencode($current_url);
    $rs['chlangdeutsch'] = "?lang=deutsch&redirect=".urlencode($current_url);
    Then I changed my menu to something like this:
    Code:
    {foreach from=$MultiResults item="lang"}
    {/foreach}
    <li><a href="{$lang.chlangenglish}"><img  /></a></li>
    <li><a href="{$lang.chlangdeutsch}"><img  /></a></li>
    
    It allows me to do get what I want. But I know that this solution is not right. It's far away from being correct and it includes some errors (but it works ^^). As said before I'm a really php-newbie. Is there a more proper solution for the function I need?

    EDIT: The flag which shows the current active language is working now. I made it with a smarty var.
  7. darek Customer

    Marcel,
    $rs['changeLang'] - is the link not the name

    let's do it a bit different:
    first in admin, don't give languages any name, but give them a slug
    german, english etc

    the part of code under: //get all languages will use the slug

    then after the code
    PHP:
    if ($langName == "")
                {
                
    $rs['langName'] = $rs['langSlug'];
                }
    write this:
    PHP:
    if ($rs['langSlug'] == "german")
                {
                
    $rs['langName'] = "<img src='the_path_to_image/german_flag.jpg' >";
                }
    and the same for other languages


    but you still need to use:
    PHP:
    {foreach from=$MultiResults item="lang"}
    <
    a href="{$lang.changeLang}">{$lang.langName}</a> | 
    {/foreach}
    actually anchanged, you can add different li, ul etc, but you have to use "foreach"

    simpler way is just to add <img> manually and then in href="?lang=english" without changing any php files

    let me know how it works
  8. darek Customer

    I just got another idea

    write this at the bottom of langinit.php, but inside // end table check


    $manuallang = "&redirect=".urlencode($current_url);
    $class_tpl->assign('manuallang', $manuallang);

    this gives smarty a new variable - really it is only $current_url
    and assign it

    then in tpl write this

    <li><a href="?lang=english{$manuallang}"><img /></a></li>
    <li> <li><a href="?lang=german{$manuallang}"><img /></a></li>

    then you can add other img

    Darek
  9. wabugi Customer

    Yeah that is exactly what I needed

    Many thanks! I didn't try your first idea. But the second works great
  10. darek Customer

    I am glad we solved the problem
  11. DGiscombe Graphic / Web Desginer

    emails

    Hi Darek,

    I've added emails such as 'english_welcome.tpl' to my email template folder it seems to be only sending out the default template.

    Could you check this out for me please?

    Daniel.
  12. darek Customer

    Have you changed the file: Mailer.php?
  13. DGiscombe Graphic / Web Desginer

    No changes made, the mailer.php file is the one you included.
  14. darek Customer

    I think you are doing something that is not correct

    first:
    change the original file: Mailer.php in includes\classes\kernel

    there is a little code in it like this:
    PHP:
    // Multilingual modification
            
    if (file_exists(FILESYSTEM_PATH ."templates/default/emails/html/".$lang."_".$content)) {
            
    $content=$lang."_".$content;
            } else {
            
    $content=$content;
            }
    // end
    it says, that if there is a file $lang."_".$content - english_welcome.tpl in folder: templates/default/emails/html/ - this file will be used, if the file is not existant, the script will use original file

    this is all

    please check if you have all right

    also there are settings for sending text content, if this is turned on you need to edit: english_welcome.tpl in templates/default/emails/text/ folder

    the multilingual module dosn't really have much to do with it, it only uses $lang variable to find the right file

    one more thing - the emails will be sent to user depending on language chosen by the user and cookie he has, lang is a choice for a user, not really your - admin wish, so first yourself go to your own page as user then switch to the language you want to have the email to be sent in then try it by registering or something tha will generate the email

    Darek
  15. DGiscombe Graphic / Web Desginer

    Thanks,

    I did not check the mailer.php file to see if it was pointing to the right template folder.

    Daniel.
  16. Incoe Customer

    how can i buy the language module?
  17. darek Customer

  18. ashami81 Customer

    Hi everyone,
    I was looking at your site, and I was interested in buying your product, but I was wondering that if I got this multilingual module integrated to the site, will I be able to write in Arabic?
  19. darek Customer

    Hi Ashami, sorry, I don't know, I guess if you are able to use 68c you would be able to use the module too, the module is independent from 68c, I made sure that there are no errors that national characters could cause, so far it works for polish, german, spanish and french and I think some more languages from south america

    so, I would say - if 68c works for you for arabic, the module will work for arabic too
  20. lowis Customer

    Is this module available?

Share This Page