Differences From Artifact [0a1b003490]:
- File src/OFLocalization.m — part of check-in [4c8d02cc0d] at 2017-01-18 03:45:05 on branch trunk — Move parsing of encoding names to a single place (user: js, size: 6457) [annotate] [blame] [check-ins using]
To Artifact [b0fb42c722]:
- File
src/OFLocalization.m
— part of check-in
[0e82e3b843]
at
2017-02-27 22:04:21
on branch trunk
— OFLocalization: Don't lower language and territory
Instead, lowercase it before looking it up.
This allows getting the original values provided by setlocale(). (user: js, size: 6284) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
79 80 81 82 83 84 85 | return self; } locale = of_strdup(locale); @try { char *tmp; | < | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | return self; } locale = of_strdup(locale); @try { char *tmp; /* We don't care for extras behind the @ */ if ((tmp = strrchr(locale, '@')) != NULL) *tmp = '\0'; /* Encoding */ if ((tmp = strrchr(locale, '.')) != NULL) { |
︙ | ︙ | |||
104 105 106 107 108 109 110 | } } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { *tmp++ = '\0'; | < < < < | < < < < < | < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | } } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { *tmp++ = '\0'; _territory = [[OFString alloc] initWithCString: tmp encoding: OF_STRING_ENCODING_ASCII]; } _language = [[OFString alloc] initWithCString: locale encoding: OF_STRING_ENCODING_ASCII]; _decimalPoint = [[OFString alloc] initWithCString: localeconv()->decimal_point encoding: _encoding]; } @catch (id e) { [self release]; @throw e; |
︙ | ︙ | |||
155 156 157 158 159 160 161 | - (void)addLanguageDirectory: (OFString*)path { void *pool = objc_autoreleasePoolPush(); OFString *mapPath = [path stringByAppendingPathComponent: @"languages.json"]; OFDictionary *map = [[OFString stringWithContentsOfFile: mapPath] JSONValue]; | | > > > | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - (void)addLanguageDirectory: (OFString*)path { void *pool = objc_autoreleasePoolPush(); OFString *mapPath = [path stringByAppendingPathComponent: @"languages.json"]; OFDictionary *map = [[OFString stringWithContentsOfFile: mapPath] JSONValue]; OFString *language, *territory, *languageFile; language = [_language lowercaseString]; territory = [_territory lowercaseString]; languageFile = [[map objectForKey: language] objectForKey: territory]; if (languageFile == nil) languageFile = [[map objectForKey: language] objectForKey: @""]; if (languageFile == nil) { objc_autoreleasePoolPop(pool); return; } |
︙ | ︙ |