Auto-parameterization
What is Auto Parameterization?
The basics
<fbt>
will automatically wrap any non-fbt children in the top-level
<fbt>
as though they were written with an <fbt:param>
with a
name
attribute containing the child's text. It will pull any child
text into the parameter name, including those of recursive structures.
- HTML fbt syntax:
- Function syntax:
When extracted for translation, the result of the \fbt\Transform\FbtTransform\FbtTransform::toArray()
is:
Notice the description for "vacation" is auto-generated with an "In
the phrase: ..."
prefix. Additionally, we use a convention of adding an equal sign (=
)
prefix in the interpolation {=awesome vacation}
to signal to the
translator that this exact word or phrase goes in the associated outer
sentence.
Furthermore, we provide a mapping [<childIndex> => <parentIndex>]
in
the collection output childParentMappings
. At Meta, we use
these to display all relevant inner and outer strings when translating
any given piece of text. We recommend you do the same in whatever
translation framework you use. Context is crucial for accurate
translations.