django i18n_patterns hide default lang_code from url

后端 未结 5 1980
旧时难觅i
旧时难觅i 2020-12-13 22:38

I\'m using the i18n_patterns to add a prefix of current lang_code to my url.

urlpatterns += i18n_patterns(\'\',
    url(r\'^\', include(\'blaszczakphoto2.gal         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 23:25

    You might want to check yawd-translations which does exactly that. If you don't care about the extra functionality (manage languages from db), you can have a look at the urls.translation_patterns method and the middleware.TranslationMiddleware to see how it can be done.

提交回复
热议问题