Well then, here's the solution that I'm using for the user to decide the 
language by him/herself:
auth.settings.extra_fields['auth_user']= [
    ...
    Field('lang', length=2, label=T('Language'), requires = 
IS_IN_SET(('EN', 'DE')), default='EN'),
    ... ]
*(There the user can decide whether to use English or German)*

By this, the user can maintain the language in his/her profile.

Then, in each controller I force the translator 
<http://web2py.com/books/default/chapter/29/04/the-core#Determining-the-language>
 
to the users language by:
T.force(auth.user.lang)

That's my favorite. I first thought, you would like to have automatic 
language selection by the browser. But letting the user to decide has the 
further advantage, that e.g. a German user working with an English browser 
can still have a German user interface.

Is this, what you are looking for?

Best regards
Clemens


On Thursday, September 10, 2020 at 12:04:13 PM UTC+2 lapin...@gmail.com 
wrote:

> Dear All; 
>
> Another solution should be the integration of the translation in the 
> native web2py_user_form 
> Is it possible ? 
>
> Le jeudi 10 septembre 2020 à 11:50:33 UTC+2, Nicolas Hiblot a écrit :
>
>> Thanks for your answer Clemens, 
>> My problem is : I cannot control what the final user can do with its 
>> Firefox 
>> So I would like to solve the problem directly with web2py 
>> Because 
>>
>> 1) I'm in native language : it works perfectly.  User is Utilisateur in 
>> French 
>> 2) I put English, german etc ... on a french Firefox installation : 
>> Utilisateur become sUser but when i'm login into my application : it does 
>> not work 
>> 3° I choose French : it's works again 
>>
>> So Firefox change is correct on my side 
>> but queries of lastUserLoggued are not ... 
>>
>> Maybe i make something wrong in 
>>
>>
>> lastUserLogged = db(db.auth_event.description.contains('connect'
>> )).select(orderby=~db.auth_event.time_stamp,limitby=(0, 1
>> )).first().user_id
>> or 
>> lastUserName = db(db.auth_user.id == 
>> lastUserLogged).select(db.auth_user.username).first().username
>>
>> Regards
>>
>> Nicolas 
>> Le jeudi 10 septembre 2020 à 10:59:51 UTC+2, Clemens a écrit :
>>
>>> From 
>>> https://blog.mozilla.org/l10n/2019/04/02/changing-the-language-of-firefox-directly-from-the-browser/
>>>
>>>
>>>
>>> *Language SettingsIn Firefox there are two main user facing settings 
>>> related to languages:*
>>>    
>>>    - *Web content: when you visit a web page, the browser will 
>>>    communicate to the server which languages you’d like to see content in. 
>>>    Technically, this is done by sending an Accept-Language HTTP header, 
>>> which 
>>>    contains a list of locale codes in the user’s preferred order.*
>>>    - *User interface: the language in which you want to see the browser 
>>>    (menus, preferences, etc.).*
>>>    
>>> *The difference between the two is not as intuitive as it might seem. A 
>>> lot of users change the web content settings, and expect the user interface 
>>> to change.*
>>>
>>> There you can see how to handle this. Hope, it helps!
>>>
>>>
>>> On Thursday, September 10, 2020 at 10:37:40 AM UTC+2 lapin...@gmail.com 
>>> wrote:
>>>
>>>> Hello All, 
>>>>
>>>> I will try  to present my problem simply :
>>>> I have a web2py application with a very simply homepage user.html 
>>>>
>>>> User and Password labels &  Login Button are automatically translatedby 
>>>> Firefox 
>>>> in Firefox the detected langage 
>>>>
>>>> If a user enter login / password 
>>>> I check user permissions and I show HTML page according to its 
>>>> permissions 
>>>> by using some code already test as : 
>>>>
>>>> lastUserLogged = db(db.auth_event.description.contains('connect'
>>>> )).select(orderby=~db.auth_event.time_stamp,limitby=(0, 1
>>>> )).first().user_id
>>>>
>>>> and 
>>>>
>>>> lastUserName = db(db.auth_user.id == 
>>>> lastUserLogged).select(db.auth_user.username).first().username
>>>>
>>>>
>>>> In a native Firefox langage it's OK 
>>>> But if I download new langage for Firefox restarts firefox and retry 
>>>> all the permissions are allowed even if the user is not allowed to see 
>>>> HTML pages
>>>>
>>>> Why ?? 
>>>> I don't know but if you can help me I appreciate ... sincerly 
>>>>
>>>>
>>>> The HTML Page for the user.html 
>>>>
>>>>
>>>> <body>
>>>> <style type="text/css">
>>>> body {
>>>> overflow:hidden;
>>>> }
>>>> #fond {
>>>> position:absolute;
>>>> top:0;
>>>> left:0;
>>>> }
>>>> #web2py_user_form {
>>>> position:absolute;
>>>> top:50px;
>>>> left:50px;
>>>> }
>>>> #auth_user_username__label{color:white;}
>>>> #auth_user_password__label{color:white;}
>>>> #auth_user_first_name__label{color:white;}
>>>> #auth_user_last_name__label{color:white;}
>>>> #auth_user_email__label{color:white;}
>>>> #auth_user_password_two__row{color:white;}
>>>>
>>>> #fond,#fond img {
>>>> width:100%;
>>>> height:100%;
>>>> }
>>>> </style> 
>>>> <div id="fond">
>>>> <img src='/me/static/theme/images/WALLPAPERS/wallpaper.jpg' alt="fond" 
>>>> />
>>>> </div>
>>>> <div id="web2py_user_form">
>>>> {{
>>>> =form
>>>> }}
>>>> </div>
>>>>
>>>> <script language="javascript"><!--
>>>> jQuery("#web2py_user_form input:visible:enabled:first").focus();
>>>> {{if request.args(0)=='register':}}
>>>> web2py_validate_entropy(jQuery('#auth_user_password'),100);
>>>> {{elif request.args(0) in ('change_password','reset_password'):}}
>>>> web2py_validate_entropy(jQuery('#no_table_new_password'),100);
>>>> {{pass}}
>>>> //--></script>
>>>>
>>>> </body>
>>>>
>>>>
>>>>
>>>>
>>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/54523137-4f9e-4a9e-90f2-bb65a9909a6bn%40googlegroups.com.

Reply via email to