Posts [ 10 ]

Topic: 3 Websites in 1? (+ extra language)

Hi,

I am new to RoR and I am looking for some guidance. I do not know if it is possible to do this but I am looking to build "3" websites from one application (using my 3 domain names). The structure will be the same for all 3 although one should be in a different language.Basically, depending from where you access the website you will be presented with the same structure but with the appropriate content in the appropriate language.

What is the best way to go about it????Is it possible at all?

I was thinking adding 2 extra columns to my database tables: country and language. Then I would check which domain name the user is accessing the website from and display content from database accordingly? Is this feasible?

The important first step is making sure that you have your database set up correctly to handle the right character set (UTF-8 is usually the safe option) and then to have your integration and functional tests set up to double check things.

Re: 3 Websites in 1? (+ extra language)

jbartels wrote:

Do you really want 3 separate websites or just one website that presents itself in the appropriate language??

Thank you for your suggestion. I am looking to display different content and language according to the user entry point (domain name) so it is not just a question of translating the website.So for instance, I would have a website for the US with US specific content and Forum another for the UK and another for France but in French. I said 3 websites but it could be one website with different content and language displayed according to the user's entry points (i want to use 3 different domain names, so users will be redirected to the main site but only the appropriate content will be diplayed). By having country and language columns in my tables I thought I could tell the application to only display items according to those 2 entities. So I thought I would basically have one website with different views depending on the url used to access the website?I am not sure really and that is why I need advice.

Re: 3 Websites in 1? (+ extra language)

I don't know of any examples off the top of my head.

I would start by identifying what parts of your site need to be changed then setting up a table to just store the country/language settings and for the tables that need to be changed, then set up a HABTM relationship

For example you might want to have different articles for each country. So the articles table would have rows that look like:

articles:id | title | author | body | permalink

countries:id | country | language

articles_countries:article_id | country_id

That way you can have one article that is valid for more than one country. Important articles or countries with shared languages might have that happen.