i have a website and what i'd like to do is add the option to choose the language that the text is shown.. i think that there is supposed to be a variable which will take a number indicating the chosen language.. eg 0:english, 1:spanish then using php the text is taken from a database or another sort of file and shown at my webpage.. thats how i have think of it.. please tell me if i what i've written is possible and if there's any better way to do it.. also tell me if i need cookies for keeping the code of the desired language or if there's any other way.. any help given would be very appreciated ps. i have basic knowledge of web programming, php n mysql.. i just need a little push to the right direction
Yeah it's possible. It would be better to have different folders (en/; es/; de/) that contain copies of the site created for that language.
i know that theres this solution too but i don't prefer it.. if i want to change something on the template for example i would have to change it for each language i have!! thats not good at all.. so can anyone help with how i get started with this?? thanks in advance
Well, if you are an advanced PHP developer then I advice you on using the system like vBulletin does. Create a language table with languageid, title and your needed fields. Create a phrase table with phraseid, phrasename, translation, languageid and your needed fields. Make users select a language and select a default one for the entire site. When your site loads, get all the phrases of the language. If you are not an advanced PHP developer, then including lang/file.php is better and easier for you.
no i am not an advanced php developer.. i know the basics and i mostly copy-paste-modify.. can u give some general guidelines on how i get started?? my site is written in html and it's not tha big.. there 6-7 texts with about 100 words each which will be updated rarelly..
go easy and use the google translate option like so http://66.102.9.104/translate_c?hl=en&sl=en&tl=nl&u=http://litewarez.com/ this is without the header hl=en - home language sl=en - sub language tl=nl - translated language u= URL HERE change the url according and you will be suprised broken down http://66.102.9.104/translate_c? / hl=en / & / sl=en / & / tl=nl / & / u=http://litewarez.com/ just use links with according lang
i do not want to use google for this.. the transilation is not that good and the other hand my site is pretty small with only a few texts which will be updated rarelly so i would like to do the transilation myself. but i need a little help with the php code.. and another question.. the texts should be saved in a mysql database or another type of file should be more appropriate??
Man, why not use apache rewrite? U can rewrite your directory /en/ /de/ /es/ to /index.php?language=en, etc... And u don't need to copy and create thy folders. U only have one root folder. Look on my site: http://www.MjuzikTube.com I also added ip to language detection, so that user is redirected to his preferred language on first visit. If u have any question just ask.