From 96ebf5bc3fb455162286b9bc31e763f3c4f1c457 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 8 Aug 2018 18:24:49 -0700 Subject: Two fixes and translate more strings. * Fix finding translations with escaped characters. * Add back \r to translations since its needed by screen. --- py/objcomplex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'py/objcomplex.c') diff --git a/py/objcomplex.c b/py/objcomplex.c index 261c2b1f0..3336d7b05 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -31,6 +31,8 @@ #include "py/parsenum.h" #include "py/runtime.h" +#include "supervisor/shared/translate.h" + #if MICROPY_PY_BUILTINS_COMPLEX #include @@ -198,13 +200,13 @@ mp_obj_t mp_obj_complex_binary_op(mp_binary_op_t op, mp_float_t lhs_real, mp_flo } case MP_BINARY_OP_FLOOR_DIVIDE: case MP_BINARY_OP_INPLACE_FLOOR_DIVIDE: - mp_raise_TypeError("can't do truncated division of a complex number"); + mp_raise_TypeError(translate("can't do truncated division of a complex number")); case MP_BINARY_OP_TRUE_DIVIDE: case MP_BINARY_OP_INPLACE_TRUE_DIVIDE: if (rhs_imag == 0) { if (rhs_real == 0) { - mp_raise_msg(&mp_type_ZeroDivisionError, "complex division by zero"); + mp_raise_msg(&mp_type_ZeroDivisionError, translate("complex division by zero")); } lhs_real /= rhs_real; lhs_imag /= rhs_real; @@ -232,7 +234,7 @@ mp_obj_t mp_obj_complex_binary_op(mp_binary_op_t op, mp_float_t lhs_real, mp_flo if (rhs_imag == 0 && rhs_real >= 0) { lhs_real = (rhs_real == 0); } else { - mp_raise_msg(&mp_type_ZeroDivisionError, "0.0 to a complex power"); + mp_raise_msg(&mp_type_ZeroDivisionError, translate("0.0 to a complex power")); } } else { mp_float_t ln1 = MICROPY_FLOAT_C_FUN(log)(abs1); -- cgit v1.2.3