Begin translation subsystem page
This commit is contained in:
parent
a5c36e4f0b
commit
9cbf356444
@ -74,6 +74,21 @@ def create_app(test_config=None):
|
|||||||
def kotoba_page(kotoba: str):
|
def kotoba_page(kotoba: str):
|
||||||
return render_template("kotoba.html", kotoba=kotoba)
|
return render_template("kotoba.html", kotoba=kotoba)
|
||||||
|
|
||||||
|
@app.route("/translations", methods=["GET", "POST"])
|
||||||
|
def strings_translation():
|
||||||
|
if request.method == "GET":
|
||||||
|
strings = {}
|
||||||
|
for language, language_data in lang.LANGUAGES.items():
|
||||||
|
strings[language] = {
|
||||||
|
string: translation for string, translation in language_data.items()
|
||||||
|
}
|
||||||
|
|
||||||
|
return render_template("translations.html", strings=strings)
|
||||||
|
else:
|
||||||
|
# TODO
|
||||||
|
print(request.form)
|
||||||
|
return redirect("/translations")
|
||||||
|
|
||||||
from . import database
|
from . import database
|
||||||
database.initialize_app(app)
|
database.initialize_app(app)
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ EXISTING_STRINGS = {
|
|||||||
"incorrect_password"
|
"incorrect_password"
|
||||||
"about",
|
"about",
|
||||||
"about-para",
|
"about-para",
|
||||||
"indices"
|
"indices",
|
||||||
|
"translations"
|
||||||
}
|
}
|
||||||
|
|
||||||
ENGLISH = {
|
ENGLISH = {
|
||||||
@ -52,7 +53,8 @@ ENGLISH = {
|
|||||||
"dark_theme": "Dark theme",
|
"dark_theme": "Dark theme",
|
||||||
"light_theme": "Light theme",
|
"light_theme": "Light theme",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"theme": "Color settings"
|
"theme": "Color settings",
|
||||||
|
"translations": "Translations",
|
||||||
}
|
}
|
||||||
|
|
||||||
JAPANESE = {
|
JAPANESE = {
|
||||||
@ -83,7 +85,8 @@ JAPANESE = {
|
|||||||
"dark_theme": "ダークモード",
|
"dark_theme": "ダークモード",
|
||||||
"light_theme": "ライトモード",
|
"light_theme": "ライトモード",
|
||||||
"language": "言語",
|
"language": "言語",
|
||||||
"theme": "色設定"
|
"theme": "色設定",
|
||||||
|
"translations": "翻訳",
|
||||||
}
|
}
|
||||||
|
|
||||||
LANGUAGES = {
|
LANGUAGES = {
|
||||||
|
19
kanken_online/templates/translations.html
Normal file
19
kanken_online/templates/translations.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
<h1>{% block title %}{{ localize("translations") }}{% endblock %}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method="post">
|
||||||
|
{% for language, data in strings.items() %}
|
||||||
|
<h2>{{ language }}</h2>
|
||||||
|
{% for string, translation in data.items() %}
|
||||||
|
<label for="{{ string }}">{{ string }}</label>
|
||||||
|
<input type="text" id="{{ string }}" value="{{ translation }}">
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user