51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/i18n_routing_rails2.rb', line 51
def define_url_helper(route, name, kind, options)
gl = Thread.current[:globalized]
mkd_define_url_helper(route, name, kind, options)
if gl
selector = url_helper_name(name, kind)
rlang = if i = name.to_s.rindex("_#{gl}")
"#{selector.to_s[0, i]}_glang_#{gl}#{selector.to_s[i + "_#{gl}".size, selector.to_s.size]}"
elsif (gls = Thread.current[:globalized_s]) and i = name.to_s.rindex("_#{gls}")
"#{selector.to_s[0, i]}_glang_#{gls}#{selector.to_s[i + "_#{gls}".size, selector.to_s.size]}"
else
"glang_#{selector}"
end
@module.module_eval " alias_method :gl\#{selector}, :\#{selector}\n\n def \#{selector}(*args)\n selector_g = '\#{rlang}'.gsub('glang', I18nRouting.locale_escaped(I18n.locale)).to_sym\n\n #logger.debug \"Call routes : \#{selector} => \\\#{selector_g} (\#{rlang}) \"\n #puts \"Call routes : \#{selector} => \\\#{selector_g} (\#{rlang}) Found:\\\#{respond_to? selector_g and selector_g != :\#{selector}}\"\n if respond_to? selector_g and selector_g != :\#{selector}\n send(selector_g, *args)\n else\n gl\#{selector}(*args)\n end\n end\n protected :gl\#{selector}\n end_eval\n end\nend\n"
|