-
-
Notifications
You must be signed in to change notification settings - Fork 142
[Feature]: Translate game log and move it clientside #1213
Copy link
Copy link
Open
Labels
backendRequires changes to the (node) backend webserverRequires changes to the (node) backend webserverenhancementNew feature or requestNew feature or requestfrontendRequires changes to the frontend (vue) clientRequires changes to the frontend (vue) clientinternationalizationTranslation of content into multiple languagesTranslation of content into multiple languagesversion-minorAn update that warrants a bumping the project's minor version (e.g. 4.0.0 => 4.1.0)An update that warrants a bumping the project's minor version (e.g. 4.0.0 => 4.1.0)
Description
Activity
Metadata
Metadata
Assignees
Labels
backendRequires changes to the (node) backend webserverRequires changes to the (node) backend webserverenhancementNew feature or requestNew feature or requestfrontendRequires changes to the frontend (vue) clientRequires changes to the frontend (vue) clientinternationalizationTranslation of content into multiple languagesTranslation of content into multiple languagesversion-minorAn update that warrants a bumping the project's minor version (e.g. 4.0.0 => 4.1.0)An update that warrants a bumping the project's minor version (e.g. 4.0.0 => 4.1.0)
Feature Summary
We should internationalize the game log/history so that players can read it in their preferred language
Detailed Description
Currently the game log is generated serverside via the helper
api/helpers/game-states/get-log.jswhich creates a log entry (text) for every GameState in a given game. It appears like this:Because the text is generated serverside and translation is only managed on the client, the text can't be translated as it currently stands. We should update the
src/stores/gameHistory.jsstore'slogcomputed property so that instead of just reading from the existinglogproperty in thegamestore, it actually parses thepriorGameStatesexecuting the same computation as the current serversideget-log.jshelper except formatting it in a way that allows for internationalization.In order to work properly, the translated logs will need to be parameterized to accept different cards, players, or whatever variables are read by the log. This would most likely work best by having the
gameHistorystore directly utilize thet()function fromvue18nto translate the text so the returnedlogcomputed property is the pre-translated text. It could work roughly like thisAnd then in the language files e.g. en.json
We should then delete
api/helpers/game-states/get-logand clean up its usages once this is moved clientside, removing it from the generated socket event etc.See the vue-i18n docs and the existing get-log implementation for further details