Support Forums

Multilingual module

This is a discussion on Multilingual module within the Modification Release forums, part of the Developer Forums category; Description This is something I missed. I want to have full translation to 2 languages for my upgrade to v4. ...


Go Back   68 Classifieds Forums > Developer Forums > Modification Release

Reply
 
Thread Tools Display Modes
Old 03-31-2009, 11:36 PM   #1
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Post Multilingual module



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.
darek is offline   Reply With Quote
Old 04-13-2009, 10:17 AM   #2
Graphic / Web Desginer
 
Join Date: Nov 2008
Location: London, England
Posts: 77
Rep Power: 14
DGiscombe is on a distinguished road
Default 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!
DGiscombe is offline   Reply With Quote
Old 04-17-2009, 12:06 PM   #3
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Default

for developers:

this is how categories/extrafields are changed in original Categories.php
PHP Code:
//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'];
                } 
darek is offline   Reply With Quote
Old 04-23-2009, 06:40 PM   #4
Member
 
Join Date: Mar 2009
Posts: 82
Rep Power: 18
wabugi is a glorious beacon of light wabugi is a glorious beacon of light wabugi is a glorious beacon of light
Default

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.
__________________
v4.15 - Developer Edition - custom template
wabugi is offline   Reply With Quote
Old 04-24-2009, 05:15 AM   #5
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Default

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
darek is offline   Reply With Quote
Old 04-24-2009, 04:51 PM   #6
Member
 
Join Date: Mar 2009
Posts: 82
Rep Power: 18
wabugi is a glorious beacon of light wabugi is a glorious beacon of light wabugi is a glorious beacon of light
Default

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.
__________________
v4.15 - Developer Edition - custom template

Last edited by wabugi; 04-25-2009 at 07:02 AM.
wabugi is offline   Reply With Quote
Old 04-25-2009, 03:36 PM   #7
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Default

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 Code:
if ($langName == "")
            {
            
$rs['langName'] = $rs['langSlug'];
            } 
write this:
PHP Code:
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 Code:
{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
darek is offline   Reply With Quote
Old 04-25-2009, 03:57 PM   #8
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Default

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
darek is offline   Reply With Quote
Old 04-25-2009, 04:57 PM   #9
Member
 
Join Date: Mar 2009
Posts: 82
Rep Power: 18
wabugi is a glorious beacon of light wabugi is a glorious beacon of light wabugi is a glorious beacon of light
Default

Yeah that is exactly what I needed

Many thanks! I didn't try your first idea. But the second works great
__________________
v4.15 - Developer Edition - custom template
wabugi is offline   Reply With Quote
Old 04-26-2009, 02:31 AM   #10
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 23
darek is on a distinguished road
Default

I am glad we solved the problem
darek is offline   Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 02:51 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0