internationalization - How should I handle a template string in Xtext? -
i have following input:
a: "a {foo foo}"
where foo
of type foo
; business layer provide value variable. after processing input, 2 files generated: properties file , java class:
a=a {0} public static i18nmessage a( foo foo ) { return new i18nmessagebuilder().id( "a" ).args( foo ).build(); }
the idea assign each message id gives me java class contains methods (where name == id) , accepts typed parameters complete messages.
my question: how should handle text strings in xtext grammar? have code completion parameter types (foo
) have no idea how handle rest of string can contain spaces , valid unicode character.
suggestions?
i found better solution gives pretty simple grammar , solves other problems:
a(foo foo): "a " foo;
so text message list of strings , parameters. way, code completion simple , there no need escape sequences if want add formatters:
a(date d): "date " d( "short" );
Comments
Post a Comment