Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate strings in a strings.json file #33

Open
carlos3g opened this issue Jul 22, 2021 · 1 comment
Open

Isolate strings in a strings.json file #33

carlos3g opened this issue Jul 22, 2021 · 1 comment
Assignees
Labels
Improve Improve some feature Needs: triage This issue is still been discussing

Comments

@carlos3g
Copy link
Member

carlos3g commented Jul 22, 2021

Currently, the messages that must be returned to the end user are inserted directly into the code (see an example here). It is necessary to separate these strings in a .json file. Basically, the schema for this file should look something like the following:

{
  // ...
  commands: {
    // ...
  }
}
  • Any string that is NOT returned by a command must be outside commands key.
  • The commands has an object like value. The keys and values inside this object must be, respectively, the name of the correspondent command and an object with the strings.

Notes:

  1. The strings inside this file must be only strings returned to the end user. For example, strings passed to Error instances mustn't be in this file.
  2. This file must ONLY be modified programmatically.
  3. When importing this file, the const it will be attributed to must be uppercased. See the following example:
const STRINGS = JSON.parse(require('./strings.json'));

function sendMessageToUser() {
  return STRINGS.welcomeNewUser;
}
@carlos3g carlos3g added the Improve Improve some feature label Jul 22, 2021
@carlos3g carlos3g self-assigned this Jul 22, 2021
@carlos3g
Copy link
Member Author

I think this solution wouldn't be so legible, so I'm looking for another solution. Wait for any updates or give us your opinion

@matheusfelipeog matheusfelipeog added the hacktoberfest Indicates that it is valid to participate in the hacktoberfest label Oct 2, 2021
@carlos3g carlos3g added Needs: triage This issue is still been discussing and removed hacktoberfest Indicates that it is valid to participate in the hacktoberfest labels Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improve Improve some feature Needs: triage This issue is still been discussing
Projects
None yet
Development

No branches or pull requests

2 participants