File tree 1 file changed +7
-3
lines changed
src/Nager.Country.Translation
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
namespace Nager . Country . Translation
5
5
{
6
+ /// <summary>
7
+ /// CountryProvider Extension
8
+ /// </summary>
6
9
public static class CountryProviderExtension
7
10
{
11
+ private static readonly Lazy < TranslationProvider > TranslationProvider = new Lazy < TranslationProvider > ( ) ;
12
+
8
13
///<inheritdoc/>
9
14
public static ICountryInfo GetCountryByNameConsiderTranslation (
10
15
this ICountryProvider countryProvider ,
@@ -24,9 +29,8 @@ public static ICountryInfo GetCountryByNameConsiderTranslation(
24
29
return country ;
25
30
}
26
31
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 ) ) )
30
34
{
31
35
return country ;
32
36
}
You can’t perform that action at this time.
0 commit comments