Matchu
99f5cd717f
The models folder is a bit confusingly large, these are more mixins and kinda clutter it. Push them off into `lib`, I think! I think they used to be in models mainly because Rails used to handle `lib` differently with autoloading, and it made for a worse dev experience. Now it's all the same, though!
11 lines
277 B
Ruby
11 lines
277 B
Ruby
module FragmentLocalization
|
|
def localize_fragment_key(key, locale)
|
|
if key.is_a?(Hash)
|
|
{:locale => locale}.merge(key)
|
|
elsif key.is_a?(String)
|
|
"#{key} #{locale}"
|
|
else
|
|
raise TypeError, "unexpected fragment key type: #{key.class}"
|
|
end
|
|
end
|
|
end
|