Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
It was my fault, all the time. I forgot that theres is some code in my
model with create the new record before the segment i have share in
this thread.

Sorry for the time.

2016-12-12 9:43 GMT-05:00 Yoel Benitez Fonseca :
> This not worked for me, the idea was to insert a folder record with
> the name in the user language, hence translating "My Dashboard" to
> anything if we got a translation string for that language.
>
> Apart from that part, all the texts are being  translated without any
> problem, u
>
>
>
> 2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca :
>> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
>> Marlysson Silva  wrote:
>>
>>> You can overrride programatically the language getting accepted
>>> language header from client using :
>>>
>>> language = response.headers['Accept-Language'].lower()
>>>
>>> T.force(language)
>>
>> I think got what is wrong, the controller in particular with execute my
>> code was on a ajax request, i have tested on a normal request and it do
>> what is suppose to do.
>>
>> Thanks folks, i'll test setting is programatically.
>>
>>>
>>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>>> Fonseca escreveu:
>>> >
>>> > Hi, folks, this is in my controller:
>>> >
>>> >
>>> > if not dash_list:
>>> > # create a new dashboard
>>> > d_id = db.dashboard.insert(
>>> > name=T('My Dashboard', lazy=False), item_list=[])
>>> > query = (db.dashboard.id > 0)
>>> > query &= (db.dashboard.created_by == auth.user.id)
>>> > dash_list = db(query).select(db.dashboard.ALL)
>>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>>> >
>>> > The logic is simple, if there is not a dashboard create one called
>>> > "My dashboard". The problem comes from not English users, they get
>>> > the same name.
>>> >
>>> > I have verified the languages files, and the accepted language
>>> > header, all is fine, in the shell it work's correctly - prior
>>> > setting the language oc.
>>> >
>>> > Some idea ?
>>> >
>>>
>>
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import this"

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
This not worked for me, the idea was to insert a folder record with
the name in the user language, hence translating "My Dashboard" to
anything if we got a translation string for that language.

Apart from that part, all the texts are being  translated without any
problem, u



2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca :
> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
> Marlysson Silva  wrote:
>
>> You can overrride programatically the language getting accepted
>> language header from client using :
>>
>> language = response.headers['Accept-Language'].lower()
>>
>> T.force(language)
>
> I think got what is wrong, the controller in particular with execute my
> code was on a ajax request, i have tested on a normal request and it do
> what is suppose to do.
>
> Thanks folks, i'll test setting is programatically.
>
>>
>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>> Fonseca escreveu:
>> >
>> > Hi, folks, this is in my controller:
>> >
>> >
>> > if not dash_list:
>> > # create a new dashboard
>> > d_id = db.dashboard.insert(
>> > name=T('My Dashboard', lazy=False), item_list=[])
>> > query = (db.dashboard.id > 0)
>> > query &= (db.dashboard.created_by == auth.user.id)
>> > dash_list = db(query).select(db.dashboard.ALL)
>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>> >
>> > The logic is simple, if there is not a dashboard create one called
>> > "My dashboard". The problem comes from not English users, they get
>> > the same name.
>> >
>> > I have verified the languages files, and the accepted language
>> > header, all is fine, in the shell it work's correctly - prior
>> > setting the language oc.
>> >
>> > Some idea ?
>> >
>>
>



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import this"

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benítez Fonseca
On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
Marlysson Silva  wrote:

> You can overrride programatically the language getting accepted
> language header from client using :
> 
> language = response.headers['Accept-Language'].lower()
> 
> T.force(language)

I think got what is wrong, the controller in particular with execute my
code was on a ajax request, i have tested on a normal request and it do
what is suppose to do.

Thanks folks, i'll test setting is programatically.

> 
> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
> Fonseca escreveu:
> >
> > Hi, folks, this is in my controller: 
> >
> >
> > if not dash_list: 
> > # create a new dashboard 
> > d_id = db.dashboard.insert( 
> > name=T('My Dashboard', lazy=False), item_list=[]) 
> > query = (db.dashboard.id > 0) 
> > query &= (db.dashboard.created_by == auth.user.id) 
> > dash_list = db(query).select(db.dashboard.ALL) 
> > auth.add_permission(0, 'owner', db.dashboard, d_id) 
> >
> > The logic is simple, if there is not a dashboard create one called
> > "My dashboard". The problem comes from not English users, they get
> > the same name. 
> >
> > I have verified the languages files, and the accepted language 
> > header, all is fine, in the shell it work's correctly - prior
> > setting the language oc. 
> >
> > Some idea ? 
> >  
> 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Forcing the translation of a text

2016-12-12 Thread 黄祥
yes, it worked, learned it from web2py admin app (on bottom center, it used 
drop down language for change the language)
just curious what is the difference with the header (accept-language)

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Forcing the translation of a text

2016-12-12 Thread Marlysson Silva
I didn't knew about existence of the language key in cookies of response..

Great..One questions.. works?

Em segunda-feira, 12 de dezembro de 2016 01:56:29 UTC-3, 黄祥 escreveu:
>
> what is the difference between?
> T.force(request.cookies['language'].value) # learn from web2py admin app
> and
> T.force(response.headers['Accept-Language'].lower() )
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Forcing the translation of a text

2016-12-11 Thread 黄祥
what is the difference between?
T.force(request.cookies['language'].value) # learn from web2py admin app
and
T.force(response.headers['Accept-Language'].lower() )

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Forcing the translation of a text

2016-12-11 Thread Marlysson Silva
You can overrride programatically the language getting accepted language 
header from client using :

language = response.headers['Accept-Language'].lower()

T.force(language)

Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez Fonseca 
escreveu:
>
> Hi, folks, this is in my controller: 
>
>
> if not dash_list: 
> # create a new dashboard 
> d_id = db.dashboard.insert( 
> name=T('My Dashboard', lazy=False), item_list=[]) 
> query = (db.dashboard.id > 0) 
> query &= (db.dashboard.created_by == auth.user.id) 
> dash_list = db(query).select(db.dashboard.ALL) 
> auth.add_permission(0, 'owner', db.dashboard, d_id) 
>
> The logic is simple, if there is not a dashboard create one called "My 
> dashboard". The problem comes from not English users, they get the 
> same name. 
>
> I have verified the languages files, and the accepted language 
> header, all is fine, in the shell it work's correctly - prior setting 
> the language oc. 
>
> Some idea ? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.