Translating
The translate
script expects a JSON payload coming in from STDIN
that has FBT phrases
(just like those collected from collectFbt
)
alongside the relevant translations for a given locale.
In addition to the below example, the translation_input.json
provided in our GitHub demo
app
is a good reference on the "schema" used for the translations.
The <text_hash>
and <translation_hash>
correspond in the above example.
That is translations[<hash>]
is the translation entry for
phrases.hashToLeaf[<hash>]
.
Here tokens
, types
and variations
are all associative arrays. That is, in
the above example, types[i]
represents the variation type (or mask) of
tokens[i]
and variations[i]
is the variation value of token[i]
for the
given translation entry.
Variation types
Variation types can be one of
This signifies what the given token can variate on. Token types of type GENDER
can be:
while token types of NUMBER
can be: