Localisation - Looking for a straight-forward solution


#1

Hello there.

I’m looking for a localisation plugin that is:

  • easy to use (like java’s ressource bundle for instance)
  • flexible enough*
  • fast
  • well documented

*My requirements in detail:

  • I want to take care of my database schema on my own (don’t want a
    autom. handling like globalize)
  • It should not torture my database; a file-based solution (with caching
    in memory) would be appreciated
  • Multiple languages per site required - but not necessarily per page
  • nice to have: The choise of the active language for a request should
    be up to me; not handled automatically
  • Unicode should be possible
  • Rails 1.16, 1.2 compatible
  • should work with fragment/action/page caching
  • would like to have a routing like: site.com/:lang/:controller/:action
  • translation of rails error messages and stuff
  • translation of model and attribute names (in error messages) would be
    appreciated

However I’m still not sure if it’s preferable to have multiple rhtmls
per language or to have just one with multiple calls to something like
“getText(XXXX)”. I could image that the multiple rhtml-solution is more
flexible and possibly faster. What do you think or what are you
experiences?

Thanks…
David


#2

I’m using this, works.

http://wiki.rubyonrails.org/rails/pages/Localization+Plugin


#3

Hi. Sounds like GLoc would be a good fit for those requirements.
However regarding the points:

  • translation of rails error messages and stuff
  • translation of model and attribute names (in error messages) would be
    appreciated
    you would have to do that yourself.

Golly


#4

Thanks god Gloc 1.2 is out:-)

It’s my last hope.

Thanks…
David


#5

Great to hear. Hope it’s what you’re looking for. :slight_smile:

Golly


#6

Yes, indeed. k Thnx!!

However I have one thing that is in conflict with my requirements: As I
can see it does not work with caching very well.

Do you use caching in your web-apps?

Regards
//David


#7

I have no idea. Actually I’m using the RESTful versions. Therefore the
cache is organised like
/tmp//:resource/:id/:sub_resource/:id.cache

How can the url_for modify the cache-filename?

THX
David


#8

Hi. Yes, I’ve used it with caching without any problems. You know how
you use a url_for style hash to identify the cached filename, just add
:lang => current_language to it.

Golly


#9

You’ll have to look up the rails api or google it but i remember that
methods like cache(), expire_fragment(), cache_page() accept url_for
params. I’d give u more help but I’ve been programming in Java for the
last month or two so it feels like a while since I touched ruby on
rails.

Golly