@@ -181,10 +181,16 @@ impl HelperDef for I18NHelper {
181
181
) ) ;
182
182
} ;
183
183
184
- let id = if let Some ( id) = id. path ( ) {
185
- id
184
+ if id. path ( ) . is_some ( ) {
185
+ return Err ( RenderError :: new (
186
+ "{{fluent}} takes a string parameter with no path" ,
187
+ ) ) ;
188
+ }
189
+
190
+ let id = if let Json :: String ( ref s) = * id. value ( ) {
191
+ s
186
192
} else {
187
- return Err ( RenderError :: new ( "{{fluent}} takes an identifier parameter" ) ) ;
193
+ return Err ( RenderError :: new ( "{{fluent}} takes a string parameter" ) ) ;
188
194
} ;
189
195
190
196
let mut args = if h. hash ( ) . is_empty ( ) {
@@ -219,17 +225,25 @@ impl HelperDef for I18NHelper {
219
225
block. name
220
226
) ) ) ;
221
227
}
228
+
222
229
let id = if let Some ( el) = block. params . get ( 0 ) {
223
- if let Parameter :: Name ( ref s) = * el {
224
- s
230
+ if let Parameter :: Literal ( ref s) = * el {
231
+ if let Json :: String ( ref s) = * s {
232
+ s
233
+ } else {
234
+ return Err ( RenderError :: new (
235
+ "{{fluentparam}} takes a string parameter" ,
236
+ ) ) ;
237
+ }
225
238
} else {
226
239
return Err ( RenderError :: new (
227
- "{{fluentparam}} takes an identifier parameter" ,
240
+ "{{fluentparam}} takes a string parameter" ,
228
241
) ) ;
229
242
}
230
243
} else {
231
244
return Err ( RenderError :: new ( "{{fluentparam}} must have one parameter" ) ) ;
232
245
} ;
246
+
233
247
if let Some ( ref tpl) = block. template {
234
248
let mut s = StringOutput :: default ( ) ;
235
249
tpl. render ( reg, context, rcx, & mut s) ?;
0 commit comments