File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/Nager.Country.Translation Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 33
44namespace Nager . Country . Translation
55{
6+ /// <summary>
7+ /// CountryProvider Extension
8+ /// </summary>
69 public static class CountryProviderExtension
710 {
11+ private static readonly Lazy < TranslationProvider > TranslationProvider = new Lazy < TranslationProvider > ( ) ;
12+
813 ///<inheritdoc/>
914 public static ICountryInfo GetCountryByNameConsiderTranslation (
1015 this ICountryProvider countryProvider ,
@@ -24,9 +29,8 @@ public static ICountryInfo GetCountryByNameConsiderTranslation(
2429 return country ;
2530 }
2631
27- var translationProvider = new TranslationProvider ( ) ;
28- var countryTranslation = translationProvider . GetCountryTranslation ( country . Alpha2Code ) ;
29- if ( countryTranslation . Translations . Any ( translation => translation . Name . Equals ( countryName , StringComparison . OrdinalIgnoreCase ) ) )
32+ var countryTanslation = TranslationProvider . Value . GetCountryTranslation ( country . Alpha2Code ) ;
33+ if ( countryTanslation . Translations . Any ( translation => translation . Name . Equals ( countryName , StringComparison . OrdinalIgnoreCase ) ) )
3034 {
3135 return country ;
3236 }
You can’t perform that action at this time.
0 commit comments