Hi,

Please follow this

https://stackoverflow.com/questions/2345708/how-can-i-get-the-full-absolute-url-with-domain-in-django

Thanks and Regards

J. Ranga Bharath
Cell: 9110334114


On Tue, 29 Nov 2022, 11:53 am Dhrub Kumar Sharma, <dhrubkuma...@gmail.com>
wrote:

> I want the remaining slug part print dynamically rather than listing
> manually like https://example.com/ru/hello-world
>
> Here,
> https://example.com/ is a domain
>
> ru - country code
>
> Hello-word is slug
>
> Domain and country code is easy to print using for loop up to available
> country code but for slug i dint get exact code to print when I use {{%
> request.path %} } it also wont work because when the user visit the page
>
> https://example.com/ru/hello-world
>
> Then request.path become
> ru/hello-word
>
> And at this time {{% request.path %} } fetch ru/hello-world so ru will be
> repeated twice in this case and our url become insane like
>
> https://example.com/ru/ru/hello-world
>
> But acutally i want to print only the page path not the full url directory
>
> In the django documentation there is only code avaiable form type select
> to switch language but i want there dropdown with anchor tag there also i
> am facing the same problm and second picture is of dropdown
>
> On Tue, Nov 29, 2022, 4:08 AM David Emanuel Sandoval <
> davidemanuelsando...@gmail.com> wrote:
>
>> Hi, in my case I'm not sure if I'm understanding the problem well.
>>
>> Do you have a different url for every language? Are the urls also
>> translated?
>>
>> In the docs i see they use a tag to get the correct url for the given
>> language, but as I said, I'm not sure if that is what you want.
>>
>>
>> https://docs.djangoproject.com/en/4.1/topics/i18n/translation/#reversing-in-templates
>>
>> El lun, 28 nov 2022 16:54, Dhrub Kumar Sharma <dhrubkuma...@gmail.com>
>> escribió:
>>
>>> Hi everybody I am applying Django internalization for a multilingual
>>> site. I am facing a problem with making href URL dynamic instead of
>>> repeating same code manually.
>>>
>>> [image: url.png]
>>> I tried this but cant get perfect href dynamically. please help me same
>>> problem I am facing in language switcher href also.
>>>
>>>     {% get_current_language as LANGUAGE_CODE %}
>>>     {% get_available_languages as LANGUAGES %}
>>>     {% get_language_info_list for LANGUAGES as languages %}
>>>     {% get_language_info for LANGUAGE_CODE as lang %}
>>>     {% for lang in languages %}
>>>         <link rel="alternate" hreflang="{{ lang.code }}" href="/{{
>>> lang.code }}/">
>>>     {% endfor %}
>>>
>>> [image: loop.png]
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/6c5c96ea-9866-40b2-9c23-9b03d771ae7en%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/6c5c96ea-9866-40b2-9c23-9b03d771ae7en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHUWMCaTSbE%2B9fhkNxYJ9ApmRqs9nGfUXgmft8pzajHtuwgmgw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHUWMCaTSbE%2B9fhkNxYJ9ApmRqs9nGfUXgmft8pzajHtuwgmgw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEgZrmGTB9u%2BdO31zrAK37b0T%3DGJznaqDYDhDAb2Akd2QWmYFA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEgZrmGTB9u%2BdO31zrAK37b0T%3DGJznaqDYDhDAb2Akd2QWmYFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK5m317X9H-UT-y12%2BbCf25FLRSec3fy-sZSK4CgppLiT2ohYw%40mail.gmail.com.

Reply via email to