Joost
unread,Feb 25, 2009, 5:03:49 AM2/25/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rails-i18n
This seems to all be related to the regexp not matching
'mailer_template.nl.text.plain.erb'..
A fix from Krzysztof Knapik:
module ActionView #:nodoc:
class Template
def split(file)
if m = file.match(/^(.*\/)?([^\.]+)\.(.*)$/)
base_path = m[1]
name = m[2]
extensions = m[3]
else
return
end
locale = nil
format = nil
extension = nil
# This code deosn't work for multiformat locale templates e.g.
nl.text.plain.erb
# if m = extensions.match(/^(\w+)?\.?(\w+)?\.?(\w+)?\.?/)
# if valid_locale?(m[1]) && m[2] && valid_extension?(m[3]) #
All three
# locale = m[1]
# format = m[2]
# extension = m[3]
# elsif m[1] && m[2] && valid_extension?(m[3]) # Multipart
formats
# format = "#{m[1]}.#{m[2]}"
# extension = m[3]
# elsif valid_locale?(m[1]) && valid_extension?(m[2]) # locale
and extension
# locale = m[1]
# extension = m[2]
# elsif valid_extension?(m[2]) # format and extension
# format = m[1]
# extension = m[2]
# elsif valid_extension?(m[1]) # Just extension
# extension = m[1]
# else # No extension
# format = m[1]
# end
# end
m = extensions.split('.')
if valid_extension?(m[-1])
extension = m[-1]
if valid_locale?(m[0]) || valid_locale?(m[0].split('-')[0])
locale = m[0]
format = m[1..-2].join('.')
else
format = m[0..-2].join('.')
end
else
format = m.join('.')
end
format = nil if format.blank?
[base_path, name, locale, format, extension]
end
end
end