[Rejected] Language variables with spritf keeps first value and all language vars.
#6
(2017-12-30, 09:44 PM)Whiteneo Wrote: Ok undestand so the right way is using vars instead lang vars

To be clear, there is nothing wrong with assigning values to new properties of the $lang object, but in cases where MyLanguage::sprintf is used, those variables (with the number placeholders, ie. {1}, {2}) should not be overwritten. Instead create a new (unused) property:

foreach ($things as $id => $thing) {
	$value1 = $thing->['property1'];
	$value2 = $thing->['property2'];

	$lang->new_key = $lang->sprintf($lang->existing_key_with_placeholders, $id, $value1, $value2);

	echo "<a href=\"url.com\">{$lang->new_key}</a>";
}

(2017-12-30, 09:44 PM)Whiteneo Wrote: Thanks for your time.

You're welcome. Smile
[retired]
Reply


Messages In This Thread
RE: Language variables with spritf keeps first value and all language vars. - by Wildcard - 2017-12-30, 10:00 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)