Differences From Artifact [78991846e2]:
- File
src/of_asprintf.m
— part of check-in
[0ad678f125]
at
2017-01-07 03:26:50
on branch trunk
— Use strtof_l, strtod_l and asprintf_l if available
This avoids the hacks introduced in the previous commit, if those
functions are available. (user: js, size: 16165) [annotate] [blame] [check-ins using]
To Artifact [5de6ff2576]:
- File
src/of_asprintf.m
— part of check-in
[06bcb21fc7]
at
2017-01-09 06:26:04
on branch trunk
— Add OFLocalization
This singleton gives access to all things locale, including the ability
to get localized strings.This also adds the OF_LOCALIZED() macro. Its first argument is an ID for
the string to be localized and its second argument is the fallback
string to be used if it cannot retrieve the localized string. Following
that are variable name / value pairs to be replaced in the localized
string.Getting translated strings is not implemented yet: Instead, it always
uses the fallback string.This also switches ofhttp to localized strings. (user: js, size: 16169) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
29 30 31 32 33 34 35 | #ifdef HAVE_XLOCALE_H # include <xlocale.h> #endif #include <sys/types.h> #import "OFString.h" | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #ifdef HAVE_XLOCALE_H # include <xlocale.h> #endif #include <sys/types.h> #import "OFString.h" #import "OFLocalization.h" #import "OFInitializationFailedException.h" #define MAX_SUBFORMAT_LEN 64 #ifndef HAVE_ASPRINTF /* |
︙ | ︙ | |||
558 559 560 561 562 563 564 | char *tmp2; @try { OFMutableString *tmpStr = [OFMutableString stringWithUTF8String: tmp length: tmpLen]; OFString *decimalPoint = | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | char *tmp2; @try { OFMutableString *tmpStr = [OFMutableString stringWithUTF8String: tmp length: tmpLen]; OFString *decimalPoint = [OFLocalization decimalPoint]; [tmpStr replaceOccurrencesOfString: decimalPoint withString: @"."]; if ([tmpStr UTF8StringLength] > INT_MAX) return false; tmpLen = (int)[tmpStr UTF8StringLength]; tmp2 = malloc(tmpLen); memcpy(tmp2, [tmpStr UTF8String], tmpLen); |
︙ | ︙ |