1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 07:03:02 +00:00

Work on add locales.

Need to be careful not to mess with %j formatter, or
in some other places.
This commit is contained in:
Calvin Rose
2024-05-18 13:23:33 -05:00
parent 91a583db27
commit 2e2f8abfc0
3 changed files with 67 additions and 0 deletions

View File

@@ -380,6 +380,13 @@ static int print_jdn_one(struct pretty *S, Janet x, int depth) {
case JANET_NUMBER:
janet_buffer_ensure(S->buffer, S->buffer->count + BUFSIZE, 2);
int count = snprintf((char *) S->buffer->data + S->buffer->count, BUFSIZE, "%.17g", janet_unwrap_number(x));
/* fix locale issues with commas */
for (int i = 0; i < count; i++) {
char c = S->buffer->data[S->buffer->count + i];
if (c == ',' || c == '\'') {
S->buffer->data[S->buffer->count + i] = '.';
}
}
S->buffer->count += count;
break;
case JANET_SYMBOL: