From b7bc8f23da3ef2d8c211b4c413a45f0e8129f220 Mon Sep 17 00:00:00 2001 From: dignow Date: Thu, 29 Jun 2023 22:44:15 +0800 Subject: [PATCH] Revert "remove translate _tip in a sentence with other words" This reverts commit 83b8899414a9b5119c6857c2018af9fdca4e778d. --- flutter/lib/common.dart | 9 ++++++++- src/ui/msgbox.tis | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 4beda68ef..d294cb573 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1006,7 +1006,14 @@ Widget msgboxContent(String type, String title, String text) { } text = words.join(': '); } else { - text = translate(text); + List words = text.split(' '); + if (words.length > 1 && words[0].endsWith('_tip')) { + words[0] = translate(words[0]); + final rest = text.substring(words[0].length + 1); + text = '${words[0]} ${translate(rest)}'; + } else { + text = translate(text); + } } return text; } diff --git a/src/ui/msgbox.tis b/src/ui/msgbox.tis index 8d54bf22c..d54b22c8e 100644 --- a/src/ui/msgbox.tis +++ b/src/ui/msgbox.tis @@ -5,6 +5,15 @@ function translate_text(text) { fds[i] = translate(fds[i]); } text = fds.join(': '); + } else { + var fds = text.split(' '); + if (fds.length > 1 && fds[0].slice(-4) === '_tip') { + fds[0] = translate(fds[0]); + var rest = text.substring(fds[0].length + 1); + text = fds[0] + ' ' + translate(rest); + } else { + text = translate(text); + } } return text; }