Jump to content

Site in two languages


edoplaza

Recommended Posts

Hello,

 

A client wants his new site to be bilingual, meaning that he wants a "magic" button at the top of the banner saying "English version" (the site is originally in Spanish") and viceversa which changes the content of the whole site automatically in just one click. What would be the best apporach to achieve this? Do I have to create everything twice, or create like a parallel site?

 

Thanks

 

Eduardo

Link to comment
Share on other sites

The "magic" button would be a link to another page. but you could use the first page as a template, use the same structure and stylesheet, just edit the text to a different language, then save under a different filename to be used in the link (and vice versa frorm the new page back to the old page).

Link to comment
Share on other sites

And I want to add that under NO CIRCUMSTANCES should you (or your client) use one of those automatic internet translators. If you want something translated, some human will have to do it or you'll get nothing but crap.

 

And in case you need prove - here is the above translated by computer into German and then back into English"

 

GERMAN:

Und ich m?chte den unter KEINEN UMST?NDEN hinzuf?gen, wenn Sie (oder Ihr Klient) einen jener automatischen Internet-?bersetzer benutzen. Wenn Sie ?bersetztes etwas w?nschen, muss irgendein Mensch es tun, oder Sie erhalten, nichts aber schei?en.

Back To English:

And I would like to add that under NO CIRCUMSTANCES, if you (or your client) use one of those automatic Internet compilers/translators. If you require translated something, any humans must do it, or, nothing receives you however to shit.

 

Which reminds me - I recently had an email exchange with some guy who contacted me through Killersites who I believe may be from Africa - his New Year wish for me is to: "Have a refreshing moment all the time." Sounds good to me and I'm working on it :D

Link to comment
Share on other sites

As I'm not lazy, I'll translate both texts myself (or, better than that, I will ask the client to provide the English version of his texts). At least he is not a writer or something like that, with tons of text to translate.

 

I was just wondering about the necessity of having every single file in two versions. Maybe, in a future, when I improve my php skills, I'll have both texts located in a DB and I'll just use a little function to switch between Spanish and English (Gosh, why didn't that Esperanto language work..., that would be easier then...)

 

Thanks

 

Eduardo

Link to comment
Share on other sites

As I'm not lazy, I'll translate both texts myself (or, better than that, I will ask the client to provide the English version of his texts). At least he is not a writer or something like that, with tons of text to translate.

 

I was just wondering about the necessity of having every single file in two versions. Maybe, in a future, when I improve my php skills, I'll have both texts located in a DB and I'll just use a little function to switch between Spanish and English (Gosh, why didn't that Esperanto language work..., that would be easier then...)

 

Thanks

 

Eduardo

 

The easiest way would be to just do what John/Wickham suggested. But, if you only have "one" section on each page that needs to be swaped, then this would be another way to go. Just put your spanish in the other div. Then you don't have to ever leave the page your on. If you have multiple areas on each page, then style switch would be the other way to go.

Link to comment
Share on other sites

I hold 3 language versions on my small website and the only way to manage content is to use php includes sets (so in al one folder with includes per each language):

for example:

english-folder:

header.php

content.php

footer.php

otherlang-folder:

header.php

content.php

footer.php

And then php script is used to organize index.php from those includes. If you decide that Spanish version is a home page, use includes from the second folder, and create index-en.php which will appear when your click on this magic button.

 

The problem with multilingual website is that once you build it, you (or the website owner) must do its regular (and preferably adequate) updates for each language and this is really become too much work to manage. It is all possible of course but depends on how organized the content is, how often updates are needed and how much time/money are spent on updates.

For small website like mine, to support few languages, the script from this article serves ok but I suppose you can (and may be should consider to) adapt some CMS for both languages if you build bigger website.

Link to comment
Share on other sites

Well, thank you very much for the information.

 

The suggested solutions are very interesting, but, as I said before, I need to improve my PHP skills to handle all those scripts properly. For now, I think I'll duplicate every file in both languages as the site is very small (it would be mainly the navigation bar, and probably a 3 or 4 other pages)

 

 

Cheers,

 

Eduardo

Link to comment
Share on other sites

A CMS would likely be the best way I think.

 

First you would need either the index or a Splash page, here a splash page is OK.

 

The Splash page offers Spanish or English(?) and would be the default page for the CMS. Then you could create to categories or two separate "Sites" within the CMS.

 

Now the link sends you to the Spanish branch or the English branch. Exactly how to do this depends on the CMS you choose.

 

By hand, you would use a switch case with a logic that says, if the ID of the page is Spanish use this content, if English use that content.

 

The CMS version would be easier to maintain and quicker I would think if you are not really experienced with PHP.

Link to comment
Share on other sites

  • 5 months later...

The topic is a bit old but anyway...

If you really want to include two languages in only one copy of your pages use strings with content in two languages and switch between them from the url

 

For example:

 

...website/index.php?lang=english

 

$lang = $_POST['lang'];

 

if($lang = 'english' ) {

echo "This is the fragment of the content in english language";

} else {

echo "This is a text in non-english language that will be shown when entering website";

}

 

So, if there is no lang var in the link then the website will show its content in non-english language. You have to include "ifs" for every portion of text that will be shown and also for every link that takes you to another subpage.

 

Here how it works with one of websites I created:

www.damisrestaurant.com

 

Hope it helps.

Link to comment
Share on other sites

  • 3 months later...
The topic is a bit old but anyway...

If you really want to include two languages in only one copy of your pages use strings with content in two languages and switch between them from the url

 

For example:

 

...website/index.php?lang=english

 

$lang = $_POST['lang'];

 

if($lang = 'english' ) {

echo "This is the fragment of the content in english language";

} else {

echo "This is a text in non-english language that will be shown when entering website";

}

 

So, if there is no lang var in the link then the website will show its content in non-english language. You have to include "ifs" for every portion of text that will be shown and also for every link that takes you to another subpage.

 

Here how it works with one of websites I created:

www.damisrestaurant.com

 

Hope it helps.

Wow, that is great. Is the code for the change language button something I can find online? I'm trying my hand at web design, as my partner needs a webpage for her Translation business, so this dual language option would be perfect.

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...