Overview
Comment: | OFLocalization: Don't lower language and territory
Instead, lowercase it before looking it up. This allows getting the original values provided by setlocale(). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0e82e3b843e7f6ba14bdd49ffb04e988 |
User & Date: | js on 2017-02-27 22:04:21 |
Other Links: | manifest | tags |
Context
2017-03-12
| ||
00:31 | configure: Check if assert is buggy with -pedantic check-in: 7d9ac574a8 user: js tags: trunk | |
2017-02-27
| ||
22:04 | OFLocalization: Don't lower language and territory check-in: 0e82e3b843 user: js tags: trunk | |
21:57 | ofhttp: Move formatting out of localized strings check-in: 7ffbd24169 user: js tags: trunk | |
Changes
Modified src/OFLocalization.m from [0a1b003490] to [b0fb42c722].
︙ | ︙ | |||
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; } |
︙ | ︙ |