I think we could use the accept-language request header sent by the
browser, after it is sanitized, which could be overriden by a
user-preference.
Victor
Roeland Moors wrote:> I made a very simple translation example.
>
> The translations are just stored in a languages table with one
> column per language.
>
> Then I created this controller:
> ------------------
> class Language < ActiveRecord::Base
> end
>
> orig_lang = ''english''
> new_lang = ''dutch''
>
> class String
> def i18n
> need_trans = self.chomp.strip
> translated = Language.find_all(
>
"#{orig_lang}=''#{need_trans}''", nil, 1)
> result = translated.first[new_lang] if !translated.empty?
> result = need_trans if result == nil
> result
> end
> end
> -------------------
> The ''new_lang'' var should be placed somewhere else
ofcourse.
>
> Now I can just translate a string by appending ''.i18n''.
> Example:
> <%= link_to ''Show''.i18n, :action =>
''show'', :id => todo.id %>
>
> Ofcourse it would be better if .i18n is placed inside the helper,
> but it''s just an example.
>
> I know this is a very simplistic example, but isn''t this a good
start?
>
> Comments are appreciated,
>
> Roeland
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails