1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-18 08:27:03 +02:00

PoC translation working

This commit is contained in:
Piero Toffanin 2023-01-04 12:40:00 -05:00
parent 05900ff556
commit 50c9b62595
3 changed files with 46 additions and 2 deletions

View File

@ -1022,6 +1022,9 @@ def create_app(args):
# TODO: populate from available locales
return request.accept_languages.best_match(['en', 'it'])
def gettext_escaped(*args, **kwargs):
return _(*args, **kwargs).replace("'", "\\'")
app.jinja_env.globals.update(_e=gettext_escaped)
# Call factory function to create our blueprint
swaggerui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)

View File

@ -28,7 +28,7 @@ document.addEventListener('DOMContentLoaded', function(){
detectedLangText: "",
copyTextLabel: {{ _("Copy text") }},
copyTextLabel: '{{ _e("Copy text") }}',
suggestions: false,
isSuggesting: false,
@ -69,7 +69,7 @@ document.addEventListener('DOMContentLoaded', function(){
}
}
} else {
self.error = "Cannot load /frontend/settings";
self.error = '{{ _e("Cannot load %(url)s", url="/frontend/settings") }}';
self.loading = false;
}
};

View File

@ -0,0 +1,41 @@
# Italian translations for PROJECT.
# Copyright (C) 2023 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-01-04 12:27-0500\n"
"PO-Revision-Date: 2023-01-04 12:27-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: it\n"
"Language-Team: it <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.11.0\n"
#: libretranslate/app.py:57
msgid "Invalid JSON format"
msgstr ""
#: libretranslate/app.py:125
msgid "Auto Detect"
msgstr ""
#: libretranslate/templates/app.js.template:31
msgid "Copy text"
msgstr "Copia testo"
#: libretranslate/templates/app.js.template:72
#, python-format
msgid "Cannot load %(url)s"
msgstr "Impossibile caricare' %(url)s"
#: libretranslate/templates/index.html:6
msgid "Free and Open Source Machine Translation API"
msgstr "API di traduzione automatica open source"