[SOLVED] Localization at Runtime

Good morning everyone!

I’ve made it to the point in my project that I need to create a workable solution for localization. There are a large number of text pieces that will need to be both translatable and dynamically editable in the portal I have built to house all of the content in the project.

At first I considered writing a generic script and attaching it to my text elements that would individually pull the text values from the server, but that could mean dozens of GET requests pinging the server.

Now I’m thinking that I could have the server generate a JSON response with all of the translatable text and use the response as the asset for localization within Playcanvas.

Would this work? Or does the asset have to be an actual .json file?

You can add the localisation data via https://api.playcanvas.com/classes/Engine.I18n.html#addData

The param has to be a JSON object. How it gets to be a JSON object is up to you :slight_smile:


This is perfect!

I unfortunately overlooked that piece of the documentation. Knowing this, I think I will go forward with this plan.