edoplaza Posted January 11, 2009 Report Posted January 11, 2009 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 Quote
PicnicTutorials Posted January 11, 2009 Report Posted January 11, 2009 (edited) "magic" - seriously uh - that's funny. You "could" use a style sheet swichter to do it. But I'm pretty sure I've come accross services that do this. Google should be able to light your way. Edited January 11, 2009 by Eric Quote
Wickham Posted January 11, 2009 Report Posted January 11, 2009 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). Quote
Andrea Posted January 11, 2009 Report Posted January 11, 2009 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 Quote
administrator Posted January 11, 2009 Report Posted January 11, 2009 "Have a refreshing moment all the time." Sounds good to me and I'm working on it. Quote
edoplaza Posted January 12, 2009 Author Report Posted January 12, 2009 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 Quote
PicnicTutorials Posted January 12, 2009 Report Posted January 12, 2009 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. Quote
lm Posted January 12, 2009 Report Posted January 12, 2009 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. Quote
edoplaza Posted January 12, 2009 Author Report Posted January 12, 2009 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 Quote
LSW Posted January 12, 2009 Report Posted January 12, 2009 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. Quote
PicnicTutorials Posted January 12, 2009 Report Posted January 12, 2009 (edited) Yeah, while Googling, I found a few CMS's that has that functionality right out of the gate. Edit - I hate how it tarneshes my post when I edit it with BIG edited text. I never spell my post correctly the first time. Edited January 12, 2009 by Eric Quote
martez81 Posted June 21, 2009 Report Posted June 21, 2009 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. Quote
edoplaza Posted June 26, 2009 Author Report Posted June 26, 2009 Thank you! your solution is smooth and elegant. I'll give it a try... Cheers, Eduardo Quote
martez81 Posted June 26, 2009 Report Posted June 26, 2009 Oops, just found a mistake in my previous post. You have to use super global $_GET instead of $_POST to grab a var from the link Quote
Helipacter Posted September 30, 2009 Report Posted September 30, 2009 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 Quote
Recommended Posts
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.