I have this in menu.py
if 'adminLanguage' in request.cookies and not
(request.cookies['adminLanguage'] is None):
T.force(request.cookies['adminLanguage'].value)
# Get all languages
languages = sorted([lang + '.py' for lang, info in
T.get_possible_languages_info().iteritems()
if info[2] != 0]) # info[2] is langfile_mtime:
------------------------------------------------------------------------------------------------
In layout.html
{{if hasattr(T,'get_possible_languages_info'):}}
<li style="margin-top: 10px;">
<select class="selectpicker show-tick form-control"
data-style="bg-olive btn-flatsuccess" onchange="var date = new
Date();cookieDate=date.setTime(date.getTime()+(100*24*60*60*1000));document.cookie='adminLanguage='+this.options[this.selectedIndex].id+';
expires='+cookieDate+'; path=/';window.location.reload()">
{{for langinfo in sorted([(code,info[1]) for code,info in
T.get_possible_languages_info().iteritems() if code != 'default']):}}
<option {{=T.accepted_language==langinfo[0] and 'selected' or
''}} {{='id='+langinfo[0]}} >{{=langinfo[1]}}</option>
{{pass}}
</select>
</li>
{{else:}}
{{pass}}
El jueves, 2 de marzo de 2017, 6:49:44 (UTC-4), Marlysson Silva escribió:
>
> Are you getting this values from where?
>
> Are you using which framework to frontend?
>
> Em quarta-feira, 1 de março de 2017 22:33:58 UTC-3, Yoel Baez escreveu:
>>
>> How can I show a short name of the languages in a dropdow?
>> I updated the languages files, but not working...
>>
>> Ej.
>> "English (US)" = "EN"
>> "Español" = "ES"
>>
>>
>> <https://lh3.googleusercontent.com/-Gt4ElU6-5ng/WLd1TzLqU8I/AAAAAAAAKS8/gWQ3iXJ_d54bPHpmhNLwNq_Il3T3QxFAgCLcB/s1600/languages.PNG>
>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.