title: Setting URL for Django Translation
body: <p>I have two flag icons and I am willing to give them URLs to determine which language should be displayed using Django translation. Though, I am kind of confused about this. How may I do such a thing?
  To be more specific, when the client clicks on Iran's flag, the language prefix in the URL should be changed to 'fa-ir' (<a href="http://www.domain.com/fa-ir/products" rel="nofollow noreferrer">www.domain.com/fa-ir/products</a>)</p>
  <p>HTML:</p>
  <pre><code>            &lt;ul class=&quot;navbar-nav d-block d-lg-none ml-auto mr-3&quot;&gt;
            &lt;li class=&quot;nav-item&quot;&gt;
              &lt;a href=&quot;{% url 'products'%}&quot;&gt;&lt;div class=&quot;ukflag mr-1&quot;&gt;&lt;/div&gt;&lt;/a&gt;
              &lt;a href=&quot;fa-ir/{% url 'products' %}&quot;&gt;&lt;div class=&quot;irflag&quot;&gt;&lt;/div&gt;&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
  </code></pre>
  <p>Products.Views.py:</p>
  <pre><code>          from django.shortcuts import render
  from django.views.generic import TemplateView
  
  
  class ProductPageView(TemplateView):
    template_name = 'products.html'
  </code></pre>
  <p>URLs.py:</p>
  <pre><code>    from django.contrib import admin
  from django.urls import include, path
  from home.views import HomePageView
  from products.views import ProductPageView
  from django.conf.urls.i18n import i18n_patterns 
  from django.utils.translation import gettext_lazy as _
  urlpatterns = i18n_patterns(
      path(_('admin/'), admin.site.urls),
      path(&quot;&quot;, HomePageView.as_view(), name='home'),
      path(_('products/'), ProductPageView.as_view(), name='products'),
      prefix_default_language = False
  )
  </code></pre>