Translated index.html

This commit is contained in:
Piero Toffanin 2023-01-04 17:54:07 -05:00
parent 3cbbd8ae16
commit 19c3c04ca6
7 changed files with 144 additions and 129 deletions

View file

@ -19,7 +19,7 @@ from flask_babel import Babel, gettext as _
from libretranslate import flood, remove_translated_files, security from libretranslate import flood, remove_translated_files, security
from libretranslate.language import detect_languages, improve_translation_formatting from libretranslate.language import detect_languages, improve_translation_formatting
from libretranslate.locales import get_available_locales from libretranslate.locales import get_available_locales, gettext_escaped, gettext_html
from .api_keys import Database, RemoteDatabase from .api_keys import Database, RemoteDatabase
from .suggestions import Database as SuggestionsDatabase from .suggestions import Database as SuggestionsDatabase
@ -288,14 +288,6 @@ def create_app(args):
url_prefix=args.url_prefix url_prefix=args.url_prefix
) )
@bp.get("/javascript-licenses")
@limiter.exempt
def javascript_licenses():
if args.disable_web_ui:
abort(404)
return render_template("javascript-licenses.html")
@bp.route("/static/js/app.js") @bp.route("/static/js/app.js")
@limiter.exempt @limiter.exempt
def appjs(): def appjs():
@ -1017,15 +1009,16 @@ def create_app(args):
def spec(): def spec():
return jsonify(swag) return jsonify(swag)
app.config["BABEL_TRANSLATION_DIRECTORIES"] = 'locales'
babel = Babel(app) babel = Babel(app)
@babel.localeselector @babel.localeselector
def get_locale(): def get_locale():
# TODO: populate from available locales
return request.accept_languages.best_match(get_available_locales()) return request.accept_languages.best_match(get_available_locales())
def gettext_escaped(*args, **kwargs):
return _(*args, **kwargs).replace("'", "\\'")
app.jinja_env.globals.update(N_=gettext_escaped) app.jinja_env.globals.update(_e=gettext_escaped, _h=gettext_html)
# Call factory function to create our blueprint # Call factory function to create our blueprint
swaggerui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL) swaggerui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)

View file

@ -1,9 +1,31 @@
import os import os
from functools import cache from functools import cache
from flask_babel import gettext as _
from markupsafe import escape, Markup
@cache @cache
def get_available_locales(): def get_available_locales():
locales_dir = os.path.join(os.path.dirname(__file__), 'locales') locales_dir = os.path.join(os.path.dirname(__file__), 'locales')
dirs = [os.path.join(locales_dir, d) for d in os.listdir(locales_dir)] dirs = [os.path.join(locales_dir, d) for d in os.listdir(locales_dir)]
return ['en'] + [os.path.basename(d) for d in dirs if os.path.isdir(os.path.join(d, 'LC_MESSAGES'))] return ['en'] + [os.path.basename(d) for d in dirs if os.path.isdir(os.path.join(d, 'LC_MESSAGES'))]
# Javascript code should use _e instead of _
def gettext_escaped(text, **variables):
return _(text, **variables).replace("'", "\\'")
# HTML should be escaped using _h instead of _
def gettext_html(text, **variables):
# Translate text without args
s = str(escape(_(text)))
v = {}
if variables:
for k in variables:
if hasattr(variables[k], 'unescape'):
v[k] = variables[k].unescape()
else:
v[k] = Markup(variables[k])
# Variables are assumed to be already escaped and thus safe
return Markup(s if not v else s % v)

View file

@ -7,15 +7,15 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-01-04 15:34-0500\n" "POT-Creation-Date: 2023-01-04 16:34-0500\n"
"PO-Revision-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" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: it <LL@li.org>\n"
"Language: it\n" "Language: it\n"
"Language-Team: it <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 2.11.0\n" "Generated-By: Babel 2.11.0\n"
#: libretranslate/app.py:58 #: libretranslate/app.py:58
@ -35,6 +35,24 @@ msgstr "Copia testo"
msgid "Cannot load %(url)s" msgid "Cannot load %(url)s"
msgstr "Non riesco a caricare %(url)s" msgstr "Non riesco a caricare %(url)s"
#: libretranslate/templates/index.html:6 #: libretranslate/templates/index.html:6 libretranslate/templates/index.html:26
msgid "Free and Open Source Machine Translation API" msgid "LibreTranslate - Free and Open Source Machine Translation API"
msgstr "API di traduzione automatica open source" msgstr "API di traduzione automatica open source < ' a"
#: libretranslate/templates/index.html:8 libretranslate/templates/index.html:30
msgid ""
"Free and Open Source Machine Translation API. Self-hosted, offline "
"capable and easy to setup. Run your own API server in just a few minutes."
msgstr ""
"API di traduzione automatica gratuita e open source. Auto-hosted, offline"
" in grado e facile da configurare. Eseguire il proprio server API in "
"pochi minuti."
#: libretranslate/templates/index.html:9
msgid "translation"
msgstr "traduzione"
#: libretranslate/templates/index.html:9
msgid "api"
msgstr "api"

View file

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

View file

@ -3,10 +3,10 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LibreTranslate - {{ _("Free and Open Source Machine Translation API") }}</title> <title>{{ _h("LibreTranslate - Free and Open Source Machine Translation API") }}</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<meta name="description" content="Free and Open Source Machine Translation API. 100% self-hosted, offline capable and easy to setup. Run your own API server in just a few minutes."> <meta name="description" content="{{ _h('Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup. Run your own API server in just a few minutes.') }}">
<meta name="keywords" content="translation,api"> <meta name="keywords" content="{{ _h('translation') }},{{ _h('api') }}">
<script type="text/javascript"> <script type="text/javascript">
var url_prefix = "{{ url_prefix }}" var url_prefix = "{{ url_prefix }}"
</script> </script>
@ -23,11 +23,11 @@
<link rel="preload" href="{{ url_for('static', filename='css/main.css') }}?v={{ version }}" as="style"/> <link rel="preload" href="{{ url_for('static', filename='css/main.css') }}?v={{ version }}" as="style"/>
<link rel="preload" href="{{ url_for('static', filename='css/dark-theme.css') }}" as="style"/> <link rel="preload" href="{{ url_for('static', filename='css/dark-theme.css') }}" as="style"/>
<meta property="og:title" content="LibreTranslate - Free and Open Source Machine Translation API" /> <meta property="og:title" content="{{ _h('LibreTranslate - Free and Open Source Machine Translation API') }}" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:url" content="https://libretranslate.com" /> <meta property="og:url" content="https://libretranslate.com" />
<meta property="og:image" content="https://user-images.githubusercontent.com/1951843/102724116-32a6df00-42db-11eb-8cc0-129ab39cdfb5.png" /> <meta property="og:image" content="https://user-images.githubusercontent.com/1951843/102724116-32a6df00-42db-11eb-8cc0-129ab39cdfb5.png" />
<meta property="og:description" name="description" class="swiftype" content="Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Run your own API server in just a few minutes."/> <meta property="og:description" name="description" class="swiftype" content="{{ _h('Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup. Run your own API server in just a few minutes.') }}"/>
<script src="{{ url_for('static', filename='js/vue@2.js') }}"></script> <script src="{{ url_for('static', filename='js/vue@2.js') }}"></script>
@ -58,28 +58,28 @@
<button data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></button> <button data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></button>
<a id="logo-container" href="/" class="brand-logo"> <a id="logo-container" href="/" class="brand-logo">
<img src="{{ url_for('static', filename='icon.svg') }}" alt="Logo for LibreTranslate" class="logo"> <img src="{{ url_for('static', filename='icon.svg') }}" alt="Logo for LibreTranslate" class="logo">
<span>LibreTranslate</span> <span>{{ _h("LibreTranslate") }}</span>
</a> </a>
<ul class="right hide-on-med-and-down"> <ul class="right hide-on-med-and-down">
<li><a href="{{ swagger_url }}">API Docs</a></li> <li><a href="{{ swagger_url }}">{{ _h("API Docs") }}</a></li>
{% if get_api_key_link %} {% if get_api_key_link %}
<li><a href="{{ get_api_key_link }}">Get API Key</a></li> <li><a href="{{ get_api_key_link }}">{{ _h("Get API Key") }}</a></li>
<script>window.getApiKeyLink = "{{ get_api_key_link }}";</script> <script>window.getApiKeyLink = "{{ get_api_key_link }}";</script>
{% endif %} {% endif %}
<li><a href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer">GitHub</a></li> <li><a href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer">{{ _h("GitHub") }}</a></li>
{% if api_keys %} {% if api_keys %}
<li><a href="javascript:setApiKey()" title="Set API Key"><i class="material-icons">vpn_key</i></a></li> <li><a href="javascript:setApiKey()" title="Set API Key"><i class="material-icons">vpn_key</i></a></li>
{% endif %} {% endif %}
</ul> </ul>
<ul id="nav-mobile" class="sidenav"> <ul id="nav-mobile" class="sidenav">
<li><a href="{{ swagger_url }}">API Docs</a></li> <li><a href="{{ swagger_url }}">{{ _h("API Docs") }}</a></li>
{% if get_api_key_link %} {% if get_api_key_link %}
<li><a href="{{ get_api_key_link }}">Get API Key</a></li> <li><a href="{{ get_api_key_link }}">{{ _h("Get API Key") }}</a></li>
{% endif %} {% endif %}
<li><a href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer">GitHub</a></li> <li><a href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer">{{ _h("GitHub") }}</a></li>
{% if api_keys %} {% if api_keys %}
<li><a href="javascript:setApiKey()" title="Set API Key"><i class="material-icons">vpn_key</i></a></li> <li><a href="javascript:setApiKey()" title="{{ _h('Set API Key') }}"><i class="material-icons">vpn_key</i></a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@ -116,7 +116,7 @@
<i class="material-icons">warning</i><p> [[ error ]]</p> <i class="material-icons">warning</i><p> [[ error ]]</p>
</div> </div>
<div class="card-action"> <div class="card-action">
<a href="#" @click="dismissError">Dismiss</a> <a href="#" @click="dismissError">{{ _h("Dismiss") }}</a>
</div> </div>
</div> </div>
</div> </div>
@ -130,22 +130,22 @@
<div class="section no-pad-bot"> <div class="section no-pad-bot">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<h3 class="header center">Translation API</h3> <h3 class="header center">{{ _h("Translation API") }}</h3>
<div id="translation-type-btns" class="s12 center" v-if="filesTranslation === true"> <div id="translation-type-btns" class="s12 center" v-if="filesTranslation === true">
<button type="button" class="btn btn-switch-type" @click="switchType('text')" :class="{'active': translationType === 'text'}"> <button type="button" class="btn btn-switch-type" @click="switchType('text')" :class="{'active': translationType === 'text'}">
<i class="material-icons">title</i> <i class="material-icons">title</i>
<span class="btn-text">Translate Text</span> <span class="btn-text">{{ _h("Translate Text") }}</span>
</button> </button>
<button type="button" class="btn btn-switch-type" @click="switchType('files')" :class="{'active': translationType === 'files'}"> <button type="button" class="btn btn-switch-type" @click="switchType('files')" :class="{'active': translationType === 'files'}">
<i class="material-icons">description</i> <i class="material-icons">description</i>
<span class="btn-text">Translate Files</span> <span class="btn-text">{{ _h("Translate Files") }}</span>
</button> </button>
</div> </div>
<form id="translation-form" class="col s12"> <form id="translation-form" class="col s12">
<div class="row mb-0"> <div class="row mb-0">
<div class="col s6 language-select"> <div class="col s6 language-select">
<span>Translate from</span> <span>{{ _h("Translate from") }}</span>
<span v-if="detectedLangText !== ''">[[ detectedLangText ]]</span> <span v-if="detectedLangText !== ''">[[ detectedLangText ]]</span>
<select class="browser-default" v-model="sourceLang" ref="sourceLangDropdown" @change="handleInput"> <select class="browser-default" v-model="sourceLang" ref="sourceLangDropdown" @change="handleInput">
<template v-for="option in langs"> <template v-for="option in langs">
<option :value="option.code">[[ option.name ]]</option> <option :value="option.code">[[ option.name ]]</option>
@ -157,7 +157,7 @@
<a href="javascript:void(0)" @click="swapLangs" class="btn-switch-language"> <a href="javascript:void(0)" @click="swapLangs" class="btn-switch-language">
<i class="material-icons">swap_horiz</i> <i class="material-icons">swap_horiz</i>
</a> </a>
<span>Translate into</span> <span>{{ _h("Translate into") }}</span>
<select class="browser-default" v-model="targetLang" ref="targetLangDropdown" @change="handleInput"> <select class="browser-default" v-model="targetLang" ref="targetLangDropdown" @change="handleInput">
<template v-for="option in targetLangs"> <template v-for="option in targetLangs">
<option v-if="option.code !== 'auto'" :value="option.code">[[ option.name ]]</option> <option v-if="option.code !== 'auto'" :value="option.code">[[ option.name ]]</option>
@ -169,7 +169,7 @@
<div class="row" v-if="translationType === 'text'"> <div class="row" v-if="translationType === 'text'">
<div class="input-field textarea-container col s6"> <div class="input-field textarea-container col s6">
<label for="textarea1" class="sr-only"> <label for="textarea1" class="sr-only">
Text to translate {{ _h("Text to translate") }}
</label> </label>
<textarea id="textarea1" v-model="inputText" @input="handleInput" ref="inputTextarea" dir="auto"></textarea> <textarea id="textarea1" v-model="inputText" @input="handleInput" ref="inputTextarea" dir="auto"></textarea>
<button class="btn-delete-text" title="Delete text" @click="deleteText"> <button class="btn-delete-text" title="Delete text" @click="deleteText">
@ -181,23 +181,23 @@
</div> </div>
<div class="input-field textarea-container col s6"> <div class="input-field textarea-container col s6">
<label for="textarea2" class="sr-only"> <label for="textarea2" class="sr-only">
Translated text {{ _h("Translated text") }}
</label> </label>
<textarea id="textarea2" v-model="translatedText" ref="translatedTextarea" dir="auto" v-bind:readonly="suggestions && !isSuggesting"></textarea> <textarea id="textarea2" v-model="translatedText" ref="translatedTextarea" dir="auto" v-bind:readonly="suggestions && !isSuggesting"></textarea>
<div class="actions"> <div class="actions">
<button v-if="suggestions && !loadingTranslation && inputText.length && !isSuggesting" class="btn-action" @click="suggestTranslation"> <button v-if="suggestions && !loadingTranslation && inputText.length && !isSuggesting" class="btn-action" @click="suggestTranslation">
<i class="material-icons">edit</i> <i class="material-icons">edit</i>
</button> </button>
<button v-if="suggestions && !loadingTranslation && inputText.length && isSuggesting" class="btn-action btn-blue" @click="closeSuggestTranslation"> <button v-if="suggestions && !loadingTranslation && inputText.length && isSuggesting" class="btn-action btn-blue" @click="closeSuggestTranslation">
<span>Cancel</span> <span>{{ _h("Cancel") }}</span>
</button> </button>
<button v-if="suggestions && !loadingTranslation && inputText.length && isSuggesting" :disabled="!canSendSuggestion" class="btn-action btn-blue" @click="sendSuggestion"> <button v-if="suggestions && !loadingTranslation && inputText.length && isSuggesting" :disabled="!canSendSuggestion" class="btn-action btn-blue" @click="sendSuggestion">
<span>Send</span> <span>{{ _h("Send") }}</span>
</button> </button>
<button v-if="!isSuggesting" class="btn-action btn-copy-translated" @click="copyText"> <button v-if="!isSuggesting" class="btn-action btn-copy-translated" @click="copyText">
<span>[[ copyTextLabel ]]</span> <i class="material-icons">content_copy</i> <span>[[ copyTextLabel ]]</span> <i class="material-icons">content_copy</i>
</button> </button>
</div> </div>
<div class="position-relative"> <div class="position-relative">
<div class="progress translate" v-if="loadingTranslation"> <div class="progress translate" v-if="loadingTranslation">
<div class="indeterminate"></div> <div class="indeterminate"></div>
@ -205,43 +205,43 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row" v-if="translationType === 'files'"> <div class="row" v-if="translationType === 'files'">
<div class="file-dropzone"> <div class="file-dropzone">
<div v-if="inputFile === false" class="dropzone-content"> <div v-if="inputFile === false" class="dropzone-content">
<span>Supported file formats: [[ supportedFilesFormatFormatted ]]</span> <span>{{ _h("Supported file formats:") }} [[ supportedFilesFormatFormatted ]]</span>
<form action="#"> <form action="#">
<div class="file-field input-field"> <div class="file-field input-field">
<div class="btn"> <div class="btn">
<span>File</span> <span>{{ _h("File") }}</span>
<input type="file" :accept="supportedFilesFormatFormatted" @change="handleInputFile" ref="fileInputRef"> <input type="file" :accept="supportedFilesFormatFormatted" @change="handleInputFile" ref="fileInputRef">
</div> </div>
<div class="file-path-wrapper hidden"> <div class="file-path-wrapper hidden">
<input class="file-path validate" type="text"> <input class="file-path validate" type="text">
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div v-if="inputFile !== false" class="dropzone-content"> <div v-if="inputFile !== false" class="dropzone-content">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<div class="row mb-0"> <div class="row mb-0">
<div class="col s12"> <div class="col s12">
[[ inputFile.name ]] [[ inputFile.name ]]
<button v-if="loadingFileTranslation !== true" @click="removeFile" class="btn-flat"> <button v-if="loadingFileTranslation !== true" @click="removeFile" class="btn-flat">
<i class="material-icons">close</i> <i class="material-icons">close</i>
</button> </button>
</div>
</div>
</div>
</div>
<button @click="translateFile" v-if="translatedFileUrl === false && loadingFileTranslation === false" class="btn">Translate</button>
<a v-if="translatedFileUrl !== false" :href="translatedFileUrl" class="btn">Download</a>
<div class="progress" v-if="loadingFileTranslation">
<div class="indeterminate"></div>
</div>
</div>
</div>
</div> </div>
</div>
</div>
</div>
<button @click="translateFile" v-if="translatedFileUrl === false && loadingFileTranslation === false" class="btn">{{ _h("Translate") }}</button>
<a v-if="translatedFileUrl !== false" :href="translatedFileUrl" class="btn">{{ _h("Download") }}</a>
<div class="progress" v-if="loadingFileTranslation">
<div class="indeterminate"></div>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
@ -254,12 +254,12 @@
<div class="row center"> <div class="row center">
<div class="col s12 m12 l6 left-align"> <div class="col s12 m12 l6 left-align">
<p class="mb-0">Request</p> <p class="mb-0">{{ _h("Request") }}</p>
<pre class="code mt-0"><code class="language-javascript" v-html="$options.filters.highlight(requestCode)"> <pre class="code mt-0"><code class="language-javascript" v-html="$options.filters.highlight(requestCode)">
</code></pre> </code></pre>
</div> </div>
<div class="col s12 m12 l6 left-align"> <div class="col s12 m12 l6 left-align">
<p class="mb-0">Response</p> <p class="mb-0">{{ _h("Response") }}</p>
<pre class="code mt-0"><code class="language-javascript" v-html="$options.filters.highlight(output)"> <pre class="code mt-0"><code class="language-javascript" v-html="$options.filters.highlight(output)">
</code></pre> </code></pre>
</div> </div>
@ -274,12 +274,12 @@
<div class="container"> <div class="container">
<div class="row center"> <div class="row center">
<div class="col s12 m12"> <div class="col s12 m12">
<h3 class="header">Open Source Machine Translation API</h3> <h3 class="header">{{ _h("Open Source Machine Translation API") }}</h3>
<h4 class="header">100% Self-Hosted. Offline Capable. Easy to Setup.</h4> <h4 class="header">{{ _h("Self-Hosted. Offline Capable. Easy to Setup.") }}</h4>
<div id="download-btn-wrapper"> <div id="download-btn-wrapper">
<a id="download-btn" class="waves-effect waves-light btn btn-large teal darken-2" href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer"> <a id="download-btn" class="waves-effect waves-light btn btn-large teal darken-2" href="https://github.com/LibreTranslate/LibreTranslate" rel="noopener noreferrer">
<i class="material-icons">cloud_download</i> <i class="material-icons">cloud_download</i>
<span class="btn-text">Download</span> <span class="btn-text">{{ _h("Download") }}</span>
</a> </a>
</div> </div>
</div> </div>
@ -294,13 +294,12 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col l12 s12"> <div class="col l12 s12">
<h5 class="white-text">LibreTranslate</h5> <h5 class="white-text">{{ _h("LibreTranslate") }}</h5>
<p class="grey-text text-lighten-4">Free and Open Source Machine Translation API</p> <p class="grey-text text-lighten-4">{{ _h("Free and Open Source Machine Translation API") }}</p>
<p>License: <a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html" rel="noopener noreferrer">AGPLv3</a></p> <p>License: <a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html" rel="noopener noreferrer">AGPLv3</a></p>
<p><a class="grey-text text-lighten-4" href="/javascript-licenses" rel="jslicense">JavaScript license information</a></p>
{% if web_version %} {% if web_version %}
<p> <p>
This public API should be used for testing, personal or infrequent use. If you're going to run an application in production, please <a href="https://github.com/LibreTranslate/LibreTranslate" class="grey-text text-lighten-4" rel="noopener noreferrer">host your own server</a> or <a class="grey-text text-lighten-4" href="{{ get_api_key_link if get_api_key_link else 'https://github.com/LibreTranslate/LibreTranslate#mirrors' }}" rel="noopener noreferrer">get an API key</a>. {{ _h("This public API should be used for testing, personal or infrequent use. If you're going to run an application in production, please %(host_server)s or %(get_api_key)s.", host_server='<a href="https://github.com/LibreTranslate/LibreTranslate" class="grey-text text-lighten-4" rel="noopener noreferrer">' + _h("host your own server") + '</a>', get_api_key='<a class="grey-text text-lighten-4" href="' + (get_api_key_link if get_api_key_link else "https://github.com/LibreTranslate/LibreTranslate#mirrors") + '" rel="noopener noreferrer">' + _h("get an API key") + '</a>') }}
</p> </p>
{% endif %} {% endif %}
</div> </div>
@ -308,7 +307,7 @@
</div> </div>
<div class="footer-copyright center"> <div class="footer-copyright center">
<p class="white-text"> <p class="white-text">
Made with ❤ by <a class="white-text" href="https://github.com/LibreTranslate/LibreTranslate/graphs/contributors" rel="noopener noreferrer">LibreTranslate Contributors</a> and powered by <a class="white-text text-lighten-3" href="https://github.com/argosopentech/argos-translate/" rel="noopener noreferrer">Argos Translate</a> {{ _h("Made with %(heart)s by %(contributors)s and powered by %(engine)s", heart='❤', contributors='<a class="white-text" href="https://github.com/LibreTranslate/LibreTranslate/graphs/contributors" rel="noopener noreferrer">%s</a>' % _h("LibreTranslate Contributors"), engine='<a class="white-text text-lighten-3" href="https://github.com/argosopentech/argos-translate/" rel="noopener noreferrer">%s</a>' % _h('Argos Translate')) }}
</p> </p>
</div> </div>
</footer> </footer>
@ -320,7 +319,7 @@
window.Prism.manual = true; window.Prism.manual = true;
// @license-end // @license-end
</script> </script>
<script src="{{ url_for('static', filename='js/prism.min.js') }}"></script> <script src="{{ url_for('static', filename='js/prism.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/app.js') }}?v={{ version }}"></script> <script src="{{ url_for('static', filename='js/app.js') }}?v={{ version }}"></script>
</body> </body>
</html> </html>

View file

@ -1,22 +0,0 @@
<html>
<head>
<title>jslicense-labels1 for LibreTranslate</title>
</head>
<body>
<h3>Weblabels</h3>
<table id="jslicense-labels1" border="1">
<tr>
<td><a href="{{ url_for('static', filename='js/vue@2.js') }}">Vue.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
</tr>
<tr>
<td><a href="{{ url_for('static', filename='js/prism.min.js') }}">prism.min.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
</tr>
<tr>
<td><a href="{{ url_for('static', filename='js/materialize.min.js') }}">materialize.min.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
</tr>
</table>
</body>
</html>

View file

@ -7,6 +7,7 @@ from babel.messages.frontend import main as pybabel
from libretranslate.language import load_languages, improve_translation_formatting from libretranslate.language import load_languages, improve_translation_formatting
from libretranslate.locales import get_available_locales from libretranslate.locales import get_available_locales
from translatehtml import translate_html from translatehtml import translate_html
from libretranslate.app import get_version
# Update strings # Update strings
if __name__ == "__main__": if __name__ == "__main__":
@ -16,7 +17,11 @@ if __name__ == "__main__":
messagespot = os.path.join(locales_dir, "messages.pot") messagespot = os.path.join(locales_dir, "messages.pot")
print("Updating %s" % messagespot) print("Updating %s" % messagespot)
sys.argv = ["", "extract", "-F", "babel.cfg", "-o", messagespot, "libretranslate"] sys.argv = ["", "extract", "-F", "babel.cfg", "-k", "_e _h",
"--copyright-holder", "LibreTranslate Authors",
"--project", "LibreTranslate",
"--version", get_version(),
"-o", messagespot, "libretranslate"]
pybabel() pybabel()
# Load list of languages # Load list of languages