i18n translation helpers for admin to retrieve words based on locale.
Translates attribute name for the given model.
@param [Symbol] model
The model name for the translation.
@param [Symbol] attribute
The attribute name in the model to translate.
@return [String] The translated attribute name for the current locale.
@example
# => t("models.account.email", :default => "Email") mat(:account, :email)
# File lib/padrino-admin/helpers/view_helpers.rb, line 47 def model_attribute_translate(model, attribute) t("models.#{model}.attributes.#{attribute}", :default => attribute.to_s.humanize) end
Translates model name
@param [Symbol] attribute
The attribute name in the model to translate.
@return [String] The translated model name for the current locale.
@example
# => t("models.account.name", :default => "Account") mt(:account)
# File lib/padrino-admin/helpers/view_helpers.rb, line 64 def model_translate(model) t("models.#{model}.name", :default => model.to_s.humanize) end
Translates a given word for padrino admin
@param [String] word
The specified word to admin translate.
@param [String] default
The default fallback if no word is available for the locale.
@return [String] The translated word for the current locale.
@example
# => t("padrino.admin.profile", :default => "Profile") pat(:profile) # => t("padrino.admin.profile", :default => "My Profile") pat(:profile, "My Profile")
# File lib/padrino-admin/helpers/view_helpers.rb, line 28 def padrino_admin_translate(word, default=nil) t("padrino.admin.#{word}", :default => (default || word.to_s.humanize)) end
Generated with the Darkfish Rdoc Generator 2.