Find variables marked for translations

31 views
Skip to first unread message

prabhakar shanmugam

unread,
Jul 20, 2017, 9:53:32 AM7/20/17
to Django users
Hi all,

I am translating a message which is a variable. The variable is dynamic text. It can be from any source like third party api or from the request get/post of user, meaning we won't know the text to be translated.

So at run time when the actual value of the variable is received, and when django tries to look for a translation in the po/mo file, I want to log that, django searched for the message in the msgid's but didn't find one. 

Is this possible. Which django function does the job of actually looking for the word to be translated.

def some_view(request):
    trans1
= ugettext("this will surely get translated")
    trans2
= ugettext(some_variable)


when the view is run I will get the value of some_variable. But since I don't have that in the django.po / .mo file, it wont translate. That is fine and understood, but I want to log the actual value of some_variable when the view runs. With the log, I would translate them later on leisurely.

Hope I have explained it clearly.

Mike Dewhirst

unread,
Jul 20, 2017, 7:12:59 PM7/20/17
to Django users
My plan (not commenced yet) is to use an on-line translation API. I just
googled "on-line translation api" and see there are quite a few options.

On 20/07/2017 9:38 PM, prabhakar shanmugam wrote:
> Hi all,
>
> I am translating a message which is a variable. The variable is
> dynamic text. It can be from any source like third party api or from
> the request get/post of user, meaning we won't know the text to be
> translated.
>
> So at run time when the actual value of the variable is received, and
> when django tries to look for a translation in the po/mo file, I want
> to log that, django searched for the message in the msgid's but didn't
> find one.
>
> Is this possible. Which django function does the job of actually
> looking for the word to be translated.
>
> |
> defsome_view(request):
> trans1 =ugettext("this will surely get translated")
> trans2 =ugettext(some_variable)
> |
>
>
> when the view is run I will get the value of some_variable. But since
> I don't have that in the django.po / .mo file, it wont translate. That
> is fine and understood, but I want to log the actual value of
> some_variable when the view runs. With the log, I would translate them
> later on leisurely.
>
> Hope I have explained it clearly.
>
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/50dea20f-9d7e-45ee-92c6-4a58925c78b1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/50dea20f-9d7e-45ee-92c6-4a58925c78b1%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages