diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 72ee60cc0c..4e7abcb0b8 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2410,6 +2410,10 @@ msgid "" "You pressed the reset button during boot. Press again to exit safe mode." msgstr "" +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" +msgstr "" + #: py/objtype.c msgid "__init__() should return None" msgstr "" diff --git a/supervisor/shared/micropython.c b/supervisor/shared/micropython.c index ebc0aef2d1..5ee0061544 100644 --- a/supervisor/shared/micropython.c +++ b/supervisor/shared/micropython.c @@ -62,8 +62,15 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) { #ifdef CIRCUITPY_BOOT_OUTPUT_FILE if (boot_output != NULL) { // Ensure boot_out.txt is capped at 1 filesystem block and ends with a newline - if (len + boot_output->len > 508) { - vstr_add_str(boot_output, "...\n"); + #define TRUNCATED translate("[truncated due to length]") + size_t truncated_message_len = decompress_length(TRUNCATED); + size_t maxlen = 512 - truncated_message_len; // includes trailing '\0' so we do not need to account for trailing newline '\n' in vstr_add_byte + if (len + boot_output->len > maxlen) { + size_t remaining_len = maxlen - boot_output->len; + vstr_add_strn(boot_output, str, remaining_len); + char buf[truncated_message_len]; + vstr_add_str(boot_output, decompress(TRUNCATED, buf)); + vstr_add_byte(boot_output, '\n'); boot_output = NULL; } else { vstr_add_strn(boot_output, str, len);