forked from mirrors/LibreTranslate
Disable suggestions by default
This commit is contained in:
parent
0561deb1b4
commit
0ff3ca65fb
4 changed files with 19 additions and 5 deletions
|
@ -592,6 +592,7 @@ def create_app(args):
|
|||
{
|
||||
"charLimit": args.char_limit,
|
||||
"frontendTimeout": args.frontend_timeout,
|
||||
"suggestions": args.suggestions,
|
||||
"language": {
|
||||
"source": {
|
||||
"code": frontend_argos_language_source.code,
|
||||
|
@ -618,6 +619,9 @@ def create_app(args):
|
|||
@app.route("/suggest", methods=["POST"])
|
||||
@limiter.exempt
|
||||
def suggest():
|
||||
if args.suggestions is False:
|
||||
abort(404)
|
||||
|
||||
q = request.values.get("q")
|
||||
s = request.values.get("s")
|
||||
source_lang = request.values.get("source")
|
||||
|
|
|
@ -110,6 +110,11 @@ _default_options_objects = [
|
|||
'name': 'LOAD_ONLY',
|
||||
'default_value': None,
|
||||
'value_type': 'str'
|
||||
},
|
||||
{
|
||||
'name': 'SUGGESTIONS',
|
||||
'default_value': False,
|
||||
'value_type': 'bool'
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -102,6 +102,9 @@ def main():
|
|||
metavar="<comma-separated language codes>",
|
||||
help="Set available languages (ar,de,en,es,fr,ga,hi,it,ja,ko,pt,ru,zh)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--suggestions", default=DEFARGS['SUGGESTIONS'], action="store_true", help="Allow user suggestions"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
app = create_app(args)
|
||||
|
|
|
@ -148,15 +148,15 @@
|
|||
<label for="textarea2" class="sr-only">
|
||||
Translated text
|
||||
</label>
|
||||
<textarea id="textarea2" v-model="translatedText" ref="translatedTextarea" dir="auto" v-bind:readonly="!isSuggesting"></textarea>
|
||||
<textarea id="textarea2" v-model="translatedText" ref="translatedTextarea" dir="auto" v-bind:readonly="suggestions && !isSuggesting"></textarea>
|
||||
<div class="actions">
|
||||
<button v-if="!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>
|
||||
</button>
|
||||
<button v-if="!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>
|
||||
</button>
|
||||
<button v-if="!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>
|
||||
</button>
|
||||
<button v-if="!isSuggesting" class="btn-action btn-copy-translated" @click="copyText">
|
||||
|
@ -279,6 +279,7 @@
|
|||
|
||||
copyTextLabel: "Copy text",
|
||||
|
||||
suggestions: false,
|
||||
isSuggesting: false,
|
||||
},
|
||||
mounted: function(){
|
||||
|
@ -293,7 +294,8 @@
|
|||
self.sourceLang = self.settings.language.source.code;
|
||||
self.targetLang = self.settings.language.target.code;
|
||||
self.charactersLimit = self.settings.charLimit;
|
||||
}else {
|
||||
self.suggestions = self.settings.suggestions;
|
||||
}else {
|
||||
self.error = "Cannot load /frontend/settings";
|
||||
self.loading = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue