vendredi 30 juillet 2021

Internationalization in Ktor based website

I'm new to Ktor and Kotlin in general, so please be patient.

I am currently trying to create a little website (mostly for learning) that uses key-value files for internationalization.

I already did something similar in PHP where I just decoded a JSON file and got the value related to the key I passed. This way, I could do something as <p><?php echo $langJson["presentation"][0];?></p> (with $langJson being my json key-value file) so that I would get the proper translation.

I'm trying to do an equivalent in Kotlin using Ktor, but I don't know how to do it. I found the aymanizz ktor-i18n plugin on GitHub that allows to use i18n for internationalization but I don't know if it is really adapted to what I want to do since it detects the language in the header instead of it being chose by the user (with _GET for instance).

Does anyone have any clue on how I could do that?

Briefly, what I want to do is having a single coded page where the content is dynamicly chosen from the accurate language file.

Thank you all! :)




Aucun commentaire:

Enregistrer un commentaire