Skip to content

Translation for Server-Side Messages #1587

Open
@oruburos

Description

@oruburos
  • Existing feature enhancement

Messages from server-side operations are not translated
For instance:

https://github.com/processing/p5.js-web-editor/blob/develop/server/controllers/user.controller.js#L60-L61

https://github.com/processing/p5.js-web-editor/blob/develop/server/controllers/user.controller.js#L147

https://github.com/processing/p5.js-web-editor/blob/develop/server/controllers/user.controller.js#L176

Feature enhancement details:

In order to not break the API, maybe introducing an extra field in the response to identify the string to display, and the field that triggers that response, and get the translation in the client, according to the language of the client.

For example , an extract from these lines
https://github.com/processing/p5.js-web-editor/blob/develop/server/controllers/user.controller.js#L102-L108


 if (user) {
      return res.json({
        exists: true,
        message: `This ${checkType} is already taken.`,
        type: checkType
      });
    }

would be


 if (user) {
      return res.json({
        exists: true,
        message: `This ${checkType} is already taken.`,
        messageKey: ServerTranslation.UserTaken,
        type: checkType
      });
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions