Lots of php ngettext variables
Copying the example from the manual , ngettext works like this:
ngettext("%d window", "%d windows", 1); //'1 window';
ngettext("%d window", "%d windows", 2); //'2 windows';
But what if I want to use 2 variables for example %d windows %d doors
? Is there a standard way to implement this so that the correct string (4 combinations) appears based on two variables?
source to share
ngettext()
does not support multiple variables. You should make sure to write sentences that can be correctly translated by the block block (multiple sentences if possible to avoid language-specific ordering issues).
At least one of the reasons why this is not supported is that the number of required fallback clauses (first parameters ngettext()
) will grow exponentially with the number of variables (i.e. you need 4 such clauses for two variables: singular, singular , plural and plural, then 8 for three variables, etc.).
You will find the answer to a similar question in fooobar.com/questions/639908 / ... .
source to share