Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Turkish locale, fields starting with the character "i" are lost #309

Open
sham0688 opened this issue Oct 7, 2024 · 0 comments
Open

Comments

@sham0688
Copy link

sham0688 commented Oct 7, 2024

Not repeated in other locales.
In Turkish locale, the @JvmField annotation can be used as a workaround.

Kotlin JUnit example:

data class Pizza(
    //@JvmField
    val ingredients: String,
    //@JvmField
    val sauces: String,
)

@Test
fun testMustacheInTurkishLocale() {
    Locale.setDefault(Locale("tr", "TR"))
    val factory = DefaultMustacheFactory()
    val ingredients = "cheese, pepperoni"
    val sauces = "tomato"
    val template = "pizza: ingredients: {{ingredients}}; sauces: {{sauces}}."
    val mustache = ByteArrayInputStream(template.toByteArray()).use { input ->
        factory.compile(input.bufferedReader(), "template_name")
    }
    val pizza = Pizza(ingredients, sauces)
    val actual = ByteArrayOutputStream().use { out ->
        PrintWriter(out).use { writer ->
            mustache.execute(writer, pizza)
        }
        String(out.toByteArray(), Charsets.UTF_8)
    }
    println(actual)
    val expected = "pizza: ingredients: $ingredients; sauces: $sauces."
    assertEquals(expected, actual)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant