You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user, i'd like to be able to give an argument when using useTranslation that will be injected into the translated string.
For exemple :
useTranslation("myTranslate1", player.name)
And in my json:
Fr > myTranslate1: "Bienvenue #### !",
En > myTranslate1: "Welcome #### !"
Even better, give a struct as an argument, and fill the translated strings with named properties, such as :
useTranslation("myTranslate1", {playerName: "Morphonet", level: 10});
And in my json:
Fr > myTranslate1: "Bienvenue {{playerName}} ! Oh, vous êtes déjà au niveau {{level}} ? Bien joué !"
En > myTranslate1: "Welcome {{playerName}} ! Oh, i see you're already level {{level}} ? Well done !"
The text was updated successfully, but these errors were encountered:
To be quite honest I haven't found a way to do this, but with the new Game Maker updates, you can do this again natively.
You can use your own string or string_ext functions.
For example:
In the translation files
Fr > myTranslate1: "Bienvenue {0} ! Oh, vous êtes déjà au niveau {1} ? Bien joué !"
En > myTranslate1: "Welcome {0} ! Oh, i see you're already level {1} ? Well done !"
This will cause it, before rendering the text, to take the information between keys to exchange with the array step as the second parameter of string_ext
I know it sounds like a bit of work, but using the native way I believe is the best way now.
And of course if I have any unmapped cases, I'll try to answer them or help out.
As a user, i'd like to be able to give an argument when using useTranslation that will be injected into the translated string.
For exemple :
useTranslation("myTranslate1", player.name)
And in my json:
Fr > myTranslate1: "Bienvenue #### !",
En > myTranslate1: "Welcome #### !"
Even better, give a struct as an argument, and fill the translated strings with named properties, such as :
useTranslation("myTranslate1", {playerName: "Morphonet", level: 10});
And in my json:
Fr > myTranslate1: "Bienvenue {{playerName}} ! Oh, vous êtes déjà au niveau {{level}} ? Bien joué !"
En > myTranslate1: "Welcome {{playerName}} ! Oh, i see you're already level {{level}} ? Well done !"
The text was updated successfully, but these errors were encountered: