Skip to content

Instantly share code, notes, and snippets.

@shageman
Created February 10, 2010 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shageman/300638 to your computer and use it in GitHub Desktop.
Save shageman/300638 to your computer and use it in GitHub Desktop.
def self.translate_route(route, route_name = nil)
new_routes = []
new_named_routes = {}
# if root_route?(route) && prefix_on_default_locale
# add the root route "as is" in addition to the translated versions
new_routes << route
new_named_routes[route_name] = route
# end
available_locales.each do |locale|
translated = translate_route_by_locale(route, locale, route_name)
new_routes << translated
locale_suffix = locale_suffix(locale)
new_named_routes["#{route_name}_#{locale_suffix}".to_sym] = translated if route_name
end
[new_routes, new_named_routes]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment