PDA

View Full Version : Bi-lingual Site - English & Spanish



SmOkiNjOe
04-20-2004, 07:50 PM
I have successfully created an English and Spanish Openrealty based website, which is actually 2 installations using the same database. I have translated every last detail, and the listings need only be entered once from the English Admin. Fields in the listing template are in both English and Spanish (eg. full_desc_en and full_desc_es). Took a lot of messing around with editting the various files, but I think was well worth it.

Take a look and judge for yourselves:

http://www.malicatech.com/~licaserv/

marb
04-21-2004, 01:59 AM
Look ferry nice. mío cumplido! (that's the only Spanisch I know :mrgreen: )


I have translated every last detail, and the listings need only be entered once from the English Admin. Fields in the listing template are in both English and Spanish (eg. full_desc_en and full_desc_es).
Could you give some more details about how you fix that?
I mean how you set the links to the "en" and "es" site in the listing templates?
Or would you share the admin part with us?

Thank you,
Marten :)

tito
04-21-2004, 08:28 AM
Looks great! :wink:

I am currently trying the same here, but am not sure where to begin.
How would you do it if you wanted more than 4 languages (is it lots of work per site?).

If you would have a design for one customer (in 2 languages) and you wanted to change the look and feel. Would that mean changing all the sites?

As Marten, I would also be very interested in I how you set the links to the "en" and "es" site in the listing templates.

And ofcourse would be greatfull for eternity if you would share the admin part with.

Thanks,
Tito

SmOkiNjOe
04-21-2004, 06:34 PM
Ok here's a quick explanation as to how I got this working for me:

I installed the english version in the www root folder on my server, then another installation into a folder named "es" for the spanish version. I specified the same database info for both installations in common.php.

First of all, I had to edit quite a few of the files which have some of the language "hard coded" into them, ie even if you change the lang file to spanish, some of the site will still use english. So remember, it will be difficult to apply any future updates to Open Realty by using my methods.

I edited the /es/template/vertical-menu/user_top.html to translate the time and date etc.
I edited the /es/template/vertical-menu/style.php to translate the "yahoo maps" bit.... I didn't use that function in the end tho.
I edited /es/template/vertical-menu/user_bottom.html to translate the footer etc.
To create any new pages on the menu, I used the aboutus.php as a template.

Here comes the tricky bits:
I edited the /admin/template_editor.php and added a few extra lines:


<td class="templateEditorNew"align="left">
<select name="location" size="1">
<OPTION VALUE="top_right">top_right</OPTION>
<OPTION VALUE="top_right_es">top_right_es</OPTION>
<OPTION VALUE="top_left" >top_left</OPTION>
<OPTION VALUE="top_left_es" >top_left_es</OPTION>
<OPTION VALUE="bottom_right" >bottom_right</OPTION>
<OPTION VALUE="bottom_right_es" >bottom_right_es</OPTION>
<OPTION VALUE="bottom_left">bottom_left</option>
<OPTION VALUE="bottom_left_es">bottom_left_es</option>
<OPTION VALUE="headline">headline</option>
<OPTION VALUE="headline_es">headline_es</option>
<OPTION VALUE="center">center</option>
<OPTION VALUE="center_es">center_es</option>
<OPTION VALUE="feature1">feature1</option>
<OPTION VALUE="feature1_es">feature1_es</option>
<OPTION VALUE="feature2">feature2</option>
<OPTION VALUE="feature2_es">feature2_es</option>
</select>
</td>

and further down:


<td class="templateEditorHead" align="left">
<select name="location" size="1">
<OPTION VALUE="<?php echo $location ?>" SELECTED><?php echo $location ?></OPTION>
<OPTION VALUE="">-----</OPTION>
<OPTION VALUE="top_right">top_right</OPTION>
<OPTION VALUE="top_right_es">top_right_es</OPTION>
<OPTION VALUE="top_left" >top_left</OPTION>
<OPTION VALUE="top_left_es" >top_left_es</OPTION>
<OPTION VALUE="bottom_right" >bottom_right</OPTION>
<OPTION VALUE="bottom_right_es" >bottom_right_es</OPTION>
<OPTION VALUE="bottom_left">bottom_left</option>
<OPTION VALUE="bottom_left_es">bottom_left_es</option>
<OPTION VALUE="headline">headline</option>
<OPTION VALUE="headline_es">headline_es</option>
<OPTION VALUE="center">center</option>
<OPTION VALUE="center_es">center_es</option>
<OPTION VALUE="feature1">feature1</option>
<OPTION VALUE="feature1_es">feature1_es</option>
<OPTION VALUE="feature2">feature2</option>
<OPTION VALUE="feature2_es">feature2_es</option>
</select>
</td>

Now when we log into the admin on the web, then click on "edit listings template", you will see in each field on the line "display location" we have the extra options for spanish... top_right_es etc.
Now we have to create new fields identical to each of the existing ones, so start with the first one... address. Create a new one and call it address_es. Just change the field caption to Dirección and the display location to top_left_es. Keep the rank number the same as the corresponding english field.
Now repeat this for all the fields you plan to use.
One little snag however, don't make them all "display when browsing" or you will have a mass of fields when you use the listing_browse.php.
All I have as "display when browsing" is price and region. I changed the field caption for price to "€" which is the same in both languages, and "region" is the same in both languages too.

We are nearly there.
Edit /es/listing_browse.php and change the word "title" to look like this:


// Add Title as a search link
$field_caption = "Título";


Now edit the /es/listingview.php to look like this: (this is my FULL listingview.php file)


<?php


include&#40;"include/common.php"&#41;;
include&#40;"$config&#91;template_path&#93;/user_top.html"&#41;;


if &#40;$listingID == ""&#41;
&#123;
echo "<a href=\"index.php\">$lang&#91;perhaps_you_were_looking_something_else&#93;</a>";
&#125;


elseif &#40;$listingID != ""&#41;
&#123;
// first, check to see whether the listing is currently active
$show_listing = checkActive&#40;$listingID&#41;;
if &#40;$show_listing == "yes"&#41;
&#123;
?>
<!-- This Script opens a new window it is used by the mortgage calc. -->
<script type="text/javascript">
<!--
function open_window&#40;url&#41;
&#123;
cwin = window.open&#40;url,"attach","width=350,height=400,toolbar=no,resizable=yes"&#41;;
&#125;
-->
</script>
<table border="<?php echo $style&#91;form_border&#93; ?>" cellspacing="<?php echo $style&#91;form_cellspacing&#93; ?>" cellpadding="<?php echo $style&#91;form_cellpadding&#93; ?>" width="<?php echo $style&#91;admin_table_width&#93; ?>" class="form_main" align="center" >
<tr>
<td colspan="2" class="row_main">
<?php getMainListingData&#40;$listingID&#41;; ?>

<h4>
<?php renderTemplateAreaNoCaption&#40;headline,$listingID&#41;; ?>

</h4>
</td>
</tr>
<tr>

<?php
renderListingsImages&#40;$listingID&#41;
?>

<td class="row_main">
<table width="<?php echo $style&#91;left_right_table_width&#93; ?>" cellpadding="<?php echo $style&#91;left_right_table_cellpadding&#93; ?>" cellspacing="<?php echo $style&#91;left_right_table_cellspacing&#93; ?>" border="<?php echo $style&#91;left_right_table_border&#93; ?>">
<tr>
<td align="left" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;top_left_es,$listingID&#41;; ?>


</td>
<td align="right" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;top_right_es,$listingID&#41;; ?>


</td>
</tr>
</table>
<br>
<table width="98%">
<tr>
<td valign="top">
<?php renderTemplateArea&#40;center_es,$listingID&#41;; ?>
<br><br>
</td>
</tr>
</table>



<table width="<?php echo $style&#91;left_right_table_width&#93; ?>" cellpadding="<?php echo $style&#91;left_right_table_cellpadding&#93; ?>" cellspacing="<?php echo $style&#91;left_right_table_cellspacing&#93; ?>" border="<?php echo $style&#91;left_right_table_border&#93; ?>">
<tr>
<td align="left" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;feature1_es,$listingID&#41;; ?>
</td>
<td align="right" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;feature2_es,$listingID&#41;; ?>
</td>
</tr>
</table>

<br><br><a href="javascript&#58;open_window&#40;'calc.php?price=<? renderSingleListingItemRaw&#40;$listingID, "price"&#41; ?>'&#41;"><b>Calculadora De la Hipoteca</b></a>
<br><a href="listingview.php?listingID=<?php echo $listingID ?>&amp;amp;printer_friendly=yes"><b>Versión amistosa de la impresora de esta página</b></a>
<br><a href="email_listing.php?listingID=<?php echo $listingID ?>"><b>Email este listado a un amigo</b></a>
<br>
<table width="<?php echo $style&#91;left_right_table_width&#93; ?>" cellpadding="<?php echo $style&#91;left_right_table_cellpadding&#93; ?>" cellspacing="<?php echo $style&#91;left_right_table_cellspacing&#93; ?>" border="<?php echo $style&#91;left_right_table_border&#93; ?>">
<tr>
<td align="left" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;bottom_left_es,$listingID&#41;; ?>
</td>
<td align="right" class="row_main" width="50%" valign="top">
<?php renderTemplateArea&#40;bottom_right_es,$listingID&#41;; ?>
</td>
</tr>
</table>
<br><br>
<hr size="1" width="75%">
<?php renderUserInfoOnListingsPage&#40;$listingID&#41; ?>
<br>
<?php getListingEmail&#40;$listingID&#41; ?>
<br><br>
<hr size="1" width="75%">
<?php hitcount&#40;$listingID&#41; ?>

</td>
</tr>
</table>

<?php
&#125; // end if &#40;$show_listing == "yes"&#41;
&#125; // end elseif &#40;$listingID != ""&#41;

include&#40;"$config&#91;template_path&#93;/user_bottom.html"&#41;;
?>

Notice the only things to change is to add the _es after top_right etc.

Now go and add a new listing. You should now have places to add everthing for both english and spanish.

All that is left to do, is add the English and Spanish flag links to each page. The url should point to the corresponding language file each page on both sites.

I also edited the /es/calc.php and translated that to spanish.
I kept finding little bits of english popping up occasionally until I finally found all the little bits and translated them.

Gimme a shout if you get stuck.

This should be exactly the same process for adding another site in another language. Just install Oen Realty again in a /de folder for german and follow the above method.

Happy editing.

TIP: Backup each file before editing.

marb
04-22-2004, 03:39 PM
Thanks for the reply.
I'm tweak now what you descripe, let you know the results.

Marten :)

SmOkiNjOe
04-23-2004, 10:21 AM
How would you do it if you wanted more than 4 languages (is it lots of work per site?).

If you would have a design for one customer (in 2 languages) and you wanted to change the look and feel. Would that mean changing all the sites?


I completed the content for the index.php, aboutus.php, contactus.php etc on the english site, then used a translator software called systran ( http://www.systransoft.com/ ) to translate all the text for the spanish site. All I had to do was copy 'n paste the text into Systran, and copy it back into the spanish site. Both sites use identical style.css so you need only to copy the one from the english site to have the sites looking similar.
The only other thing that takes a while, is translating the menu items, as I didn't use the default menu.php, but created my own which is a Dynamic html menu. If you change the graphic for the title, you could link to the same graphic for each site, unless you use words in the title which need translating of course.
So I think there is not too much to change for each site, even if you had 4 or 5 languages, it is only a matter of copy and paste.... an hour or so and you can change the look of all sites.

Fat Lizard
04-24-2004, 10:57 AM
The flash strip at the top hies part of the menu (Search By || Type ..)

SmOkiNjOe
04-24-2004, 05:42 PM
Actually, I have included in my menu script, a small script to hide the flash when the menu pops out. It seems to be working ok for me. Go back and take another look. :wink:

Fat Lizard
04-25-2004, 01:18 PM
http://fatlizard.com.au/images/snap.jpg

SmOkiNjOe
04-25-2004, 04:55 PM
http://www.malicatech.com/images/grab.jpg
Like I said.... it works for me. 8)

Fat Lizard
04-26-2004, 11:17 AM
Whatever the cause, same again ..
http://fatlizard.com.au/images/snap02.jpg

SmOkiNjOe
04-26-2004, 03:07 PM
What browser are you using buddy?

Fat Lizard
04-27-2004, 01:20 AM
What browser are you using buddy?

IE6

Went back again.
The flash strip overlaps while the home page is first loading.

Once I browsed the site and went back to home page, flash strip disappeared as menu opened.

Mick
04-27-2004, 01:47 AM
No problems in IE6 for me....

However,

That overlap problem does occur for me as well in Mozilla FireFox and Opera....

Just FYI

SmOkiNjOe
04-27-2004, 09:34 AM
Thanks for the feedback.... I'll have to work on this glitch. :)

asitudela
07-03-2004, 09:49 AM
Thanks for your post but I believe that there is a detail to solve, in listing_browse.php the titles would have to appear depending on the language in which you work, example if you are in English "Adress" and in Spanish "Direccíón"

------------------------ En castellano -------------------------------

Gracias por tu post pero yo creo que hay un detalle por solucionar, en listing_browse.php los títulos deberían aparecer dependiendo del idioma en el que tu estés, ejemplo si estás en Inglés "Adress" y en Español "Dirección"



Salu2 de Díaz

RealEstate
07-03-2004, 02:10 PM
great job smokingjoe. the flash menues work for me ie 6.0

SmOkiNjOe
07-03-2004, 06:13 PM
Thanks for your post but I believe that there is a detail to solve, in listing_browse.php the titles would have to appear depending on the language in which you work, example if you are in English "Adress" and in Spanish "Direccíón"

------------------------ En castellano -------------------------------

Gracias por tu post pero yo creo que hay un detalle por solucionar, en listing_browse.php los títulos deberían aparecer dependiendo del idioma en el que tu estés, ejemplo si estás en Inglés "Adress" y en Español "Dirección"



Salu2 de Díaz

I agree .... I did tell the guy who maintains the site, to use none descriptive titles to his listings, as the title code is hard coded once again. It seemed a bit too complicated for me at the time to get the title to work seperately in english and spanish, using just a single database.

Convengo.... Dije a individuo que mantiene el sitio, para no utilizar ninguno los títulos descriptivos a sus listados, como el código del título se cifra difícilmente de nuevo. Se parecía un pedacito complicado también para mí en ese entonces para conseguir el título para trabajar seperately en inglés y español, usando apenas una sola base de datos.

Costaluz
07-28-2004, 01:31 PM
Hi SmokinJoe,

Thanks for sharing your bilingual mod. I've tried to implement it and it works to a point. What I can't do is get the images to appear on the /es part of the site.

Any help would be really appreciated.

Thanks

David

muanglao
08-05-2004, 11:01 AM
Hi SmOkiNjOe et al,

Does this method of yours updates the entire database once changes had been made to either English or whatever language?

Thanks,

MuangLao

marian
08-06-2004, 03:00 AM
All I had to do was copy 'n paste the text into Systran, and copy it back into the spanish site.
Systrans and other auto programs produce rubbish translations.

This example of a Systrans translation from Spanish to English illustrates what I mean.

"The return of Argentina between the ten first has been offering something to him of lost consolation after having the end of the America Glass before Brazil in a definition of penitentiaries for one week and average."

So a Spaniard reading you site will find the language odd.

waloukern
08-21-2004, 04:58 AM
For the search i add this on my demo site (first language french, second language english)

http://www.netmedia.coop/immo

In Admin/template_editor.php

Find and replace or add

$sql_searchable = make_db_safe($_REQUEST['searchable']);
$sql_searchable_eng = make_db_safe($_REQUEST['searchable_eng']);
$sql_search_type = make_db_safe($_REQUEST['search_type']);


$sql .= "searchable = $sql_searchable, ";
$sql .= "searchable_eng = $sql_searchable_eng, ";
$sql .= "search_type = $sql_search_type, ";



<tr>
<td align="right" class="templateEditorNew" valign="top"><b>Afficher pour la recherche:</b></td>
<td class="templateEditorNew">
<td class="templateEditorNew"><input type="checkbox" name="searchable" value = "1"></td>
</tr>
<tr>
<td align="right" class="templateEditorNew" valign="top"><b>Afficher pour la recherche en anglais:</b></td>
<td class="templateEditorNew">
<td class="templateEditorNew"><input type="checkbox" name="searchable_eng" value = "1"></td>
</tr>

$searchable = make_db_unsafe($recordSet->fields['searchable']);
$searchable_eng = make_db_unsafe($recordSet->fields['searchable_eng']);
$search_label = make_db_unsafe($recordSet->fields['search_label']);

<tr>
<td align="right" class="templateEditorNew" valign="top"><b>Afficher pour la recherche:</b></td>
<td class="templateEditorNew">
<input type="checkbox" name="searchable" value = "1" <?php if ($searchable) {echo 'CHECKED';} ?>></td>
</tr>
<tr>
<td align="right" class="templateEditorNew" valign="top"><b>Afficher pour la recherche en anglais:</b></td>
<td class="templateEditorNew">
<input type="checkbox" name="searchable_eng" value = "1" <?php if ($searchable_eng) {echo 'CHECKED';} ?>></td>
</tr>

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In eng/listingsearch.php
replace searchable by searchable_eng

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

in the database add a searchable_eng

and i think it's ok

WarhelmeT
07-03-2005, 04:33 PM
Hi,

My OR version is 2.0.4. I start edit my OR for multilang. but there is a problem i think.

first, i couldnt find /admin/template_editor.php for edit.

in admin folder i have images folder, template folder and index.php



second, a file i found /include/multilingual.inc.php this file what for ?

thank you

ian_ok
07-04-2005, 10:43 AM
Hi,

My OR version is 2.0.4. I start edit my OR for multilang. but there is a problem i think.

first, i couldnt find /admin/template_editor.php for edit.

in admin folder i have images folder, template folder and index.php



second, a file i found /include/multilingual.inc.php this file what for ?

thank you

You have replied to a show off thread which is OVER 1 year old! You are using the new version of O.R. this thread is for version 1.5.x Try posting in the 2.0 help section and read the documentation etc..

Ian

waloukern
07-14-2005, 05:33 AM
You are allright, this thread is working on the 1.15.
I haven't no answer for the 2.0.4

ian_ok
07-14-2005, 06:58 AM
POST A REQUEST IN THE 2.x SECTION THEN. You haven't done this yet, from what I can see.

Ian