@@ -78,21 +78,21 @@ protected static bool ConvertJTokenToBool(string token, IGeneratedSymbolConfig c
7878 var jToken = JToken . Parse ( token ) ;
7979 if ( jToken . Type is not JTokenType . Boolean and not JTokenType . String )
8080 {
81- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be a boolean value." , config . VariableName ) ;
81+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeBoolean , config . VariableName , parameterName ) , config . VariableName ) ;
8282 }
8383 if ( bool . TryParse ( jToken . ToString ( ) , out bool result ) )
8484 {
8585 return result ;
8686 }
87- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be a boolean value." , config . VariableName ) ;
87+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeBoolean , config . VariableName , parameterName ) , config . VariableName ) ;
8888 }
8989 catch ( TemplateAuthoringException )
9090 {
9191 throw ;
9292 }
9393 catch ( Exception ex )
9494 {
95- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' is not a valid JSON." , config . VariableName , ex ) ;
95+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_InvalidJSON , config . VariableName , parameterName ) , config . VariableName , ex ) ;
9696 }
9797 }
9898
@@ -103,21 +103,21 @@ protected static int ConvertJTokenToInt(string token, IGeneratedSymbolConfig con
103103 var jToken = JToken . Parse ( token ) ;
104104 if ( jToken . Type is not JTokenType . Integer and not JTokenType . String )
105105 {
106- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be an integer." , config . VariableName ) ;
106+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeInteger , config . VariableName , parameterName ) , config . VariableName ) ;
107107 }
108108 if ( int . TryParse ( jToken . ToString ( ) , out int result ) )
109109 {
110110 return result ;
111111 }
112- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be an integer." , config . VariableName ) ;
112+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeInteger , config . VariableName , parameterName ) , config . VariableName ) ;
113113 }
114114 catch ( TemplateAuthoringException )
115115 {
116116 throw ;
117117 }
118118 catch ( Exception ex )
119119 {
120- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' is not a valid JSON." , config . VariableName , ex ) ;
120+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_InvalidJSON , config . VariableName , parameterName ) , config . VariableName , ex ) ;
121121 }
122122 }
123123
@@ -128,7 +128,7 @@ protected static string ConvertJTokenToString(string token, IGeneratedSymbolConf
128128 var jToken = JToken . Parse ( token ) ;
129129 if ( jToken . Type != JTokenType . String )
130130 {
131- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be a string." , config . VariableName ) ;
131+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeString , config . VariableName , parameterName ) , config . VariableName ) ;
132132 }
133133 return jToken . ToString ( ) ;
134134 }
@@ -138,7 +138,7 @@ protected static string ConvertJTokenToString(string token, IGeneratedSymbolConf
138138 }
139139 catch ( Exception ex )
140140 {
141- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' is not a valid JSON." , config . VariableName , ex ) ;
141+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_InvalidJSON , config . VariableName , parameterName ) , config . VariableName , ex ) ;
142142 }
143143 }
144144
@@ -149,7 +149,7 @@ protected static JArray ConvertJTokenToJArray(string token, IGeneratedSymbolConf
149149 var jToken = JToken . Parse ( token ) ;
150150 if ( jToken . Type != JTokenType . Array )
151151 {
152- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' should be a JSON array." , config . VariableName ) ;
152+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_ValueShouldBeArray , config . VariableName , parameterName ) , config . VariableName ) ;
153153 }
154154 return ( JArray ) jToken ;
155155 }
@@ -159,7 +159,7 @@ protected static JArray ConvertJTokenToJArray(string token, IGeneratedSymbolConf
159159 }
160160 catch ( Exception ex )
161161 {
162- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ': ' { parameterName } ' is not a valid JSON." , config . VariableName , ex ) ;
162+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_InvalidJSON , config . VariableName , parameterName ) , config . VariableName , ex ) ;
163163 }
164164 }
165165
@@ -173,7 +173,7 @@ protected static void IsValidRegex(string regex, IGeneratedSymbolConfig? generat
173173 {
174174 if ( generatedSymbolConfig is not null )
175175 {
176- throw new TemplateAuthoringException ( $ "Generated symbol ' { generatedSymbolConfig . VariableName } ': the pattern ' { regex } ' is invalid." , generatedSymbolConfig . VariableName ) ;
176+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_InvalidRegex , generatedSymbolConfig . VariableName , regex ) , generatedSymbolConfig . VariableName ) ;
177177 }
178178 else
179179 {
@@ -186,7 +186,7 @@ protected string GetMandatoryParameterValue(IGeneratedSymbolConfig config, strin
186186 {
187187 if ( ! config . Parameters . TryGetValue ( parameterName , out string token ) )
188188 {
189- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ' of type ' { Type } ' should have ' { parameterName } ' property defined." ) ;
189+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_MissingMandatoryProperty , config . VariableName , Type , parameterName ) , config . VariableName ) ;
190190 }
191191 return ConvertJTokenToString ( token , config , parameterName ) ;
192192 }
@@ -195,7 +195,7 @@ protected TVal GetMandatoryParameterValue<TVal>(IGeneratedSymbolConfig config, s
195195 {
196196 if ( ! config . Parameters . TryGetValue ( parameterName , out string token ) )
197197 {
198- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ' of type ' { Type } ' should have ' { parameterName } ' property defined." ) ;
198+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_MissingMandatoryProperty , config . VariableName , Type , parameterName ) , config . VariableName ) ;
199199 }
200200 return converter ( token , config , parameterName ) ;
201201 }
@@ -204,7 +204,7 @@ protected JArray GetMandatoryParameterArray(IGeneratedSymbolConfig config, strin
204204 {
205205 if ( ! config . Parameters . TryGetValue ( parameterName , out string token ) )
206206 {
207- throw new TemplateAuthoringException ( $ "Generated symbol ' { config . VariableName } ' of type ' { Type } ' should have ' { parameterName } ' property defined." ) ;
207+ throw new TemplateAuthoringException ( string . Format ( LocalizableStrings . MacroConfig_Exception_MissingMandatoryProperty , config . VariableName , Type , parameterName ) , config . VariableName ) ;
208208 }
209209 return ConvertJTokenToJArray ( token , config , parameterName ) ;
210210 }
0 commit comments