BaseApp Orange updated with basic pages and i18n support

Just a quick post to illustrate the changes I did to BaseApp Orange and how you can help shape it’s way.

BaseApp Orange is my attempt to create a base for future Rails projects which end up having similar constraints and features. This week I posted the code on github and I did some changes I thought I should comunicate.

Added SEO fields for Pages

I consider this one important. Basicaly, for each Page you create in the admin area, you can write the meta-keywords, meta-description and page slug for that page. When this page shows up in the frontend, that information will be part of it (unless they’re blank).

picture-4

You can also define this on a global scale for the app (in the config/config.yml file) and that way you can make your app more SEO friendly.

Basic i18n support

This is fairly new to me but I think I did some advances on this part. I defined two locales for the application, so there’s english and portuguese and i’ve got 2 yml files in config/locales/ with date formats, numbers, model names, attributes and much more.

picture-5

You can also use this yml file to store your own translations, like the below example:

picture-6

I also got a before_filter setup on the application.rb controller that sets the locale for each request:

before_filter :set_locale

def set_locale
locale = params[:locale] || 'pt'
I18n.locale = locale
end

And I got this working for Pages by defining my routes as this:

map.pages '/pages/:permalink/:locale', :controller=>"pages", :action=>"show", :defaults => { :locale => 'pt' }

This works fine even in the case you didn’t put the locale in the params.

picture-9

Now all I have to figure out is how to do the same for restful routes and translate the rest of the pages.

Any ideas?

Tags: , , , ,


No comments yet.

Leave a Reply