Server-Side Kotlin with Ktor · Challenge: About Template | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2885892-server-side-kotlin-with-ktor/lessons/15

Hi Joe! I have a few questions on localization. What is the best/suggested way to localize a Ktor web app? Using standard java properties files are good enough or is there some more “kotliner” way? And what if my client has localized texts in backend database to be able to upgrade them on his own anytime he wants? Is it a good idea to fetch localized texts from DB through Exposed and MySql when the app is starting? Is there “application context” or something similar in Ktor where I can save my application wide data (e.g. translations of all supported languages)?

Thanks for the question, @zsoltkiss!

I don’t see anything in the Ktor docs specific to localization or application context. I’d probably start looking at localization at the template level, for example like this with FreeMarker:

https://freemarker.apache.org/docs/ref_directive_include.html#ref_directive_include_localized

And trying standard Java ways of resource localization sounds like a good option too.

We’ll try and investigate this in a future course, but in the meantime let us know here if you find any more info on this. Thanks again!