Wednesday, 3 August 2022

django translation

 https://docs.djangoproject.com/en/4.0/topics/i18n/translation/



https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.translation.gettext


Translates message and returns it as a string.

https://docs.djangoproject.com/en/4.0/topics/i18n/translation/

.


from django.http import HttpResponse
from django.utils.translation import gettext as _

def my_view(request):
    output = _("Welcome to my site.")
    return HttpResponse(output)


gettext(message)[source]

Translates message and returns it as a string.




No comments:

Post a Comment