Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.


Sign Up

Articles related to "logic"


Using MessageFormat with Transloco

  • Doing this every time we need to handle plurals and genders can get tedious, to the point we may put these into their own methods or services to reuse them.
  • No. Rather, we should let our translation files handle this for us!
  • I recently made a PR to the Transloco library to add support for messageformat.
  • This should install the required packages and scaffold the required files for Transloco to function.
  • This will allow Transloco to correctly interpret messageformat formatted strings in your translation files.
  • As you can see from above, using the MessageFormatTranspiler with Transloco can drastically reduce the amount of logic in your codebase around grammar relating to pluralization and genders.
  • These translations can be added, removed and maintained without affecting the business logic of your application!

save | comments | report | share on