module RouteTranslator::Translator::Path::Segment
def translate(segment, locale, scope)
If there is no translation, the path segment is blank, begins with a
If the path contains a hyphenated suffix, it will be translated.
"people(.:format)", only "people" will be translated.
If the path segment contains something like an optional format
Translates a single path segment.
def translate(segment, locale, scope) return segment if segment.empty? if segment.start_with?(':') named_param, hyphenized = segment.split('-', 2) return "#{named_param}-#{translate(hyphenized, locale, scope)}" if hyphenized end return segment if segment.start_with?('(', '*') || segment.include?(':') appended_part = segment.slice!(/(\()$/) str = translatable_segment(segment) (translate_string(str, locale, scope) || segment) + appended_part.to_s end