Don't import from i18n in headless

This commit is contained in:
JC Brand 2022-04-02 15:55:56 +02:00
parent f6a985c24f
commit fb704fdf87
3 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,6 @@
import "@converse/headless/plugins/muc/index.js";
import Bookmark from './model.js';
import log from "@converse/headless/log.js";
import { __ } from 'i18n';
import { _converse, api, converse } from "@converse/headless/core";
import { getOpenPromise } from '@converse/openpromise';
import { initStorage } from '@converse/headless/utils/storage.js';
@ -86,6 +85,7 @@ const Bookmarks = {
},
onBookmarkError (iq, options) {
const { __ } = _converse;
log.error("Error while trying to add bookmark");
log.error(iq);
api.alert(
@ -145,6 +145,7 @@ const Bookmarks = {
},
onBookmarksReceivedError (deferred, iq) {
const { __ } = _converse;
if (iq === null) {
log.error('Error: timeout while fetching bookmarks');
api.alert('error', __('Timeout Error'),

View File

@ -3,7 +3,6 @@ import log from "@converse/headless/log";
import sum from 'lodash-es/sum';
import { Collection } from "@converse/skeletor/src/collection";
import { Model } from "@converse/skeletor/src/model";
import { __ } from 'i18n';
import { _converse, api, converse } from "@converse/headless/core";
import { initStorage } from '@converse/headless/utils/storage.js';
import { rejectPresenceSubscription } from './utils.js';
@ -163,6 +162,7 @@ const RosterContacts = Collection.extend({
try {
await this.sendContactAddIQ(jid, name, groups);
} catch (e) {
const { __ } = _converse;
log.error(e);
alert(__('Sorry, there was an error while trying to add %1$s as a contact.', name || jid));
return e;
@ -355,6 +355,7 @@ const RosterContacts = Collection.extend({
contact = this.get(bare_jid);
if (!api.settings.get('allow_contact_requests')) {
const { __ } = _converse;
rejectPresenceSubscription(
jid,
__("This client does not allow presence subscriptions")

View File

@ -7,7 +7,6 @@ import RosterContact from './contact.js';
import RosterContacts from './contacts.js';
import roster_api from './api.js';
import { Presence, Presences } from './presence.js';
import { __ } from 'i18n';
import { _converse, api, converse } from '@converse/headless/core';
import {
onChatBoxesInitialized,
@ -34,6 +33,7 @@ converse.plugins.add('converse-roster', {
// API methods only available to plugins
Object.assign(_converse.api, roster_api);
const { __ } = _converse;
_converse.HEADER_CURRENT_CONTACTS = __('My contacts');
_converse.HEADER_PENDING_CONTACTS = __('Pending contacts');
_converse.HEADER_REQUESTING_CONTACTS = __('Contact requests');