Revert "remove translate _tip in a sentence with other words"

This reverts commit 83b8899414a9b5119c6857c2018af9fdca4e778d.
This commit is contained in:
dignow 2023-06-29 22:44:15 +08:00
parent 83b8899414
commit b7bc8f23da
2 changed files with 17 additions and 1 deletions

View File

@ -1006,7 +1006,14 @@ Widget msgboxContent(String type, String title, String text) {
}
text = words.join(': ');
} else {
text = translate(text);
List<String> 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;
}

View File

@ -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;
}