@@ -350,7 +350,13 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
350
350
IEnumerable < XElement > areas = xmlSource [ cult ] . Value . XPathSelectElements ( "//area" ) ;
351
351
foreach ( XElement area in areas )
352
352
{
353
- var result = new Dictionary < string , string > ( StringComparer . InvariantCulture ) ;
353
+ var areaAlias = area . Attribute ( "alias" ) ! . Value ;
354
+
355
+ if ( ! overallResult . TryGetValue ( areaAlias , out IDictionary < string , string > ? result ) )
356
+ {
357
+ result = new Dictionary < string , string > ( StringComparer . InvariantCulture ) ;
358
+ }
359
+
354
360
IEnumerable < XElement > keys = area . XPathSelectElements ( "./key" ) ;
355
361
foreach ( XElement key in keys )
356
362
{
@@ -364,7 +370,10 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
364
370
}
365
371
}
366
372
367
- overallResult . Add ( area . Attribute ( "alias" ) ! . Value , result ) ;
373
+ if ( ! overallResult . ContainsKey ( areaAlias ) )
374
+ {
375
+ overallResult . Add ( areaAlias , result ) ;
376
+ }
368
377
}
369
378
370
379
// Merge English Dictionary
@@ -374,11 +383,11 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
374
383
IEnumerable < XElement > enUS = xmlSource [ englishCulture ] . Value . XPathSelectElements ( "//area" ) ;
375
384
foreach ( XElement area in enUS )
376
385
{
377
- IDictionary < string , string >
378
- result = new Dictionary < string , string > ( StringComparer . InvariantCulture ) ;
379
- if ( overallResult . ContainsKey ( area . Attribute ( "alias" ) ! . Value ) )
386
+ var areaAlias = area . Attribute ( "alias" ) ! . Value ;
387
+
388
+ if ( ! overallResult . TryGetValue ( areaAlias , out IDictionary < string , string > ? result ) )
380
389
{
381
- result = overallResult [ area . Attribute ( "alias" ) ! . Value ] ;
390
+ result = new Dictionary < string , string > ( StringComparer . InvariantCulture ) ;
382
391
}
383
392
384
393
IEnumerable < XElement > keys = area . XPathSelectElements ( "./key" ) ;
@@ -394,9 +403,9 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
394
403
}
395
404
}
396
405
397
- if ( ! overallResult . ContainsKey ( area . Attribute ( "alias" ) ! . Value ) )
406
+ if ( ! overallResult . ContainsKey ( areaAlias ) )
398
407
{
399
- overallResult . Add ( area . Attribute ( "alias" ) ! . Value , result ) ;
408
+ overallResult . Add ( areaAlias , result ) ;
400
409
}
401
410
}
402
411
}
0 commit comments