summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDan Halbert <halbert@adafruit.com>2021-01-22 03:49:19 -0500
committerGitHub <noreply@github.com>2021-01-22 03:49:19 -0500
commite3275be8b1ad28d0296733876cf119f134680e81 (patch)
treef72c1ad495b9bf5ec8ea9e929a648cc76c73b460 /py
parent10a44af5361112599d00d7f0c3ccdb2b4a9395ae (diff)
parent63b5e56c721421d311e2b29da94ff0bd4e300e7a (diff)
Merge pull request #3911 from hugodahl/add-translation-for-builtin-object-help
Update built-in help output for localization (Issue #3907)
Diffstat (limited to 'py')
-rw-r--r--py/builtinhelp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index d12e088d6..e1dcb6096 100644
--- a/py/builtinhelp.c
+++ b/py/builtinhelp.c
@@ -152,9 +152,18 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
mp_obj_type_t *type = mp_obj_get_type(obj);
// try to print something sensible about the given object
- mp_print_str(MP_PYTHON_PRINTER, "object ");
+ const compressed_string_t* compressed = translate("object ");
+ char decompressed_object[decompress_length(compressed)];
+ decompress(compressed, decompressed_object);
+
+ mp_print_str(MP_PYTHON_PRINTER, decompressed_object);
mp_obj_print(obj, PRINT_STR);
- mp_printf(MP_PYTHON_PRINTER, " is of type %q\n", type->name);
+
+ compressed = translate(" is of type %q\n");
+ char decompressed_typestring[decompress_length(compressed)];
+ decompress(compressed, decompressed_typestring);
+
+ mp_printf(MP_PYTHON_PRINTER, decompressed_typestring, type->name);
mp_map_t *map = NULL;
if (type == &mp_type_module) {