@@ -350,7 +350,13 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
350350 IEnumerable < XElement > areas = xmlSource [ cult ] . Value . XPathSelectElements ( "//area" ) ;
351351 foreach ( XElement area in areas )
352352 {
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+
354360 IEnumerable < XElement > keys = area . XPathSelectElements ( "./key" ) ;
355361 foreach ( XElement key in keys )
356362 {
@@ -364,7 +370,10 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
364370 }
365371 }
366372
367- overallResult . Add ( area . Attribute ( "alias" ) ! . Value , result ) ;
373+ if ( ! overallResult . ContainsKey ( areaAlias ) )
374+ {
375+ overallResult . Add ( areaAlias , result ) ;
376+ }
368377 }
369378
370379 // Merge English Dictionary
@@ -374,11 +383,11 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
374383 IEnumerable < XElement > enUS = xmlSource [ englishCulture ] . Value . XPathSelectElements ( "//area" ) ;
375384 foreach ( XElement area in enUS )
376385 {
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 ) )
380389 {
381- result = overallResult [ area . Attribute ( "alias" ) ! . Value ] ;
390+ result = new Dictionary < string , string > ( StringComparer . InvariantCulture ) ;
382391 }
383392
384393 IEnumerable < XElement > keys = area . XPathSelectElements ( "./key" ) ;
@@ -394,9 +403,9 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
394403 }
395404 }
396405
397- if ( ! overallResult . ContainsKey ( area . Attribute ( "alias" ) ! . Value ) )
406+ if ( ! overallResult . ContainsKey ( areaAlias ) )
398407 {
399- overallResult . Add ( area . Attribute ( "alias" ) ! . Value , result ) ;
408+ overallResult . Add ( areaAlias , result ) ;
400409 }
401410 }
402411 }
0 commit comments