pebble icon indicating copy to clipboard operation
pebble copied to clipboard

i18n and multiline strings

Open dodalovic opened this issue 4 years ago • 3 comments

Hi, I'm enjoying so far using your lib! One thing I'm not sure about is if multiline values coming from resource bundles are supported? More specifically - will new lines be preserved? In my case this seems to fail.

When I define:

foo.bar=Hi,\
there\
\
how are\
\
you?

and evaluate the template, i get Hi,therehow areyou? evaluated. Any hint?

Thanks

dodalovic avatar Nov 14 '21 16:11 dodalovic

Did you try to set newLineTrimming to false ?

ebussieres avatar Nov 14 '21 16:11 ebussieres

private val engine: PebbleEngine = PebbleEngine.Builder().newLineTrimming(false).build()

I'm using that engine.

dodalovic avatar Nov 14 '21 17:11 dodalovic

Maybe some tests can be added to https://github.com/PebbleTemplates/pebble/blob/master/pebble/src/test/java/com/mitchellbosecke/pebble/I18nExtensionTest.java#L24

dodalovic avatar Nov 14 '21 17:11 dodalovic