@@ -25,6 +25,8 @@ private record StringResourceItems(string Language, IEnumerable<StringResourceIt
2525
2626 private string stringResourcesFileXPath = "//root/data" ;
2727
28+ private ILogger ? logger ;
29+
2830 public static bool IsLocalizerAlreadyBuilt => Localizer . Get ( ) is Localizer ;
2931
3032 public LocalizerBuilder SetDefaultStringResourcesFileName ( string fileName )
@@ -41,13 +43,12 @@ public LocalizerBuilder SetStringResourcesFileXPath(string xPath)
4143
4244 public LocalizerBuilder SetLogger ( ILogger < Localizer > logger )
4345 {
44- Logger = logger ;
46+ this . logger = logger ;
4547 return this ;
4648 }
4749
4850 public LocalizerBuilder AddStringResourcesFolderForLanguageDictionaries (
4951 string stringResourcesFolderPath ,
50- string resourcesFileName = "Resources.resw" ,
5152 bool ignoreExceptions = false )
5253 {
5354 this . builderActions . Add ( ( ) =>
@@ -63,15 +64,15 @@ public LocalizerBuilder AddStringResourcesFolderForLanguageDictionaries(
6364 ? string . Empty
6465 : Path . GetFileNameWithoutExtension ( fileName ) ;
6566
66- if ( CreateLanguageDictionaryFromStringResourcesFile (
67+ if ( CreateLanguageDictionaryFromStringResourcesFile (
6768 sourceName ,
6869 stringResourcesFileFullPath ,
6970 this . stringResourcesFileXPath ) is LanguageDictionary dictionary )
70- {
71- this . languageDictionaries . Add ( dictionary ) ;
71+ {
72+ this . languageDictionaries . Add ( dictionary ) ;
73+ }
7274 }
7375 }
74- }
7576 catch
7677 {
7778 if ( ignoreExceptions is false )
@@ -108,15 +109,15 @@ public async Task<ILocalizer> Build()
108109 if ( IsLocalizerAlreadyBuilt is true )
109110 {
110111 LocalizerIsAlreadyBuiltException localizerException = new ( ) ;
111- Logger ? . LogError ( localizerException , localizerException . Message ) ;
112+ this . logger ? . LogError ( localizerException , localizerException . Message ) ;
112113 throw localizerException ;
113114 }
114115
115116 Localizer localizer = new ( this . options ) ;
116117
117- if ( Logger is not null )
118+ if ( this . logger is not null )
118119 {
119- localizer . SetLogger ( Logger ) ;
120+ localizer . SetLogger ( this . logger ) ;
120121 }
121122
122123 foreach ( Action action in this . builderActions )
0 commit comments