feat: added utility methods

This commit is contained in:
Jonathan Barrow 2024-05-01 17:12:49 -04:00
commit 6df3a240c7
No known key found for this signature in database
GPG key ID: E86E9FE9049C741F
2 changed files with 86 additions and 1 deletions

View file

@ -71,4 +71,11 @@ Each file starts with 1 or 2 objects, each with 1 key each. The first object key
| `long_description` | A longer, more detailed, description of the error. Intended to be used by the website. Markdown |
| `short_solution` | A short solution for the error. Intended to be used by the Discord bot. Plain text |
| `long_solution` | A longer, more detailed, solution for the error. Intended to be used by the website. Markdown |
| `support_link` | Link to a relevant support page for the error. Typically the website, but does not have to be |
| `support_link` | Link to a relevant support page for the error. Typically the website, but does not have to be |
### Utility functions
The main purpose of this repository is to maintain the JSON translation files. However 2 utility functions are also included for JavaScript/TypeScript projects.
- `getModuleInfo(sysmodule, locale)` - Returns the module information for the locale, or `null` if not found
- `getErrorInfo(sysmodule, code, locale)` - Returns the error information (including the module information) for the locale. Returns null if either the module or error code is not found
- `getAllErrors()` - Returns an array of all error codes for all modules in the form `MODULE-CODE`