From 9715491a6339481aebaf7bc698da51c64594351c Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 27 Mar 2026 14:18:56 +1100 Subject: [PATCH] chore: add giphy support devStrings --- devStrings.ts | 8 ++++++++ generated/english.ts | 1 + localeTools.ts | 14 ++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/devStrings.ts b/devStrings.ts index 8cfccc7..46e1b05 100644 --- a/devStrings.ts +++ b/devStrings.ts @@ -41,6 +41,14 @@ export const devSimpleNoArgs = { codePointsDev: 'Code Points:', debugModeEnabledToastDev: 'Debug mode enabled!', debugModeDisabledToastDev: 'Debug mode disabled!', + + // gifs + giphyIntegrationSectionTitle: 'Giphy Integration', + giphyIntegrationTitle: 'Enable Giphy Integration', + giphyIntegrationDescription: 'Enable giphy integration in Session (restart needed)', + giphyIntegrationModalDescription: + "Session will connect to Giphy's servers to provide gif. You will not have full metadata protection. Session needs to restart to apply the changes.", + searchForGifs: 'Search for gifs', } as const; export type TokenDevNoArgs = keyof typeof devSimpleNoArgs; diff --git a/generated/english.ts b/generated/english.ts index 18ee769..01a44df 100644 --- a/generated/english.ts +++ b/generated/english.ts @@ -513,6 +513,7 @@ export const enSimpleNoArgs = { linkPreviewsSendModalDescription: 'You will not have full metadata protection when sending link previews.', linkPreviewsTurnedOff: 'Link Previews Are Off', linkPreviewsTurnedOffDescription: 'Session must contact linked websites to generate previews of links you send and receive.

You can turn them on in Session\'s settings.', + links: 'Links', loadAccount: 'Load Account', loadAccountProgressMessage: 'Loading your account', diff --git a/localeTools.ts b/localeTools.ts index 20a733b..f814113 100644 --- a/localeTools.ts +++ b/localeTools.ts @@ -54,7 +54,13 @@ function withClause(error: unknown) { return ''; } -function stringifyError(error: unknown): string { +function stringifyError(error: unknown, msgOnly = false): string { + if (msgOnly) { + if (error && typeof error === 'object' && 'message' in error) { + return String(error.message); + } + return String(error); + } if (error instanceof Error && error.stack) { return error.stack + withClause(error); } @@ -279,7 +285,7 @@ export function getRawMessage( return pluralString.replaceAll('#', `${num}`); } catch (error) { - log(stringifyError(error)); + log(stringifyError(error, true)); return token; } } @@ -364,7 +370,7 @@ export class LocalizedStringBuilder extends Str return str; } catch (error) { - log(stringifyError(error)); + log(stringifyError(error, true)); return this.token; } } @@ -427,7 +433,7 @@ export class LocalizedStringBuilder extends Str return this.resolvePluralString(); } catch (error) { - log(stringifyError(error)); + log(stringifyError(error, true)); return this.token; } }