Rorra's blog Senior Developer

December 30, 2009

Installing radiant 0.9 with multiple language support

Filed under: Ruby — admin @ 7:46 AM


I’ve been playing with many CMS, I developed and worked on many web sites, and although Radiant 0.9 was not yet released (Radiant 0.9 RC1 was released), the updates that we have in Radiant 0.9 are great and we should strongly consider start using Radiant 0.9 right now. I don’t understand why they didn’t name it 1.0, since it’s really mature.


The actual support for multiple languages, with plugins like globalize2, save the images automatically in Amazon S3, which is pretty cheap, and you can host your site on herko for $0, and start paying once you have thousand of visits, well, I’m having dreams right now about it, but Radiant stop being a toy some time ago to be a real mature CMS and one more of the reasons that many people is migrating to Rails (because of the CMS :) ), anyway, I love playing with Radiant :P


Let’s get started. There is an excellent guide wrote by Aissac to install Radiant with Paperclip and Globalize2, but if you follow the guide step by step, you will find some troubles (I did), so I left you here a step by step guide, for beginners, so you can get your Radiant 0.9 RC 1 plus the most used plugins with support for multiple languages.


Assuming you already have installed ruby, rails, rubygem, etc. the first step is to install Radiant 0.9 RC 1, we can download it from the next address:
http://radiantcms.org/downloads/radiant-0.9.0-rc1.gem


Once you download it, execute the command:

gem install radiant-0.9.0-rc1.gem



We generate our site

radiant new_site



And we edit the database configuration file (config/database.yml)

development:
  adapter: mysql
  database: new_site_development
  username: root
  password:
  host: localhost
  encoding: utf-8



We generate the database, and we end the installation of Radiant

rake db:create
rake db:bootstrap



Now we start installing the plugins, first, copy_move plugin

git clone git://github.com/pilu/radiant-copy-move.git vendor/extensions/copy_move
rake radiant:extensions:copy_move:update
rake radiant:extensions:copy_move:migrate



We install the reorder plugin, which will allow us to order our website pages

git clone git://github.com/radiant/radiant-reorder-extension.git vendor/extensions/reorder
rake radiant:extensions:reorder:update
rake radiant:extensions:reorder:migrate



We continue with paperclip

git clone git://github.com/kbingman/paperclipped.git vendor/extensions/paperclipped
rake radiant:extensions:paperclipped:migrate
rake radiant:extensions:paperclipped:update



Now we install globalize2, which allows multiple languages on our site (even if we are just thinking about just one language)

git clone git://github.com/Aissac/radiant-globalize2-extension.git vendor/extensions/globalize2
rake radiant:extensions:globalize2:migrate
rake radiant:extensions:globalize2:update



A intermediate step before continuing, we need to edit the file config/environment.rb, and after the commented line with config.extensions, we add:

  config.extensions = [ :copy_move, :paperclipped, :globalize2, :all ]



And now, we install globalize2-paperclipped, which allow us to globalize our assets :)

git clone git://github.com/Aissac/radiant-globalize2-paperclipped-extension.git vendor/extensions/globalize2_paperclipped
rake radiant:extensions:globalize2_paperclipped:migrate
rake radiant:extensions:globalize2_paperclipped:update



The chicken is ready!!! (Argentine phrase ;) ), now you can have your site with Radiant, in multiple languages, don’t forget to check each plugin documentation, in example, to setup many languages in globalize2, edit the file config/environment.rb and add to the end of it:

Radiant::Config['globalize.default_language'] = 'sp'
Radiant::Config['globalize.languages'] = 'en,de,fr'
Be Sociable, Share!

2 Comments »

  1. Thanks for the nice summary of steps. However, for some reason, it is not working for me.

    It is not picking up the ?locale=xx in the admin section. It always uses the default locale.

    I also have these warnings:
    warning: already initialized constant SnippetTranslation
    warning: already initialized constant LayoutTranslation
    …… (a few more)

    Any thoughts?

    Comment by Joris — January 21, 2010 @ 7:55 PM

  2. Hi Joris

    I just moved to Guadalajara and had about 5 minutes to check some things on the net. I will check again the step by step guide I made. Notice that there is not need to do something like /?locale=xx, but instead, to use the URL/locale/route instead, like http://www.myblog.com/fr/contacts, although http://www.myblog.com/contacts?locale=fr should also work.

    As a start, check the table config in the database, there should be two rows, one like globalize.default_language, and another row like globalize.languages. If you don’t have such rows, make sure you have added some configuration in the config/envirnoment.rb like this:

    Radiant::Config['globalize.default_language'] = ‘us’
    Radiant::Config['globalize.languages'] = ‘de,fr,uk,au,ca,ca’

    About the warnings, it’s ok, radiant 0.9 is a release candidate, and although most plugins were updated to work with radiant 0.9, they still have to do some cleaning to drop all those warnings

    Thx

    Comment by admin — January 23, 2010 @ 3:10 PM

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress