[Rg 129] Re: patch for Content-Language based localization

Michael Fellinger m.fellinger at gmail.com
Mon Jan 14 11:11:47 EST 2008


On Jan 13, 2008 6:24 PM, Keita Yamaguchi <keita.yamaguchi at gmail.com> wrote:
> Hi,
>
> This is a patch for response header "Content-Language" based localization.
> Ramaze localization is session based only, but sometimes non-session
> based localization is required.
> For example, there is a case that locale is determined by path:
>
> /index ... localized "index" by session based
> /en/index ... localized "index" for language "en"
> /ja/index ... localized "index" for language "ja"
>
> This patch provides an easy solution like this code:
>
> class MainController < Ramaze::Controller
>   trait :lang => nil
>   def index
>     response["Content-Language"] = class_trait[:lang] if class_trait[:lang]
>   end
> end
>
> class EnController < MainController
>   map '/en'
>   trait :lang => "en"
> end
>
> class JaController < MainController
>   map '/en'
>   trait :lang => "ja"
> end

Thanks a lot, applied this.

^ manveru


More information about the Ramaze-general mailing list