Comments (7)
This function sets session language to empty string if 'lang' argument is empty.
from devices.sensor.community.
But the language selection is added. Needs some css make over.
from devices.sensor.community.
Yeah, and session['lang'] == ''
will effectively make line 19/20 fall back to automatic language selection. (('' or 'abc') == 'abc'; ('def' or 'abc') == 'def'
)
from devices.sensor.community.
I have checked this. 'lang' isn't set to automatic language. In the template layout.html there is an 'if' to set a class for active and inactive languages.
The following version sets all to inactive:
{% for language in AVAILABLE_LANGUAGES.items() %}
{% if CURRENT_LANGUAGE == language[0] %}
<li class="lang_active"><a name="language">{{ language[1] }}</a></li>
{% else %}
<li class="lang_inactive"><a href="?lang={{ language[0] }}">{{ language[1] }}</a></li>
{% endif %}
{% endfor %}
While this is working (BEST_MATCH_LANGUAGE is the best matching language):
{% for language in AVAILABLE_LANGUAGES.items() %}
{% if CURRENT_LANGUAGE == language[0] or (CURRENT_LANGUAGE == '' and BEST_MATCH_LANGUAGE == language[0]) %}
<li class="lang_active"><a name="language">{{ language[1] }}</a></li>
{% else %}
<li class="lang_inactive"><a href="?lang={{ language[0] }}">{{ language[1] }}</a></li>
{% endif %}
{% endfor %}
from devices.sensor.community.
For a test:
Set language by calling url with nonempty lang parameter. Then set the language with empty parameter. Call a different page by clicking one of the menu links.
from devices.sensor.community.
Code in webapp/common/context_processor.py
was wrong all along (especially CURRENT_LANGUAGE
you are using above).
This has been fixed in PR #11 by properly using flask_babel.get_locale
when rendering the dropdown.
This is the behaviour with PR #11 applied, which I assume is valid:
$ http --session /tmp/test http://localhost:5000 | grep -i 'nav-link' | head -1 # defaults to english
<a href="/" class="nav-link">Home</a>
$ http --session /tmp/test http://localhost:5000/?lang=pl | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Strona główna</a>
$ http --session /tmp/test http://localhost:5000/ | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Strona główna</a>
$ http --session /tmp/test http://localhost:5000/?lang= | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Home</a>
$ http --session /tmp/test http://localhost:5000/ | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Home</a>
$ http --session /tmp/test http://localhost:5000/ Accept-Language:pl | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Strona główna</a>
$ http --session /tmp/test http://localhost:5000/ Accept-Language:en | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Home</a>
$ http --session /tmp/test http://localhost:5000/?lang=en Accept-Language:pl | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Home</a>
$ http --session /tmp/test http://localhost:5000/ Accept-Language:pl | grep -i 'nav-link' | head -1
<a href="/" class="nav-link">Home</a>
from devices.sensor.community.
Seems to work.
from devices.sensor.community.
Related Issues (20)
- time zone on sensors overview and data page different.
- Moving to another town: what is the recommended procedure to keep data from before/after separated HOT 4
- Better error message on duplicate components X-Pin
- Meine.luftdaten.info/devices.sensor.community doesn't work now.
- permanent server overload? HOT 2
- This sensor ID is already registered. HOT 4
- Confirmation mail not received HOT 1
- SDS011 & BME280 - how to add SHT35? HOT 2
- Add more possible Sensor Types HOT 3
- Data of sensors level above ground
- Please update English strings in PO files for translated languages. HOT 4
- Sending wrong pressure data or unit? HOT 4
- new Sensor SCD30 HOT 1
- Formatting of Air pressure is wrong HOT 5
- Add sensors to existing configuration HOT 3
- FR: devices.sensor.community: sensors: data: firmware version information (is missing) HOT 2
- Geoposition lookup fails when postal code contains non-alphanumeric characters HOT 1
- Make address optional if geoposition is provided HOT 4
- Temperature / humidity values are not displayed on map HOT 4
- Shows temperature on the map, but no data on devices.sensor.community HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devices.sensor.community.