PATH_RE from localeurl.settings fails if you have language variations defined in settings.LANGUAGES

Issue #15 resolved
Roman Barczyński
created an issue
  • put in settings.LANGUAGES language variations like:

{{{ ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), }}}

It's caused by too simple localeurl.settings.PATH_RE regexp. It should collect <locale> part until "/<path>" or "$" is matched. Otherwise in presented case "pt-br" won't get chance to match as "pt" will be matched first leaving "-br" as path.

Simple patch attached.

Comments (2)

  1. Anonymous

    I fixed it in this way:

    PATH_RE = re.compile(r'^/(?P<locale>%s)(?=/)(?P<path>.*)$' % LOCALES_RE)

  2. Log in to comment