Skip to content

Commit e3275be

Browse files
authored
Merge pull request #3911 from hugodahl/add-translation-for-builtin-object-help
Update built-in help output for localization (Issue #3907)
2 parents 10a44af + 63b5e56 commit e3275be

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

locale/circuitpython.pot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ msgstr ""
4343
msgid " File \"%q\", line %d"
4444
msgstr ""
4545

46+
#: py/builtinhelp.c
47+
msgid " is of type %q\n"
48+
msgstr ""
49+
4650
#: main.c
4751
msgid " output:\n"
4852
msgstr ""
@@ -3308,6 +3312,10 @@ msgstr ""
33083312
msgid "number of points must be at least 2"
33093313
msgstr ""
33103314

3315+
#: py/builtinhelp.c
3316+
msgid "object "
3317+
msgstr ""
3318+
33113319
#: py/obj.c
33123320
msgid "object '%q' is not a tuple or list"
33133321
msgstr ""

ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
1212

1313
SUPEROPT_GC = 0
14+
SUPEROPT_VM = 0
15+
CFLAGS_INLINE_LIMIT = 40

ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
1212

1313
SUPEROPT_GC = 0
14+
SUPEROPT_VM = 0

ports/atmel-samd/boards/gemma_m0/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ endif
2020
ifeq ($(TRANSLATION), de_DE)
2121
RELEASE_NEEDS_CLEAN_BUILD = 1
2222
CFLAGS_INLINE_LIMIT = 35
23+
SUPEROPT_VM = 0
2324
endif

py/builtinhelp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,18 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
152152
mp_obj_type_t *type = mp_obj_get_type(obj);
153153

154154
// try to print something sensible about the given object
155-
mp_print_str(MP_PYTHON_PRINTER, "object ");
155+
const compressed_string_t* compressed = translate("object ");
156+
char decompressed_object[decompress_length(compressed)];
157+
decompress(compressed, decompressed_object);
158+
159+
mp_print_str(MP_PYTHON_PRINTER, decompressed_object);
156160
mp_obj_print(obj, PRINT_STR);
157-
mp_printf(MP_PYTHON_PRINTER, " is of type %q\n", type->name);
161+
162+
compressed = translate(" is of type %q\n");
163+
char decompressed_typestring[decompress_length(compressed)];
164+
decompress(compressed, decompressed_typestring);
165+
166+
mp_printf(MP_PYTHON_PRINTER, decompressed_typestring, type->name);
158167

159168
mp_map_t *map = NULL;
160169
if (type == &mp_type_module) {

0 commit comments

Comments
 (0)