You can keep a list of available locales you want to exclude:
LOCALES = %w(en de es).map { |l| l.prepend '/' }
Then you can replace them like this:
<%= "#{request.protocol}#{request.host_with_port}#{request.fullpath.sub(Regexp.union(LOCALES), '')}" %>
# /blah/blubb