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

Commit

Permalink
Ignore long string
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Dec 15, 2021
1 parent de661a6 commit a4c3601
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export const Commands = [
// otherwise the rageshake error messages will be
// translated too
_t(
// eslint-disable-next-line max-len
'We were unable to understand the given date (%(inputDate)s). Try using the format YYYY-MM-DD.',
{ inputDate: args },
),
Expand Down
6 changes: 5 additions & 1 deletion src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { findEditableEvent } from '../../../utils/EventUtils';
import SendHistoryManager from "../../../SendHistoryManager";
import { Command, CommandCategories, getCommand } from '../../../SlashCommands';
import Modal from '../../../Modal';
import { _t, _td } from '../../../languageHandler';
import { _t, _td, newTranslatableError } from '../../../languageHandler';
import ContentMessages from '../../../ContentMessages';
import { withMatrixClientHOC, MatrixClientProps } from "../../../contexts/MatrixClientContext";
import { Action } from "../../../dispatcher/actions";
Expand Down Expand Up @@ -378,6 +378,10 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
let errText;
if (typeof error === 'string') {
errText = error;
}
// Check for translatable errors
else if(error.translatedMessage) {
errText = error.translatedMessage
} else if (error.message) {
errText = error.message;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/languageHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,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 {
const error = new Error(message) as ITranslatableError;
error.translatedMessage = _t(message);
error.translatedMessage = _t(message, variables);
return error;
}

Expand Down

0 comments on commit a4c3601

Please sign in to comment.