How to use single quotes in i18n in Playframework2

2020-07-07 04:36发布

问题:

While working on a French app (french language is full of single quotes), I needed to use i18n with single quotes and many other accentuated chars.

So here is an extract of my messages.fr-FR file :

some.key=C'est la vie!

And here is the output :

Cest la vie!

How can I use strings containing single quotes in my messages? Already tried those :

some.key=C\'est la vie! --> C\est la vie!
some.key="C'est la vie!" --> "Cest la vie!"

EDIT : Thanks to the link KDavid gave I was able to find the solution. You have to double single-quote.

C''est la vie! --> C'est la vie!

回答1:

prefix the single quote with... single quote (so just use two single quotes):

some.key=C''est la vie!