debug done

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-06-29 22:25:01 +08:00
parent 4c1eb75129
commit 2c0918fc06
4 changed files with 26 additions and 7 deletions

View File

@ -999,13 +999,23 @@ Widget msgboxIcon(String type) {
// title should be null
Widget msgboxContent(String type, String title, String text) {
String translateText(String text) {
List<String> words = text.split(' ');
if (words.isNotEmpty && words[0].endsWith('_tip')) {
words[0] = translate(words[0]);
return words.join(' ');
if (text.indexOf('Failed') == 0 && text.contains(': ')) {
List<String> words = text.split(': ');
for (var i = 0; i < words.length; ++i) {
words[i] = translate(words[i]);
}
text = words.join(': ');
} else {
return 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;
}
return Row(

View File

@ -478,7 +478,7 @@ extern "C" fn notify_callback(conn_id: UINT32, msg: *const NOTIFICATION_MESSAGE)
match (CStr::from_ptr(msg.msg as _).to_str(), details) {
(Ok(m), Ok(d)) => {
let msgtype = format!(
"{}-nocancel-nook-hasclose",
"custom-{}-nocancel-nook-hasclose",
if msg.r#type == 0 {
"info"
} else if msg.r#type == 1 {

View File

@ -987,7 +987,7 @@ fn try_get_displays() -> ResultType<Vec<Display>> {
}
#[inline]
#[cfg(windows)]
#[cfg(all(windows, feature = "virtual_display_driver"))]
fn no_displays(displays: &Vec<Display>) -> bool {
let display_len = displays.len();
if display_len == 0 {

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