Add user-customizable <title> if not web_version

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2025-06-15 11:30:56 +02:00
parent 2b3f51a28b
commit 769a447f8f
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
5 changed files with 17 additions and 1 deletions

View File

@ -220,7 +220,8 @@ Arguments passed to the process or set via environment variables are split into
| --ga-id | Enable Google Analytics on the API client page by providing an ID | `Empty (no tracking)` | LT_GA_ID |
| --frontend-language-source | Set frontend default language - source | `auto` | LT_FRONTEND_LANGUAGE_SOURCE |
| --frontend-language-target | Set frontend default language - target | `locale` (match site's locale) | LT_FRONTEND_LANGUAGE_TARGET |
| --frontend-language | Set frontend web interface language | `(empty)` (auto-detect) | LT_FRONTEND_LANGUAGE |
| --frontend-language | Set frontend web interface language | `(empty)` (auto-detect) | LT_FRONTEND_LANGUAGE |
| --frontend-title | Set frontend web interface title | `LibreTranslate` | LT_FRONTEND_TITLE |
| --frontend-timeout | Set frontend translation timeout | `500` | LT_FRONTEND_TIMEOUT |
| --api-keys-db-path | Use a specific path inside the container for the local database. Can be absolute or relative | `db/api_keys.db` | LT_API_KEYS_DB_PATH |
| --api-keys-remote | Use this remote endpoint to query for valid API keys instead of using the local database | `Empty (use local db instead)` | LT_API_KEYS_REMOTE |

View File

@ -447,6 +447,7 @@ def create_app(args):
alternate_locales=get_alternate_locale_links(),
under_attack=args.under_attack,
hide_api=args.hide_api,
frontend_title=args.frontend_title,
))
if args.require_api_key_secret:

View File

@ -126,6 +126,11 @@ _default_options_objects = [
'default_value': 500,
'value_type': 'int'
},
{
'name': 'FRONTEND_TITLE',
'default_value': 'LibreTranslate',
'value_type': 'str'
},
{
'name': 'API_KEYS',
'default_value': False,

View File

@ -111,6 +111,13 @@ def get_args():
metavar="<language code>",
help="Set frontend interface language (%(default)s)",
)
parser.add_argument(
"--frontend-title",
type=str,
default=DEFARGS['FRONTEND_TITLE'],
metavar="<title>",
help="Set frontend title (%(default)s)",
)
parser.add_argument(
"--frontend-timeout",
type=int,

View File

@ -9,6 +9,8 @@
<title>LibreTranslate - {{ _h("Free and Open Source Machine Translation API") }} 🌐</title>
<meta name="description" content="{{ _h('Free and Open Source Machine Translation API. Free to download, offline capable and easy to setup. Run your own API server in just a few minutes.') }}">
<meta name="keywords" content="{{ _h('translation') }},{{ _h('api') }}">
{% else %}
<title>{{ frontend_title }}</title>
{% endif %}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">