cuttle
cuttle copied to clipboard
translate error messages in GameState API
Issue number
Relevant issue number
- Resolves # 1094
Please check the following
- [x] Do the tests still pass? (see Run the Tests)
- [x] Is the code formatted properly? (see Linting (Formatting))
- For New Features:
- [/] Have tests been added to cover any new features or fixes?
- [/] Has the documentation been updated accordingly?
Please describe additional details for testing this change
- i didn't know how to manually test the changes, so i'm relying on the existing tests
- i used claude to create translations, which i know are not perfect
- some error messages included string interpolation, and i didn't see any examples in the existing API via sails (only in vue), so i'm assuming eg.
return exits.error(sails.__('game.other.errorUnpackCards', {message: err.message} ))is correct - in the past with translation keys, i've just used a totally flat document structure. rather than make assumptions about how the keys should be organized, i mostly dumped them into an "other" category
- line 96 of
api/helpers/game-states/validate-gamestate.jsappears to be a catch-all error handler? and would be untranslated
i got a little hung up on the fact that i didn't actually test the changes i made, i just hoped that the pattern in the codebase makes sense. but now, revisiting what you're proposing:
i'm not sure how much we'd have to do to pass parameters and keys to vue-i18n, but overall i think it's not worth it. a few strings that are either in english with parameters or are translated but lack parameters is a fine solution until users start complaining.
@casens5 Are you still interested in finishing this one up?