From 3d65d7d5ed1a866d1c03180c30e515d5feac3a67 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 12 Aug 2021 01:42:58 +0800 Subject: [PATCH] add some docnotes on the resolution to the problem --- services/root-keys/locales/i18n.json | 5 +++++ services/root-keys/src/implementation.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/services/root-keys/locales/i18n.json b/services/root-keys/locales/i18n.json index 02d2561d5..a19d96bbb 100644 --- a/services/root-keys/locales/i18n.json +++ b/services/root-keys/locales/i18n.json @@ -39,6 +39,11 @@ "zh": "现在正在初始化\n可能还要等一下\n不要重置或睡眠!\n", "en-audio": "Initializing keys. This may take a while, don't reset or sleep the device." }, + "rootkeys.init.note_to_translator": { + "en": "It is important that every message in the `rootkeys.init` series have the same number of lines. Insert dummy \n characters if you require multi-line translations! Failure to do so can lead to a deadlock situation (read the code for more notes).", + "zh": "`rootkeys.init` 系列中的每条消息都具有相同的行数,这一点很重要。 如果您需要多行翻译,请插入虚拟 \n 字符!", + "en-audio": "It is important that every message in the `rootkeys.init` series have the same number of lines. Insert dummy \n characters if you require multi-line translations!" + }, "rootkeys.init.signing_loader": { "en": "Signing loader.\nThis takes a few minutes.\nDo not reset or sleep!", "zh": "签名引导程序\n可能还要等一下\n不要重置或睡眠!\n", diff --git a/services/root-keys/src/implementation.rs b/services/root-keys/src/implementation.rs index 09b2b9671..4a36f644b 100644 --- a/services/root-keys/src/implementation.rs +++ b/services/root-keys/src/implementation.rs @@ -724,6 +724,13 @@ impl<'a> RootKeys { /// is used to report the progress of the initialization routine. We assume the `Slider` box is set /// up to report progress on a range of 0-100%. /// + /// IMPORTANT ASSUMPTION: It is assumed that all the progress messages in the translations do not + /// end up changing the size of the dialog box. This is because such changes in size would trigger + /// a redraw message that cannot be handled by the thread (because it's busy doing this), and + /// if enough of them get issued, eventually the thread deadlocks. If you are doing translations, + /// review your messages and add \n characters on shorter messages so that the overall height + /// of the dialog box remains constant throughout the operation! + /// /// This routine dispatches the following activities: /// - generate signing private key (encrypted with update password) /// - generate rootkey (encrypted with boot password)