fbt.plural with showCount: 'no', other plurals will work
--react-native-mode enabled
Running yarn translate-fbts will throw with
yarn run v1.22.19
$ fbt-translate --translations translations/*.json --jenkins > src/translatedFbts.json
/Users/bumbu/Development/fbt/node_modules/nullthrows/nullthrows.js:9
throw error;
^
Error: Expect `token` to not be null as the metadata has variation mask.
at nullthrows (/Users/bumbu/Development/fbt/node_modules/nullthrows/nullthrows.js:7:15)
at new TranslationBuilder (/Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/translate/TranslationBuilder.js:109:23)
at /Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/bin/translateUtils.js:113:53
at Array.map (<anonymous>)
at processTranslations (/Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/bin/translateUtils.js:113:38)
at /Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/bin/translateUtils.js:46:12
at Array.map (<anonymous>)
at processFiles (/Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/bin/translateUtils.js:44:45)
at Object.<anonymous> (/Users/bumbu/Development/fbt/packages/babel-plugin-fbt/dist/bin/translate.js:147:15)
at Module._compile (node:internal/modules/cjs/loader:1254:14) {
framesToPop: 1
}
Node.js v18.16.0
To Reproduce
Steps to reproduce the behavior:
In demo-app/package.json add --react-native-mode to collect-fbts script
In Example.react.js add fbt(fbt.plural('has', 1, {many: 'have',showCount: 'no'}),'example')
Run
yarn install in main folder
yarn collect-fbts in demo-app
yarn translate-fbts in demo-app
Expected behavior
Should work
Issue
Running yarn collect-fbts will output following json:
And then inside of TranslationBuilder we expect that if manifest has a type, is should also have the token. Imho in this case the type shouldn't be added at all , so the issue is in the yarn collect-fbts step.
🐛 Bug Report
Only reproes with:
fbt.plural
withshowCount: 'no'
, other plurals will work--react-native-mode
enabledRunning
yarn translate-fbts
will throw withTo Reproduce
Steps to reproduce the behavior:
--react-native-mode
tocollect-fbts
scriptfbt(fbt.plural('has', 1, {many: 'have',showCount: 'no'}),'example')
yarn install
in main folderyarn collect-fbts
in demo-appyarn translate-fbts
in demo-appExpected behavior
Should work
Issue
Running
yarn collect-fbts
will output following json:And then inside of
TranslationBuilder
we expect that if manifest has a type, is should also have the token. Imho in this case the type shouldn't be added at all , so the issue is in theyarn collect-fbts
step.