From 452d20daddb1b9bdb4300705ae6caca228f5eccd Mon Sep 17 00:00:00 2001 From: Egor Didenko Date: Wed, 20 Nov 2024 17:05:52 -0500 Subject: [PATCH] chore: added l10n --- blocks/Config/initialConfig.js | 2 +- blocks/ExternalSource/ExternalSource.js | 15 +++++++++++++++ blocks/ExternalSource/types.js | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/blocks/Config/initialConfig.js b/blocks/Config/initialConfig.js index 02cbc9024..991adc0b9 100644 --- a/blocks/Config/initialConfig.js +++ b/blocks/Config/initialConfig.js @@ -5,7 +5,7 @@ import { serializeCsv } from '../utils/comma-separated.js'; export const DEFAULT_CDN_CNAME = 'https://ucarecdn.com'; export const DEFAULT_BASE_URL = 'https://upload.uploadcare.com'; -export const DEFAULT_SOCIAL_BASE_URL = 'https://social.uploadcare.com'; +export const DEFAULT_SOCIAL_BASE_URL = 'https://localhost.localdomain:5000'; /** @type {import('../../types/exported').ConfigType} */ export const initialConfig = { diff --git a/blocks/ExternalSource/ExternalSource.js b/blocks/ExternalSource/ExternalSource.js index 5dde9c102..9e7d7f0d9 100644 --- a/blocks/ExternalSource/ExternalSource.js +++ b/blocks/ExternalSource/ExternalSource.js @@ -51,6 +51,8 @@ export class ExternalSource extends UploaderBlock { this._messageBridge?.send({ type: 'select-all' }); }, + onKeyDown: () => {}, + onDeselectAll: () => { this._messageBridge?.send({ type: 'deselect-all' }); }, @@ -102,6 +104,10 @@ export class ExternalSource extends UploaderBlock { this.subConfigValue('multiple', (multiple) => { this.$.showSelectionStatus = multiple; }); + + this.subConfigValue('localeName', (val) => { + this.setupL10n(); + }); } /** @@ -153,6 +159,7 @@ export class ExternalSource extends UploaderBlock { /** @private */ handleIframeLoad() { this.applyStyles(); + this.setupL10n(); } /** @private */ @@ -163,6 +170,14 @@ export class ExternalSource extends UploaderBlock { }); } + /** @private */ + setupL10n() { + this._messageBridge?.send({ + type: 'set-locale-definition', + localeDefinition: this.cfg.localeName, + }); + } + /** @private */ remoteUrl() { const { pubkey, remoteTabSessionKey, socialBaseUrl, multiple } = this.cfg; diff --git a/blocks/ExternalSource/types.js b/blocks/ExternalSource/types.js index 3c28e3f90..7d4915eae 100644 --- a/blocks/ExternalSource/types.js +++ b/blocks/ExternalSource/types.js @@ -131,6 +131,10 @@ * theme: Record; * } * | { + * type: 'set-locale-definition'; + * localeDefinition: string; + * } + * | { * type: 'set-embed-css'; * css: Partial; * }} OutputMessage