Show custom frontend title also above textareas when defined and != LibreTranslate (the default value)

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

View File

@ -33,6 +33,7 @@ from libretranslate.locales import (
gettext_html,
lazy_swag,
)
from libretranslate.default_values import DEFAULT_FRONTEND_TITLE
from .api_keys import Database, RemoteDatabase
from .suggestions import Database as SuggestionsDatabase
@ -448,6 +449,7 @@ def create_app(args):
under_attack=args.under_attack,
hide_api=args.hide_api,
frontend_title=args.frontend_title,
use_custom_title=args.frontend_title != DEFAULT_FRONTEND_TITLE,
))
if args.require_api_key_secret:

View File

@ -2,6 +2,7 @@ import os
_prefix = 'LT_'
DEFAULT_FRONTEND_TITLE = 'LibreTranslate'
def _get_value_str(name, default_value):
env_value = os.environ.get(name)
@ -128,7 +129,7 @@ _default_options_objects = [
},
{
'name': 'FRONTEND_TITLE',
'default_value': 'LibreTranslate',
'default_value': DEFAULT_FRONTEND_TITLE,
'value_type': 'str'
},
{

View File

@ -181,7 +181,13 @@
</div>
</div>
{% endif %}
<h3 class="header center">{{ _h("Translation API") }}</h3>
<h3 class="header center">
{% if use_custom_title %}
{{ frontend_title }}
{% else %}
{{ _h("Translation API") }}
{% endif %}
</h3>
<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'}" :disabled="disableInput">
<i aria-hidden="true" class="material-icons">title</i>