[RAILS3] I hesitate on how handling the locale view templates to default to one language only .. sending admin emails will go only to one locale ''en_GB'' should I set it up into the template name and set I18n.locale to ''en_GB'' membership_renew.en_GB.html.erb OR whatever locale is used , if I have : membership_renew.html it will be the default ? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Kad Kerforn wrote in post #999856:> [RAILS3] > > I hesitate on how handling the locale view templates to default to > one language only .. > > sending admin emails will go only to one locale ''en_GB'' > > should I set it up into the template name and set I18n.locale to > ''en_GB'' > > membership_renew.en_GB.html.erb > > OR > > whatever locale is used , if I have : > > membership_renew.html > > it will be the default ?Hi, at least I didn''t completely get your problem. The way I set a default locale is: config.i18n.fallbacks = true config.i18n.default_locale = :en I have 3 languages and if one translation is not found it fallback to english. But again, I maybe didn''t get your goal. Cheers. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I agree , not very clear .... I was referring to mailer template views I tested many cases and it seems I need to define .en_GB views ( including the locale) I am using already the fallback... config.i18n.fallbacks = true config.i18n.default_locale = :en_EN but I am concerned by mailer ? which seems to handle locale differently. Here is a case : I am logged in as current_user I select :en_ES as locale for display I visit the site .. and I some point the system need to send a message to the site admin... as mailer views I MUST have templates like : welcome.en_GB.html.erb and NOT welcome.html.erb On 20 mai, 22:02, comopasta Gr <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Kad Kerforn wrote in post #999856: > > > > > > > [RAILS3] > > > I hesitate on how handling thelocaleview templates to default to > > one language only .. > > > sending admin emails will go only to onelocale ''en_GB'' > > > should I set it up into the template name and set I18n.localeto > > ''en_GB'' > > > membership_renew.en_GB.html.erb > > > OR > > > whatever localeis used , if I have : > > > membership_renew.html > > > it will be the default ? > > Hi, at least I didn''t completely get your problem. > The way I set a defaultlocaleis: > > config.i18n.fallbacks = true > config.i18n.default_locale = :en > > I have 3 languages and if one translation is not found it fallback to > english. > > But again, I maybe didn''t get your goal. > > Cheers. > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 21, 2011, at 11:55 PM, Erwin <yves_dufour-ee4meeAH724@public.gmane.org> wrote:> I agree , not very clear .... I was referring to mailer template > views > I tested many cases and it seems I need to define .en_GB views > ( including the locale) > > I am using already the fallback... > config.i18n.fallbacks = true > config.i18n.default_locale = :en_EN > > but I am concerned by mailer ? which seems to handle locale > differently. Here is a case : > > I am logged in as current_user > I select :en_ES as locale for display > I visit the site .. > and I some point the system need to send a message to the site > admin... > > as mailer views I MUST have templates like : welcome.en_GB.html.erb > and NOT welcome.html.erb > >Huh? That doesn''t sound correct to me. Specifying the locale in the template filename seems very odd. Can you point me at documentation on where this would required?> > On 20 mai, 22:02, comopasta Gr <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Kad Kerforn wrote in post #999856: >> >> >> >> >> >>> [RAILS3] >> >>> I hesitate on how handling thelocaleview templates to default to >>> one language only .. >> >>> sending admin emails will go only to onelocale ''en_GB'' >> >>> should I set it up into the template name and set I18n.localeto >>> ''en_GB'' >> >>> membership_renew.en_GB.html.erb >> >>> OR >> >>> whatever localeis used , if I have : >> >>> membership_renew.html >> >>> it will be the default ? >> >> Hi, at least I didn''t completely get your problem. >> The way I set a defaultlocaleis: >> >> config.i18n.fallbacks = true >> config.i18n.default_locale = :en >> >> I have 3 languages and if one translation is not found it fallback to >> english. >> >> But again, I maybe didn''t get your goal. >> >> Cheers. >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Walter,
I was using a trick :
class ActionMailer::Localized < ActionMailer::Base
private
# we override the template_path to render localized templates (since
rails does not support that :-( )
# This thing is not testable since you cannot access the instance of
a mailer...
def initialize_defaults(method_name)
super
@template = "#{method_name}.#{I18n.locale}"
end
end
seems to be a very bad idea... I''m moving to another folder
structure,
views
> user_mailer
> en_GB
> membership_renew.html.erb
> membership_renew.text.erb
> es_ES
> membership_renew.html.erb
> membership_renew.text.erb
so I need the template path to be:
@template = "#{ActionMailer::Base::template_root}/user_mailer/
{user.language || ''en_GB''}.erb"
where should I write it ? directly in the mailer method ?...
will it handle the formats : html/text ?
def membership_renew(user, membership, clip)
....
==> @template = "#{ActionMailer::Base::template_root}/user_mailer/
{user.language || ''en_GB''}/membership_renew.erb"
mail(:to => user.email, :subject => "Your Swing Analysis
Request")
do |format|
format.html { render :layout => "/mailer/sbga_user_mail" }
format.text
end
end
On 21 mai, 22:07, Walter McGinnis
<walter.mcgin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> On May 21, 2011, at 11:55 PM, Erwin
<yves_duf...-ee4meeAH724@public.gmane.org> wrote:
>
>
>
>
>
> > I agree , not very clear .... I was referring to mailer template
> > views
> > I tested many cases and it seems I need to define .en_GB views
> > ( including the locale)
>
> > I am using already the fallback...
> > config.i18n.fallbacks = true
> > config.i18n.default_locale = :en_EN
>
> > but I am concerned by mailer ? which seems to handle locale
> > differently. Here is a case :
>
> > I am logged in as current_user
> > I select :en_ES as locale for display
> > I visit the site ..
> > and I some point the system need to send a message to the site
> > admin...
>
> > as mailer views I MUST have templates like : welcome.en_GB.html.erb
> > and NOT welcome.html.erb
>
> Huh? That doesn''t sound correct to me. Specifying the locale in
the template filename seems very odd. Can you point me at documentation on where
this would required?
>
>
>
>
>
> > On 20 mai, 22:02, comopasta Gr
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> >> Kad Kerforn wrote in post #999856:
>
> >>> [RAILS3]
>
> >>> I hesitate on how handling thelocaleview templates to default
to
> >>> one language only ..
>
> >>> sending admin emails will go only to onelocale
''en_GB''
>
> >>> should I set it up into the template name and set
I18n.localeto
> >>> ''en_GB''
>
> >>> membership_renew.en_GB.html.erb
>
> >>> OR
>
> >>> whatever localeis used , if I have :
>
> >>> membership_renew.html
>
> >>> it will be the default ?
>
> >> Hi, at least I didn''t completely get your problem.
> >> The way I set a defaultlocaleis:
>
> >> config.i18n.fallbacks = true
> >> config.i18n.default_locale = :en
>
> >> I have 3 languages and if one translation is not found it fallback
to
> >> english.
>
> >> But again, I maybe didn''t get your goal.
>
> >> Cheers.
>
> >> --
> >> Posted viahttp://www.ruby-forum.com/.
>
> > --
> > You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
> > To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
just tried .. doesn''t work ... @template is bypassed
ActionView::MissingTemplate: Missing template user_mailer/
membership_renew with
{:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml],
:formats=>[:html], :locale=>[:en_GB]}
in view paths "/Users/yves/Sites/rails/testsbga/app/views"
it should be looking for : template user_mailer/en_GB/
membership_renew ......with {:handlers=>[:erb
the @template path seems to be build before the call to the mailer
action ...
On 22 mai, 08:01, Erwin <yves_duf...-ee4meeAH724@public.gmane.org>
wrote:> Thanks Walter,
>
> I was using a trick :
>
> class ActionMailer::Localized < ActionMailer::Base
> private
> # we override the template_path to render localized templates (since
> rails does not support that :-( )
> # This thing is not testable since you cannot access the instance of
> a mailer...
> def initialize_defaults(method_name)
> super
> @template = "#{method_name}.#{I18n.locale}"
> end
> end
>
> seems to be a very bad idea... I''m moving to another folder
> structure,
>
> views
> > user_mailer
> > en_GB
> > membership_renew.html.erb
> > membership_renew.text.erb
> > es_ES
> > membership_renew.html.erb
> > membership_renew.text.erb
>
> so I need the template path to be:
> @template = "#{ActionMailer::Base::template_root}/user_mailer/
> {user.language || ''en_GB''}.erb"
>
> where should I write it ? directly in the mailer method ?...
> will it handle the formats : html/text ?
>
> def membership_renew(user, membership, clip)
> ....
> ==> @template = "#{ActionMailer::Base::template_root}/user_mailer/
> {user.language || ''en_GB''}/membership_renew.erb"
> mail(:to => user.email, :subject => "Your Swing Analysis
Request")
> do |format|
> format.html { render :layout =>
"/mailer/sbga_user_mail" }
> format.text
> end
> end
>
> On 21 mai, 22:07, Walter McGinnis
<walter.mcgin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > On May 21, 2011, at 11:55 PM, Erwin
<yves_duf...-ee4meeAH724@public.gmane.org> wrote:
>
> > > I agree , not very clear .... I was referring to mailer template
> > > views
> > > I tested many cases and it seems I need to define .en_GB views
> > > ( including the locale)
>
> > > I am using already the fallback...
> > > config.i18n.fallbacks = true
> > > config.i18n.default_locale = :en_EN
>
> > > but I am concerned by mailer ? which seems to handle locale
> > > differently. Here is a case :
>
> > > I am logged in as current_user
> > > I select :en_ES as locale for display
> > > I visit the site ..
> > > and I some point the system need to send a message to the site
> > > admin...
>
> > > as mailer views I MUST have templates like :
welcome.en_GB.html.erb
> > > and NOT welcome.html.erb
>
> > Huh? That doesn''t sound correct to me. Specifying the locale
in the template filename seems very odd. Can you point me at documentation on
where this would required?
>
> > > On 20 mai, 22:02, comopasta Gr
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> > >> Kad Kerforn wrote in post #999856:
>
> > >>> [RAILS3]
>
> > >>> I hesitate on how handling thelocaleview templates to
default to
> > >>> one language only ..
>
> > >>> sending admin emails will go only to onelocale
''en_GB''
>
> > >>> should I set it up into the template name and set
I18n.localeto
> > >>> ''en_GB''
>
> > >>> membership_renew.en_GB.html.erb
>
> > >>> OR
>
> > >>> whatever localeis used , if I have :
>
> > >>> membership_renew.html
>
> > >>> it will be the default ?
>
> > >> Hi, at least I didn''t completely get your problem.
> > >> The way I set a defaultlocaleis:
>
> > >> config.i18n.fallbacks = true
> > >> config.i18n.default_locale = :en
>
> > >> I have 3 languages and if one translation is not found it
fallback to
> > >> english.
>
> > >> But again, I maybe didn''t get your goal.
>
> > >> Cheers.
>
> > >> --
> > >> Posted viahttp://www.ruby-forum.com/.
>
> > > --
> > > You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Talk" group.
> > > To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm.
> > > To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.