lib/titlezilla/translator.rb in titlezilla-0.1.1 vs lib/titlezilla/translator.rb in titlezilla-0.1.2
- old
+ new
@@ -28,10 +28,15 @@
private
def parse_namespace_and_controller_name(controller_path)
parts = controller_path.to_s.split('/')
- parts.size > 1 ? parts.map(&:to_s).map(&:freeze) : [nil, parts[0].to_s.freeze]
+ parts.map!(&:to_s).map!(&:freeze)
+ if parts.size > 1
+ [parts[(0...-1)], parts[-1]]
+ else
+ [nil, parts[0].to_s.freeze]
+ end
end
def lookup(*key)
t_key = [:titles, namespace, key].flatten.compact.join('.')
i18n_set?(t_key) ? I18n.t(t_key, context) : nil