Methods
Included Modules
Public Class methods
init_gettext(domainname, options = {}, content_type = "text/html")
[ source ]
Bind a ‘textdomain’ to all of the controllers/views/models. Call this instead of GetText.bindtextdomain.
- textdomain: the textdomain
- options: options as a Hash.
- :charset - the output charset. Default is "UTF-8"
- :content_type - the content type. Default is "text/html"
locale is searched the order by @params["lang"] > "lang" value of QUERY_STRING > "lang" value of Cookie > HTTP_ACCEPT_LANGUAGE value > Default locale(en). And the charset is set order by "the argument of bindtextdomain" > HTTP_ACCEPT_CHARSET > Default charset(UTF-8).
Note: Don‘t use content_type argument(not in options). They are remained for backward compatibility.
If you want to separate the textdomain each controllers, you need to call this function in the each controllers.
app/controller/blog_controller.rb:
require 'gettext/rails' class BlogController < ApplicationController init_gettext "blog" : : end
textdomainname()
[ source ]
Gets the textdomain name of this controller.