ObjFW  Check-in [58c2a71294]

Overview
Comment:OFLocalization: Handle nil language / territory
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 58c2a71294166f66d2f938ede2887d1d6264e9477804bb33fe4bd6174506feec
User & Date: js on 2017-03-12 01:06:35
Other Links: manifest | tags
Context
2017-03-12
01:33
Fix using asprintf_l check-in: df2ee1f2f9 user: js tags: trunk
01:06
OFLocalization: Handle nil language / territory check-in: 58c2a71294 user: js tags: trunk
01:00
Fix setting shared localization for NULL locale check-in: f14a6e94e4 user: js tags: trunk
Changes

Modified src/OFLocalization.m from [8a3ceeca0d] to [4d020bd421].

142
143
144
145
146
147
148
149
150
151
152







153
154
155
156
157



158
159
160
161
162
163
164
	[_localizedStrings release];

	[super dealloc];
}

- (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) {







|
|
<
|
>
>
>
>
>
>
>
|
<



>
>
>







142
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159

160
161
162
163
164
165
166
167
168
169
170
171
172
	[_localizedStrings release];

	[super dealloc];
}

- (void)addLanguageDirectory: (OFString*)path
{
	void *pool;
	OFString *mapPath, *language, *territory, *languageFile;

	OFDictionary *map;

	if (_language == nil)
		return;

	pool = objc_autoreleasePoolPush();

	mapPath = [path stringByAppendingPathComponent: @"languages.json"];
	map = [[OFString stringWithContentsOfFile: mapPath] JSONValue];


	language = [_language lowercaseString];
	territory = [_territory lowercaseString];

	if (territory == nil)
		territory = @"";

	languageFile = [[map objectForKey: language] objectForKey: territory];
	if (languageFile == nil)
		languageFile = [[map objectForKey: language]
		    objectForKey: @""];

	if (languageFile == nil) {