comahe-de / i18n4k

Internationalization for Kotlin
Apache License 2.0
78 stars 9 forks source link

Percent symbols % cannot be included in messages #53

Closed mzach99 closed 10 months ago

mzach99 commented 10 months ago

Since the % symbol is used for message formatting, there doesn't seem to be a way to include it as a literal character in a message. I tried adding a backslash to escape the character, but it was still interpreted as a formatter.

comahe-de commented 10 months ago

Hi @mzach99,

I cannot reproduce your problem. A "%" is shown when added to a text file in one of the example projects. In general curly braces are used for message formatting, not "%".

Can you give me an example, where it does not work?

mzach99 commented 10 months ago

@comahe-de Which example project includes messages containing a % symbol? I looked through the .properties files of the example projects and didn't see any.

If I include a % in one of the messages of my properties file, the generateI18n4kFiles Gradle task gives me the following error:

Cause: index 1 for '%#' not in range (received 0 arguments)

Here's the offending line in my properties file:

LOGIN_BUTTON=Log In %## Button text.

Do you know why this is the case?

mzach99 commented 10 months ago

@comahe-de Sorry, please disregard! I was on 0.6.0, but it looks like this issue was fixed in 0.6.1.