summaryrefslogtreecommitdiff
path: root/shared-bindings/_stage
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-07-31 16:53:54 -0700
committerScott Shawcroft <scott@tannewt.org>2018-08-07 14:58:57 -0700
commit933add6cd833bb6ba6682ad2b6eb478871415ff5 (patch)
tree8cb5ee1feb0516c24ee270fcee5ed00d310aced8 /shared-bindings/_stage
parent2029c4e87e3e71ada07c8be91fe6877edf4a606b (diff)
Support internationalisation.
Diffstat (limited to 'shared-bindings/_stage')
-rw-r--r--shared-bindings/_stage/Layer.c7
-rw-r--r--shared-bindings/_stage/Text.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c
index 3e615c497..a3334f635 100644
--- a/shared-bindings/_stage/Layer.c
+++ b/shared-bindings/_stage/Layer.c
@@ -28,6 +28,7 @@
#include "__init__.h"
#include "Layer.h"
+#include "supervisor/shared/translate.h"
//| .. currentmodule:: _stage
//|
@@ -67,20 +68,20 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
self->graphic = bufinfo.buf;
if (bufinfo.len != 2048) {
- mp_raise_ValueError("graphic must be 2048 bytes long");
+ mp_raise_ValueError(translate("graphic must be 2048 bytes long"));
}
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
self->palette = bufinfo.buf;
if (bufinfo.len != 32) {
- mp_raise_ValueError("palette must be 32 bytes long");
+ mp_raise_ValueError(translate("palette must be 32 bytes long"));
}
if (n_args > 4) {
mp_get_buffer_raise(args[4], &bufinfo, MP_BUFFER_READ);
self->map = bufinfo.buf;
if (bufinfo.len < (self->width * self->height) / 2) {
- mp_raise_ValueError("map buffer too small");
+ mp_raise_ValueError(translate("map buffer too small"));
}
} else {
self-> map = NULL;
diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c
index c62d22afe..7a406271d 100644
--- a/shared-bindings/_stage/Text.c
+++ b/shared-bindings/_stage/Text.c
@@ -28,6 +28,7 @@
#include "__init__.h"
#include "Text.h"
+#include "supervisor/shared/translate.h"
//| .. currentmodule:: _stage
//|
@@ -65,19 +66,19 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
self->font = bufinfo.buf;
if (bufinfo.len != 2048) {
- mp_raise_ValueError("font must be 2048 bytes long");
+ mp_raise_ValueError(translate("font must be 2048 bytes long"));
}
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
self->palette = bufinfo.buf;
if (bufinfo.len != 32) {
- mp_raise_ValueError("palette must be 32 bytes long");
+ mp_raise_ValueError(translate("palette must be 32 bytes long"));
}
mp_get_buffer_raise(args[4], &bufinfo, MP_BUFFER_READ);
self->chars = bufinfo.buf;
if (bufinfo.len < self->width * self->height) {
- mp_raise_ValueError("chars buffer too small");
+ mp_raise_ValueError(translate("chars buffer too small"));
}
return MP_OBJ_FROM_PTR(self);