Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make slash command errors translatable but also work in rageshakes #7377

Merged
merged 22 commits into from
Jan 11, 2022

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Dec 15, 2021

Make slash command errors translatable but also work in rageshakes. We want the error to be translated for the user but not in our rageshake logs.

Also updates some error messages to give more info.

Follow-up to #7372 (comment)

Depends on matrix-org/matrix-web-i18n#3


This change is marked as an internal change (Task), so will not be included in the changelog.

Preview: https://61dd2f2fc259a9b4046f3e88--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

@MadLittleMods MadLittleMods requested a review from a team as a code owner December 15, 2021 12:38
@MadLittleMods MadLittleMods removed the request for review from a team December 15, 2021 12:40
@MadLittleMods MadLittleMods added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Dec 15, 2021
src/SlashCommands.tsx Outdated Show resolved Hide resolved
@MadLittleMods MadLittleMods changed the title Draft: Make slash command errors translatable but also work in rageshakes Make slash command errors translatable but also work in rageshakes Dec 15, 2021
src/SlashCommands.tsx Show resolved Hide resolved
src/SlashCommands.tsx Outdated Show resolved Hide resolved
src/SlashCommands.tsx Show resolved Hide resolved
MadLittleMods added a commit to MadLittleMods/matrix-web-i18n that referenced this pull request Dec 16, 2021
…json

See matrix-org/matrix-react-sdk#7377 (comment)

`package.json`:
```json
{
  // ...
  "matrix_i18n_extra_translation_funcs": [
    "newTranslatableError"
  ]
  // ...
}
```
MadLittleMods added a commit to matrix-org/matrix-web-i18n that referenced this pull request Jan 11, 2022
…json (#3)

See matrix-org/matrix-react-sdk#7377 (comment)

`package.json`:
```json
{
  // ...
  "matrix_i18n_extra_translation_funcs": [
    "newTranslatableError"
  ]
  // ...
}
```
@MadLittleMods MadLittleMods requested review from t3chguy and removed request for t3chguy January 11, 2022 07:15
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

@@ -53,9 +53,9 @@ interface ITranslatableError extends Error {
* @param {string} message Message to translate.
* @returns {Error} The constructed error.
*/
export function newTranslatableError(message: string) {
export function newTranslatableError(message: string, variables?: IVariables): ITranslatableError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we should shorten this to match other funcs, maybe _tError or similar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_tError seems reasonable 👍 but I'll leave that taste making to you for another PR

@MadLittleMods MadLittleMods merged commit 038a6bc into develop Jan 11, 2022
@MadLittleMods MadLittleMods deleted the madlittlemods/translatable-slash-command-errors branch January 11, 2022 18:25
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @t3chguy 🦓

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants