Differences From Artifact [306b376984]:
- File src/OFLocalization.m — part of check-in [3d5b88d42e] at 2017-04-09 20:50:59 on branch trunk — Use LC_MESSAGES locale for messages (user: js, size: 6926) [annotate] [blame] [check-ins using]
To Artifact [39c2a63182]:
- File
src/OFLocalization.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 6941) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
78 79 80 81 82 83 84 | @synthesize decimalPoint = _decimalPoint; + (instancetype)sharedLocalization { return sharedLocalization; } | | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | @synthesize decimalPoint = _decimalPoint; + (instancetype)sharedLocalization { return sharedLocalization; } + (OFString *)language { return [sharedLocalization language]; } + (OFString *)territory { return [sharedLocalization territory]; } + (of_string_encoding_t)encoding { return [sharedLocalization encoding]; } + (OFString *)decimalPoint { return [sharedLocalization decimalPoint]; } #ifdef OF_HAVE_FILES + (void)addLanguageDirectory: (OFString *)path { [sharedLocalization addLanguageDirectory: path]; } #endif - init { |
︙ | ︙ | |||
159 160 161 162 163 164 165 | [_decimalPoint release]; [_localizedStrings release]; [super dealloc]; } #ifdef OF_HAVE_FILES | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | [_decimalPoint release]; [_localizedStrings release]; [super dealloc]; } #ifdef OF_HAVE_FILES - (void)addLanguageDirectory: (OFString *)path { void *pool; OFString *mapPath, *language, *territory, *languageFile; OFDictionary *map; if (_language == nil) return; |
︙ | ︙ | |||
199 200 201 202 203 204 205 | [_localizedStrings addObject: [[OFString stringWithContentsOfFile: languageFile] JSONValue]]; objc_autoreleasePoolPop(pool); } #endif | | | | | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | [_localizedStrings addObject: [[OFString stringWithContentsOfFile: languageFile] JSONValue]]; objc_autoreleasePoolPop(pool); } #endif - (OFString *)localizedStringForID: (OFConstantString *)ID fallback: (OFConstantString *)fallback, ... { OFString *ret; va_list args; va_start(args, fallback); ret = [self localizedStringForID: ID fallback: fallback arguments: args]; va_end(args); return ret; } - (OFString *)localizedStringForID: (OFConstantString *)ID fallback: (OFConstantString *)fallback arguments: (va_list)arguments { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); const char *UTF8String = NULL; size_t last, UTF8StringLength; int state = 0; |
︙ | ︙ | |||
281 282 283 284 285 286 287 | /* * We loop, as most of the time, we only have * one or maybe two variables, meaning looping * is faster than constructing a dictionary. */ va_copy(argsCopy, arguments); while ((name = va_arg(argsCopy, | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | /* * We loop, as most of the time, we only have * one or maybe two variables, meaning looping * is faster than constructing a dictionary. */ va_copy(argsCopy, arguments); while ((name = va_arg(argsCopy, OFConstantString *)) != nil) { id value = va_arg(argsCopy, id); if (value == nil) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ |