I’ve been making a multilingual script.
I have made it to work perfectly, there’s an array with language variables. Each language has it’s own file with variables. Script decides which file to load based on language chosen by user.
This is what I have in each language file:
$lang = array();
$lang['var1'] = "Some text here";
$lang['var2'] = "Some text here";
...
$lang['var20'] = "Some text here";
Now i want to make it more dynamic and to include parameters.
I saw it in vBulletin language templates, there is something like this: text text text {1} text text text {2} text text.
I want this text: Hello {1}, this is the User CP. The parameter should be dynamic, different for each user.
How to do this?
It depends how you want to use it, but what you can do for example, is use
printforsprintffor the output:Languages file:
script that uses it: