Reputation: 120
i actually already solved this issue, but all the solutions i've found so far are just tricky workarounds.
i'm playing with i18n_patterns and everything's working fine except links.
For instance, href="contacts" redirects users to "/en/contacts" or "/it/contatti", but in page source it remains "contacts".
For SEO optimizations purposes i'd like to see href="/en/contacts"
Is this possibile without writing code?
cheers,
Davide
Upvotes: 1
Views: 162
Reputation: 1884
If you use the url templatetag this should be handled automatically.
<a href"{% url view_name %}">Link</a>
From django documentation:
If localized URLs get reversed in templates they always use the current language. To link to a URL in another language use the language template tag.
Read more about localized url-patterns in the django documentation
Upvotes: 4