- clean target erases the *.pot
- don't modify the resurt of url_for() calls - don't translate the language description
This commit is contained in:
12
Makefile
12
Makefile
@@ -1,11 +1,19 @@
|
|||||||
.PHONY: build babel clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel check-docker-compose install
|
.PHONY: build babel clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel check-docker-compose install
|
||||||
|
|
||||||
babel debug dev preview rc rel:
|
babel:
|
||||||
$(MAKE) -C app $@
|
$(MAKE) -C app $@
|
||||||
|
|
||||||
clean build:
|
build:
|
||||||
$(MAKE) -C ha_addons $@
|
$(MAKE) -C ha_addons $@
|
||||||
|
|
||||||
|
clean build:
|
||||||
|
$(MAKE) -C app $@
|
||||||
|
$(MAKE) -C ha_addons $@
|
||||||
|
|
||||||
|
debug dev preview rc rel:
|
||||||
|
$(MAKE) -C app babel
|
||||||
|
$(MAKE) -C app $@
|
||||||
|
|
||||||
addon-dev addon-debug addon-rc addon-rel:
|
addon-dev addon-debug addon-rc addon-rel:
|
||||||
$(MAKE) -C app babel
|
$(MAKE) -C app babel
|
||||||
$(MAKE) -C ha_addons $(patsubst addon-%,%,$@)
|
$(MAKE) -C ha_addons $(patsubst addon-%,%,$@)
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export MAJOR := $(shell echo $(VERSION) | cut -f1 -d.)
|
|||||||
PUBLIC_URL := $(shell echo $(PUBLIC_CONTAINER_REGISTRY) | cut -f1 -d/)
|
PUBLIC_URL := $(shell echo $(PUBLIC_CONTAINER_REGISTRY) | cut -f1 -d/)
|
||||||
PUBLIC_USER :=$(shell echo $(PUBLIC_CONTAINER_REGISTRY) | cut -f2 -d/)
|
PUBLIC_USER :=$(shell echo $(PUBLIC_CONTAINER_REGISTRY) | cut -f2 -d/)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BABEL_TRANSLATIONS)/*.pot
|
||||||
|
|
||||||
dev debug:
|
dev debug:
|
||||||
@echo version: $(VERSION) build-date: $(BUILD_DATE) image: $(PRIVAT_CONTAINER_REGISTRY)$(IMAGE)
|
@echo version: $(VERSION) build-date: $(BUILD_DATE) image: $(PRIVAT_CONTAINER_REGISTRY)$(IMAGE)
|
||||||
@@ -58,4 +60,4 @@ $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.po : $(BABEL_TRANSLATIONS)/messages
|
|||||||
$(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.mo : $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.po
|
$(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.mo : $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.po
|
||||||
@pybabel compile -d $(BABEL_TRANSLATIONS) -l $*
|
@pybabel compile -d $(BABEL_TRANSLATIONS) -l $*
|
||||||
|
|
||||||
.PHONY: babel debug dev preview rc rel
|
.PHONY: babel clean debug dev preview rc rel
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
from quart import request, session, redirect, abort
|
from quart import request, session, redirect, abort, url_for
|
||||||
from quart_babel import _
|
|
||||||
from quart_babel.locale import get_locale as babel_get_locale
|
from quart_babel.locale import get_locale as babel_get_locale
|
||||||
|
|
||||||
from . import web
|
from . import web
|
||||||
|
|
||||||
LANGUAGES = {
|
LANGUAGES = {
|
||||||
'en': _('English'),
|
'en': 'English',
|
||||||
'de': _('German'),
|
'de': 'Deutsch',
|
||||||
'fr': _('French')
|
'fr': 'Français'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -36,8 +35,10 @@ def utility_processor():
|
|||||||
|
|
||||||
|
|
||||||
@web.route('/language/<language>')
|
@web.route('/language/<language>')
|
||||||
def set_language(language=None):
|
async def set_language(language=None):
|
||||||
if language in LANGUAGES:
|
if language in LANGUAGES:
|
||||||
session['language'] = language
|
session['language'] = language
|
||||||
return redirect(request.referrer)
|
if request.referrer is not None:
|
||||||
return abort(400)
|
return redirect(request.referrer)
|
||||||
|
return redirect(url_for('web.index'))
|
||||||
|
return abort(404)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from . import web
|
|||||||
async def index():
|
async def index():
|
||||||
return await render_template(
|
return await render_template(
|
||||||
'index.html.j2',
|
'index.html.j2',
|
||||||
fetch_url='.'+url_for('web.data_fetch'))
|
fetch_url=url_for('web.data_fetch'))
|
||||||
|
|
||||||
|
|
||||||
@web.route('/page')
|
@web.route('/page')
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
<title>{% block title %}{% endblock title %}</title>
|
<title>{% block title %}{% endblock title %}</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href=".{{ url_for('static', filename= 'css/style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename= 'css/style.css') }}">
|
||||||
<link rel="stylesheet" href=".{{ url_for('static', filename= 'font-awesome/css/all.min.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename= 'font-awesome/css/all.min.css') }}">
|
||||||
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<style>
|
<style>
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Roboto;
|
font-family: Roboto;
|
||||||
src: url(".{{ url_for('static', filename= 'font/roboto-light.ttf') }}");
|
src: url("{{ url_for('static', filename= 'font/roboto-light.ttf') }}");
|
||||||
}
|
}
|
||||||
html,body,h1,h2,h3,h4,h5 {font-family: Roboto, sans-serif}
|
html,body,h1,h2,h3,h4,h5 {font-family: Roboto, sans-serif}
|
||||||
</style>
|
</style>
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
<div class="w3-bar w3-dark-grey w3-large" style="z-index:4">
|
<div class="w3-bar w3-dark-grey w3-large" style="z-index:4">
|
||||||
<button class="w3-bar-item w3-button w3-hide-large" onclick="w3_open();"><i class="fa fa-bars"></i> Menu</button>
|
<button class="w3-bar-item w3-button w3-hide-large" onclick="w3_open();"><i class="fa fa-bars"></i> Menu</button>
|
||||||
<div class="w3-dropdown-hover w3-right">
|
<div class="w3-dropdown-hover w3-right">
|
||||||
<button class="w3-button">{{_(lang_str)}}</button>
|
<button class="w3-button">{{lang_str}}</button>
|
||||||
<div class="w3-dropdown-content w3-bar-block w3-card-4" style="right:0">
|
<div class="w3-dropdown-content w3-bar-block w3-card-4" style="right:0">
|
||||||
{% for language in languages %}
|
{% for language in languages %}
|
||||||
<a href="./language/{{language}}" class="w3-bar-item w3-button">{{_(languages[language])}}</a>
|
<a href="{{url_for('web.set_language', language=language)}}" class="w3-bar-item w3-button">{{languages[language]}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<nav class="w3-sidebar w3-collapse w3-white" style="z-index:3;width:250px;" id="mySidebar"><br>
|
<nav class="w3-sidebar w3-collapse w3-white" style="z-index:3;width:250px;" id="mySidebar"><br>
|
||||||
<div class="w3-container w3-row">
|
<div class="w3-container w3-row">
|
||||||
<div class="w3-col s4">
|
<div class="w3-col s4">
|
||||||
<img src=".{{ url_for('static', filename= 'images/favicon.svg') }}" alt="" class="w3-circle w3-margin-right" style="width:60px">
|
<img src="{{url_for('static', filename= 'images/favicon.svg') }}" alt="" class="w3-circle w3-margin-right" style="width:60px">
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-col s8 w3-bar">
|
<div class="w3-col s8 w3-bar">
|
||||||
<h3>TSUN-Proxy</h3><br>
|
<h3>TSUN-Proxy</h3><br>
|
||||||
@@ -55,9 +55,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="w3-bar-block">
|
<div class="w3-bar-block">
|
||||||
<button href="#" class="w3-bar-item w3-button w3-padding-16 w3-hide-large w3-dark-grey w3-hover-black" onclick="w3_close()" title="close menu"><i class="fa fa-remove fa-fw"></i> Close Menu</button>
|
<button href="#" class="w3-bar-item w3-button w3-padding-16 w3-hide-large w3-dark-grey w3-hover-black" onclick="w3_close()" title="close menu"><i class="fa fa-remove fa-fw"></i> Close Menu</button>
|
||||||
<a href=".{{ url_for('web.index')}}" class="w3-bar-item w3-button w3-padding {% block menu1_class %}{% endblock %}"><i class="fa fa-network-wired fa-fw"></i> {{_('Connections')}}</a>
|
<a href="{{ url_for('web.index')}}" class="w3-bar-item w3-button w3-padding {% block menu1_class %}{% endblock %}"><i class="fa fa-network-wired fa-fw"></i> {{_('Connections')}}</a>
|
||||||
<a href=".{{ url_for('web.empty')}}" class="w3-bar-item w3-button w3-padding {% block menu2_class %}{% endblock %}"><i class="fa fa-database fa-fw"></i> MQTT</a>
|
<a href="{{ url_for('web.empty')}}" class="w3-bar-item w3-button w3-padding {% block menu2_class %}{% endblock %}"><i class="fa fa-database fa-fw"></i> MQTT</a>
|
||||||
<a href=".{{ url_for('web.empty')}}" class="w3-bar-item w3-button w3-padding"><i class="fa fa-file-export fa-fw {% block menu3_class %}{% endblock %}"></i> Downloads</a>
|
<a href="{{ url_for('web.empty')}}" class="w3-bar-item w3-button w3-padding"><i class="fa fa-file-export fa-fw {% block menu3_class %}{% endblock %}"></i> Downloads</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|||||||
@@ -153,5 +153,5 @@ async def test_language_de(client):
|
|||||||
async def test_language_unknown(client):
|
async def test_language_unknown(client):
|
||||||
"""Test the language/en route."""
|
"""Test the language/en route."""
|
||||||
response = await client.get('/language/unknonw')
|
response = await client.get('/language/unknonw')
|
||||||
assert response.status_code == 400
|
assert response.status_code == 404
|
||||||
assert response.mimetype == 'text/html'
|
assert response.mimetype == 'text/html'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: tsun-gen3-proxy 0.14.0\n"
|
"Project-Id-Version: tsun-gen3-proxy 0.14.0\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2025-04-27 01:25+0200\n"
|
"POT-Creation-Date: 2025-04-28 20:37+0200\n"
|
||||||
"PO-Revision-Date: 2025-04-18 16:24+0200\n"
|
"PO-Revision-Date: 2025-04-18 16:24+0200\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
@@ -19,18 +19,6 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Generated-By: Babel 2.17.0\n"
|
"Generated-By: Babel 2.17.0\n"
|
||||||
|
|
||||||
#: src/web/i18n.py:7
|
|
||||||
msgid "English"
|
|
||||||
msgstr "Englisch"
|
|
||||||
|
|
||||||
#: src/web/i18n.py:8
|
|
||||||
msgid "German"
|
|
||||||
msgstr "Deutsch"
|
|
||||||
|
|
||||||
#: src/web/i18n.py:9
|
|
||||||
msgid "French"
|
|
||||||
msgstr "Französisch"
|
|
||||||
|
|
||||||
#: src/web/templates/base.html.j2:37
|
#: src/web/templates/base.html.j2:37
|
||||||
msgid "Updated:"
|
msgid "Updated:"
|
||||||
msgstr "Aktualisiert:"
|
msgstr "Aktualisiert:"
|
||||||
|
|||||||
Reference in New Issue
Block a user