Re: Django context translations with dynamic variables

2017-03-03 Thread Uri Even-Chen
Thank you Melvyn and Jani! Uri. *Uri Even-Chen* [image: photo] Phone: +972-54-3995700 Email: u...@speedy.net Website: http://www.speedysoftware.com/uri/en/

Re: Django context translations with dynamic variables

2017-03-02 Thread Jani Tiainen
Hi, On 02.03.2017 19:43, Uri Even-Chen wrote: What if we "cheat" makemessages like this: {% if 0%}{% trans 'This user blocked you.' context 'female' %} {% trans 'This user blocked you.' context 'male' %} {% trans 'This user blocked you.' context 'other' %} {% endif %} {%trans 'This user

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 20:54:07 Uri Even-Chen wrote: > > Then makemessages should generate a string with msgctxt for each of > > the choices. You could do this already, by rolling your own "trans" > > tag and "makemessages" command. > > > > > I don't understand, how can I do it already? I

Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
> > > Then makemessages should generate a string with msgctxt for each of the > choices. You could do this already, by rolling your own "trans" tag and > "makemessages" command. > > > I don't understand, how can I do it already? I want makemessages to generate a string with all the possible

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 19:43:07 Uri Even-Chen wrote: > Maybe this is a feature we can add to the next Django release? And > then we will not have to "cheat"? Something like this maybe: {%trans 'dancer' context_choices=gender_choices choice=request.user.gender %} Then makemessages should

Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
What if we "cheat" makemessages like this: {% if 0 %} {% trans 'This user blocked you.' context 'female' %} {% trans 'This user blocked you.' context 'male' %} {% trans 'This user blocked you.' context 'other' %} {% endif %} {% trans 'This user blocked you.' context user.gender %}

Re: Django context translations with dynamic variables

2017-03-02 Thread Jani Tiainen
Unfortunately makemessages can't guess what your context is if it's variable (I'm not sure would it even consider it as a translatable text at all) First version would guarantee you to have translatable strings with genders, latter one either generates one string (and you have to manually

Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
Hi, I'm working with Gleb on Speedy Match [ https://github.com/urievenchen/speedy-net]. We need to translate to Hebrew according to context of the user's gender. Gleb suggested that the code will be something like this: {% if user.gender == GENDER_FEMALE %} {% trans 'This user blocked you.'

Re: Django context translations with dynamic variables

2017-03-01 Thread Jani Tiainen
In theory you just define genders to your PO file with translations and it should work. Not sure will that disable autogeneration and update for your PO file after that. On 01.03.2017 14:59, Gleb Tocarenco wrote: Hello, I am running in with an issue with Django translation tag in case

Django context translations with dynamic variables

2017-03-01 Thread Gleb Tocarenco
Hello, I am running in with an issue with Django translation tag in case context is present as a dynamic variable. {% trans 'You have new message' context user.gender %} In this case django.po files doesn't contains words related to gender context. My question is if there is possibility to