Add basic tests for PHP and JS Translators
Failing tests to demonstrate the discrepancy between JS and PHP translators.
Related issues: https://github.com/flarum/framework/issues/3702, https://github.com/flarum/framework/issues/3734, https://github.com/flarum/framework/issues/3685
Necessity
- [ ] Has the problem that is being solved here been clearly explained?
- [ ] If applicable, have various options for solving this problem been considered?
- [ ] For core PRs, does this need to be in core, or could it be in an extension?
- [ ] Are we willing to maintain this for years / potentially forever?
Confirmed
- [ ] Frontend changes: tested on a local Flarum installation.
- [ ] Backend changes: tests are green (run
composer test). - [ ] Core developer confirmed locally this works as intended.
- [ ] Tests have been added, or are not appropriate here.
Required changes:
- [ ] Related documentation PR: (Remove if irrelevant)
- [ ] Related core extension PRs: (Remove if irrelevant)
@askvortsov1 Is there any particular reason why https://www.npmjs.com/package/@ultraq/icu-message-formatter was chosen for ICU formatting? It seems to lack some basic features. I tested https://www.npmjs.com/package/format-message and https://www.npmjs.com/package/intl-messageformat and both looked more mature and reliable. And they have separate packages to parse message to token-like format - it could be used to handle rich-syntax support with less magic than current implementation, which relies on string operations on original message.
@askvortsov1 sorry for the second ping, but any chance you recall? I'd like to try to look into this before 1.8 is over
@askvortsov1 sorry for the second ping, but any chance you recall? I'd like to try to look into this before 1.8 is over
Hey, sorry, missed this one. Iirc, it came down to package size: the ultraq one is 6kb, vs 22kb and 28kb respectively. That being said, with the (broken) rich text changes, it comes out to ~10kb, and I don't know that there's a trivial fix. It would probably be worth it to switch to a more mature, widely-used package.