Parameters and interpolation
Interpolation of dynamic text and other markup is accomplished in the FBT framework via <fbt:param>
or fbt.param
:
These both extract to the same following text:
Tokens are delimited with the braces above and translations are expected to keep the same total token count and same token names for any given fbt
callsite.
Required attributes
- name
string
: Name of the token
Optional attributes
- gender
IntlVariations.GENDER_*
:- Pass the gender of the parameter for correctly variated text.
- number
number|true
:- Passing a value of type
number
into thenumber
option uses that value as the input for which we determine the CLDR plural value. - You can pass
true
to simply use the parameter value (the same value that replaces the token).
- Passing a value of type
fbt.name
<fbt:name>
is just a special form of fbt:param
that requires
that you pass in the gender for the interpolated variable.
Here, gender must be one of the 3 supported gender values in IntlVariations
:
Duplicate tokens
Tokens with the same name, but different values are prohibited in FBT.
If you want the same interpolation to show up, you must use
fbt:same-param
or fbt.sameParam
. This construct only takes a name
and no value, as the value to the first instance is re-used for the
second token.