diff --git a/packages/rocketchat-lib/client/CustomTranslations.js b/packages/rocketchat-lib/client/CustomTranslations.js index c895e26b68204..f3e9760d9d502 100644 --- a/packages/rocketchat-lib/client/CustomTranslations.js +++ b/packages/rocketchat-lib/client/CustomTranslations.js @@ -1,32 +1,15 @@ import { Meteor } from 'meteor/meteor'; import { Session } from 'meteor/session'; import { TAPi18n } from 'meteor/tap:i18n'; -import { TAPi18next } from 'meteor/tap:i18n'; +import { applyCustomTranslations } from 'meteor/rocketchat:utils'; import { Tracker } from 'meteor/tracker'; -RocketChat.applyCustomTranslations = function applyCustomTranslations() { - let CustomTranslations = RocketChat.settings.get('Custom_Translations'); - if (typeof CustomTranslations === 'string' && CustomTranslations.trim() !== '') { - try { - CustomTranslations = JSON.parse(CustomTranslations); - - for (const lang in CustomTranslations) { - if (CustomTranslations.hasOwnProperty(lang)) { - const translations = CustomTranslations[lang]; - TAPi18next.addResourceBundle(lang, 'project', translations); - } - } - TAPi18n._language_changed_tracker.changed(); - } catch (e) { - console.error('Invalid setting Custom_Translations', e); - } - } -}; +RocketChat.applyCustomTranslations = applyCustomTranslations; Meteor.startup(function() { Tracker.autorun(function() { // Re apply translations if tap language was changed Session.get(TAPi18n._loaded_lang_session_key); - RocketChat.applyCustomTranslations(); + applyCustomTranslations(); }); }); diff --git a/packages/rocketchat-lib/client/OAuthProxy.js b/packages/rocketchat-lib/client/OAuthProxy.js index a923d3dded880..ac6a5ec33c918 100644 --- a/packages/rocketchat-lib/client/OAuthProxy.js +++ b/packages/rocketchat-lib/client/OAuthProxy.js @@ -1,13 +1,14 @@ import _ from 'underscore'; import { OAuth } from 'meteor/oauth'; +import { settings } from 'meteor/rocketchat:settings'; OAuth.launchLogin = _.wrap(OAuth.launchLogin, function(func, options) { - const proxy = RocketChat.settings.get('Accounts_OAuth_Proxy_services').replace(/\s/g, '').split(','); + const proxy = settings.get('Accounts_OAuth_Proxy_services').replace(/\s/g, '').split(','); if (proxy.includes(options.loginService)) { const redirect_uri = options.loginUrl.match(/(&redirect_uri=)([^&]+|$)/)[2]; - options.loginUrl = options.loginUrl.replace(/(&redirect_uri=)([^&]+|$)/, `$1${ encodeURIComponent(RocketChat.settings.get('Accounts_OAuth_Proxy_host')) }/oauth_redirect`); + options.loginUrl = options.loginUrl.replace(/(&redirect_uri=)([^&]+|$)/, `$1${ encodeURIComponent(settings.get('Accounts_OAuth_Proxy_host')) }/oauth_redirect`); options.loginUrl = options.loginUrl.replace(/(&state=)([^&]+|$)/, `$1${ redirect_uri }!$2`); - options.loginUrl = `${ RocketChat.settings.get('Accounts_OAuth_Proxy_host') }/redirect/${ encodeURIComponent(options.loginUrl) }`; + options.loginUrl = `${ settings.get('Accounts_OAuth_Proxy_host') }/redirect/${ encodeURIComponent(options.loginUrl) }`; } return func(options); diff --git a/packages/rocketchat-lib/client/UserDeleted.js b/packages/rocketchat-lib/client/UserDeleted.js index 28eab20ce97f9..ae7da4f57f94d 100644 --- a/packages/rocketchat-lib/client/UserDeleted.js +++ b/packages/rocketchat-lib/client/UserDeleted.js @@ -1,8 +1,9 @@ import { Meteor } from 'meteor/meteor'; import { ChatMessage } from 'meteor/rocketchat:models'; +import { Notifications } from 'meteor/rocketchat:notifications'; Meteor.startup(function() { - RocketChat.Notifications.onLogged('Users:Deleted', ({ userId }) => + Notifications.onLogged('Users:Deleted', ({ userId }) => ChatMessage.remove({ 'u._id': userId, }) diff --git a/packages/rocketchat-lib/client/defaultTabBars.js b/packages/rocketchat-lib/client/defaultTabBars.js index 8ee2470b030d2..fbb91f0da6129 100644 --- a/packages/rocketchat-lib/client/defaultTabBars.js +++ b/packages/rocketchat-lib/client/defaultTabBars.js @@ -1,6 +1,9 @@ import { Session } from 'meteor/session'; +import { TabBar } from 'meteor/rocketchat:ui-utils'; +import { Rooms } from 'meteor/rocketchat:models'; +import { hasAllPermission } from 'meteor/rocketchat:authorization'; -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['channel', 'group', 'direct'], id: 'rocket-search', i18nTitle: 'Search_Messages', @@ -9,7 +12,7 @@ RocketChat.TabBar.addButton({ order: 1, }); -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['direct'], id: 'user-info', i18nTitle: 'User_Info', @@ -18,7 +21,7 @@ RocketChat.TabBar.addButton({ order: 2, }); -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['channel', 'group'], id: 'members-list', i18nTitle: 'Members_List', @@ -27,7 +30,7 @@ RocketChat.TabBar.addButton({ order: 2, condition() { const rid = Session.get('openedRoom'); - const room = RocketChat.models.Rooms.findOne({ + const room = Rooms.findOne({ _id: rid, }); @@ -35,11 +38,11 @@ RocketChat.TabBar.addButton({ return true; } - return RocketChat.authz.hasAllPermission('view-broadcast-member-list', rid); + return hasAllPermission('view-broadcast-member-list', rid); }, }); -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['channel', 'group'], id: 'addUsers', i18nTitle: 'Add_users', @@ -49,7 +52,7 @@ RocketChat.TabBar.addButton({ }); -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['channel', 'group', 'direct'], id: 'uploaded-files-list', i18nTitle: 'Room_uploaded_file_list', @@ -58,7 +61,7 @@ RocketChat.TabBar.addButton({ order: 3, }); -RocketChat.TabBar.addButton({ +TabBar.addButton({ groups: ['channel', 'group', 'direct'], id: 'keyboard-shortcut-list', i18nTitle: 'Keyboard_Shortcuts_Title', diff --git a/packages/rocketchat-lib/client/lib/LoginPresence.js b/packages/rocketchat-lib/client/lib/LoginPresence.js index 1f621d333c24e..e33e020f53c47 100644 --- a/packages/rocketchat-lib/client/lib/LoginPresence.js +++ b/packages/rocketchat-lib/client/lib/LoginPresence.js @@ -1,4 +1,5 @@ import { Meteor } from 'meteor/meteor'; +import { settings } from 'meteor/rocketchat:settings'; export const LoginPresence = { awayTime: 600000, // 10 minutes @@ -17,7 +18,7 @@ export const LoginPresence = { disconnect() { const status = Meteor.status(); if (status && status.status !== 'offline') { - if (!Meteor.userId() && RocketChat.settings.get('Accounts_AllowAnonymousRead') !== true) { + if (!Meteor.userId() && settings.get('Accounts_AllowAnonymousRead') !== true) { Meteor.disconnect(); } } diff --git a/packages/rocketchat-lib/client/lib/formatDate.js b/packages/rocketchat-lib/client/lib/formatDate.js index c6b34aef96a53..d264fb3395856 100644 --- a/packages/rocketchat-lib/client/lib/formatDate.js +++ b/packages/rocketchat-lib/client/lib/formatDate.js @@ -1,25 +1,28 @@ import { Meteor } from 'meteor/meteor'; +import { getUserPreference } from 'meteor/rocketchat:utils'; +import { settings } from 'meteor/rocketchat:settings'; import moment from 'moment'; + export const formatTime = (time) => { - switch (RocketChat.getUserPreference(Meteor.userId(), 'clockMode', false)) { + switch (getUserPreference(Meteor.userId(), 'clockMode', false)) { case 1: return moment(time).format('h:mm A'); case 2: return moment(time).format('H:mm'); default: - return moment(time).format(RocketChat.settings.get('Message_TimeFormat')); + return moment(time).format(settings.get('Message_TimeFormat')); } }; export const formatDateAndTime = (time) => { - switch (RocketChat.getUserPreference(Meteor.userId(), 'clockMode', false)) { + switch (getUserPreference(Meteor.userId(), 'clockMode', false)) { case 1: return moment(time).format('MMMM D, Y h:mm A'); case 2: return moment(time).format('MMMM D, Y H:mm'); default: - return moment(time).format(RocketChat.settings.get('Message_TimeAndDateFormat')); + return moment(time).format(settings.get('Message_TimeAndDateFormat')); } }; -export const formatDate = (time) => moment(time).format(RocketChat.settings.get('Message_DateFormat')); +export const formatDate = (time) => moment(time).format(settings.get('Message_DateFormat')); diff --git a/packages/rocketchat-lib/client/lib/openRoom.js b/packages/rocketchat-lib/client/lib/openRoom.js index 9be03e45dfccf..2ba6f4b4788fa 100644 --- a/packages/rocketchat-lib/client/lib/openRoom.js +++ b/packages/rocketchat-lib/client/lib/openRoom.js @@ -3,8 +3,11 @@ import { Tracker } from 'meteor/tracker'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { BlazeLayout } from 'meteor/kadira:blaze-layout'; import { Session } from 'meteor/session'; -import { RoomManager, fireGlobalEvent, readMessage, RoomHistoryManager } from 'meteor/rocketchat:ui-utils'; -import { ChatSubscription } from 'meteor/rocketchat:models'; +import { RoomManager, fireGlobalEvent, readMessage, RoomHistoryManager, Layout } from 'meteor/rocketchat:ui-utils'; +import { ChatSubscription, Rooms } from 'meteor/rocketchat:models'; +import { settings } from 'meteor/rocketchat:settings'; +import { callbacks } from 'meteor/rocketchat:callbacks'; +import { roomTypes, handleError } from 'meteor/rocketchat:utils'; import _ from 'underscore'; export let currentTracker = undefined; @@ -15,13 +18,13 @@ openRoom = function(type, name) { return Meteor.defer(() => currentTracker = Tracker.autorun(function(c) { const user = Meteor.user(); - if ((user && user.username == null) || (user == null && RocketChat.settings.get('Accounts_AllowAnonymousRead') === false)) { + if ((user && user.username == null) || (user == null && settings.get('Accounts_AllowAnonymousRead') === false)) { BlazeLayout.render('main'); return; } if (RoomManager.open(type + name).ready() !== true) { - BlazeLayout.render('main', { modal: RocketChat.Layout.isEmbedded(), center: 'loading' }); + BlazeLayout.render('main', { modal: Layout.isEmbedded(), center: 'loading' }); return; } if (currentTracker) { @@ -29,7 +32,7 @@ openRoom = function(type, name) { } c.stop(); - const room = RocketChat.roomTypes.findRoom(type, name, user); + const room = roomTypes.findRoom(type, name, user); if (room == null) { if (type === 'd') { Meteor.call('createDirectMessage', name, function(error) { @@ -48,7 +51,7 @@ openRoom = function(type, name) { Session.set('roomNotFound', { type, name, error }); return BlazeLayout.render('main', { center: 'roomNotFound' }); } else { - RocketChat.models.Rooms.upsert({ _id: record._id }, _.omit(record, '_id')); + Rooms.upsert({ _id: record._id }, _.omit(record, '_id')); RoomManager.close(type + name); return openRoom(type, name); } @@ -93,7 +96,7 @@ openRoom = function(type, name) { RoomHistoryManager.getSurroundingMessages(msg); } - return RocketChat.callbacks.run('enter-room', sub); + return callbacks.run('enter-room', sub); }) ); }; diff --git a/packages/rocketchat-lib/client/lib/roomExit.js b/packages/rocketchat-lib/client/lib/roomExit.js index fabf375a67690..28bbfefa6c568 100644 --- a/packages/rocketchat-lib/client/lib/roomExit.js +++ b/packages/rocketchat-lib/client/lib/roomExit.js @@ -1,5 +1,6 @@ import { Blaze } from 'meteor/blaze'; import { BlazeLayout } from 'meteor/kadira:blaze-layout'; +import { callbacks } from 'meteor/rocketchat:callbacks'; import { currentTracker } from './openRoom'; this.roomExit = function() { @@ -11,7 +12,7 @@ this.roomExit = function() { templateData && templateData.tabBar && templateData.tabBar.close(); } } - RocketChat.callbacks.run('roomExit'); + callbacks.run('roomExit'); BlazeLayout.render('main', { center: 'none', }); diff --git a/packages/rocketchat-lib/client/lib/settings.js b/packages/rocketchat-lib/client/lib/settings.js index e21d20b3f9ef9..2acfd04d8b776 100644 --- a/packages/rocketchat-lib/client/lib/settings.js +++ b/packages/rocketchat-lib/client/lib/settings.js @@ -2,14 +2,16 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { t } from 'meteor/rocketchat:utils'; import { modal } from 'meteor/rocketchat:ui-utils'; +import { settings } from 'meteor/rocketchat:settings'; +import { hasRole } from 'meteor/rocketchat:authorization'; Meteor.startup(function() { Tracker.autorun(function(c) { - const siteUrl = RocketChat.settings.get('Site_Url'); + const siteUrl = settings.get('Site_Url'); if (!siteUrl || (Meteor.userId() == null)) { return; } - if (RocketChat.authz.hasRole(Meteor.userId(), 'admin') === false || Meteor.settings.public.sandstorm) { + if (hasRole(Meteor.userId(), 'admin') === false || Meteor.settings.public.sandstorm) { return c.stop(); } Meteor.setTimeout(function() { @@ -36,7 +38,7 @@ Meteor.startup(function() { }); } }, 100); - const documentDomain = RocketChat.settings.get('Document_Domain'); + const documentDomain = settings.get('Document_Domain'); if (documentDomain) { window.document.domain = documentDomain; } diff --git a/packages/rocketchat-lib/client/lib/startup/commands.js b/packages/rocketchat-lib/client/lib/startup/commands.js index 2c4d90b86a3f5..35cc4960da43b 100644 --- a/packages/rocketchat-lib/client/lib/startup/commands.js +++ b/packages/rocketchat-lib/client/lib/startup/commands.js @@ -1,5 +1,6 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; +import { slashCommands } from 'meteor/rocketchat:utils'; // Track logins and when they login, get the commands (() => { @@ -10,7 +11,7 @@ import { Tracker } from 'meteor/tracker'; if (oldUserId === null && newUserId) { RocketChat.API.v1.get('commands.list').then(function _loadedCommands(result) { result.commands.forEach((command) => { - RocketChat.slashCommands.commands[command.command] = command; + slashCommands.commands[command.command] = command; }); }); } diff --git a/packages/rocketchat-lib/client/lib/userRoles.js b/packages/rocketchat-lib/client/lib/userRoles.js index ac95cb914a3b8..579467929bf45 100644 --- a/packages/rocketchat-lib/client/lib/userRoles.js +++ b/packages/rocketchat-lib/client/lib/userRoles.js @@ -1,6 +1,8 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { UserRoles, RoomRoles, ChatMessage } from 'meteor/rocketchat:models'; +import { handleError } from 'meteor/rocketchat:utils'; +import { Notifications } from 'meteor/rocketchat:notifications'; Meteor.startup(function() { Tracker.autorun(function() { @@ -15,7 +17,7 @@ Meteor.startup(function() { } }); - RocketChat.Notifications.onLogged('roles-change', function(role) { + Notifications.onLogged('roles-change', function(role) { if (role.type === 'added') { if (role.scope) { RoomRoles.upsert({ rid: role.scope, 'u._id': role.u._id }, { $setOnInsert: { u: role.u }, $addToSet: { roles: role._id } }); diff --git a/packages/rocketchat-lib/client/methods/sendMessage.js b/packages/rocketchat-lib/client/methods/sendMessage.js index bf34d84c72b8c..45f2f3af250b3 100644 --- a/packages/rocketchat-lib/client/methods/sendMessage.js +++ b/packages/rocketchat-lib/client/methods/sendMessage.js @@ -1,6 +1,9 @@ import { Meteor } from 'meteor/meteor'; import { TimeSync } from 'meteor/mizzao:timesync'; import { ChatMessage } from 'meteor/rocketchat:models'; +import { settings } from 'meteor/rocketchat:settings'; +import { callbacks } from 'meteor/rocketchat:callbacks'; +import { promises } from 'meteor/rocketchat:promises'; import s from 'underscore.string'; Meteor.methods({ @@ -14,17 +17,17 @@ Meteor.methods({ _id: Meteor.userId(), username: user.username, }; - if (RocketChat.settings.get('UI_Use_Real_Name')) { + if (settings.get('UI_Use_Real_Name')) { message.u.name = user.name; } message.temp = true; - if (RocketChat.settings.get('Message_Read_Receipt_Enabled')) { + if (settings.get('Message_Read_Receipt_Enabled')) { message.unread = true; } - message = RocketChat.callbacks.run('beforeSaveMessage', message); - RocketChat.promises.run('onClientMessageReceived', message).then(function(message) { + message = callbacks.run('beforeSaveMessage', message); + promises.run('onClientMessageReceived', message).then(function(message) { ChatMessage.insert(message); - return RocketChat.callbacks.run('afterSaveMessage', message); + return callbacks.run('afterSaveMessage', message); }); }, }); diff --git a/packages/rocketchat-lib/client/views/customFieldsForm.js b/packages/rocketchat-lib/client/views/customFieldsForm.js index 52949d9eb7227..aea80865ed204 100644 --- a/packages/rocketchat-lib/client/views/customFieldsForm.js +++ b/packages/rocketchat-lib/client/views/customFieldsForm.js @@ -1,6 +1,7 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Tracker } from 'meteor/tracker'; import { Template } from 'meteor/templating'; +import { settings } from 'meteor/rocketchat:settings'; Template.customFieldsForm.helpers({ new() { @@ -52,10 +53,10 @@ Template.customFieldsForm.onCreated(function() { this.formData = (currentData && currentData.formData) || {}; Tracker.autorun(() => { - const Accounts_CustomFields = RocketChat.settings.get('Accounts_CustomFields'); + const Accounts_CustomFields = settings.get('Accounts_CustomFields'); if (typeof Accounts_CustomFields === 'string' && Accounts_CustomFields.trim() !== '') { try { - this.customFields.set(JSON.parse(RocketChat.settings.get('Accounts_CustomFields'))); + this.customFields.set(JSON.parse(settings.get('Accounts_CustomFields'))); } catch (e) { console.error('Invalid JSON for Accounts_CustomFields'); } diff --git a/packages/rocketchat-lib/lib/getUserPreference.js b/packages/rocketchat-lib/lib/getUserPreference.js index 4037d3517cf91..a9c0f14e6a7ae 100644 --- a/packages/rocketchat-lib/lib/getUserPreference.js +++ b/packages/rocketchat-lib/lib/getUserPreference.js @@ -1,18 +1,3 @@ -/** - * Tries to retrieve the user preference falling back to a default system - * value or to a default value if it is passed as argument -*/ -RocketChat.getUserPreference = function(user, key, defaultValue = undefined) { - let preference; - if (typeof user === typeof '') { - user = RocketChat.models.Users.findOne(user, { fields: { [`settings.preferences.${ key }`]: 1 } }); - } - if (user && user.settings && user.settings.preferences && - user.settings.preferences.hasOwnProperty(key)) { - preference = user.settings.preferences[key]; - } else if (defaultValue === undefined) { - preference = RocketChat.settings.get(`Accounts_Default_User_Preferences_${ key }`); - } +import { getUserPreference } from 'meteor/rocketchat:utils'; - return preference !== undefined ? preference : defaultValue; -}; +RocketChat.getUserPreference = getUserPreference; diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js index b7ebecbd8118e..9784e41bedd69 100644 --- a/packages/rocketchat-lib/package.js +++ b/packages/rocketchat-lib/package.js @@ -36,7 +36,6 @@ Package.onUse(function(api) { api.use('rocketchat:emoji'); api.use('rocketchat:ui'); api.use('rocketchat:accounts'); - api.use('rocketchat:ui'); api.use('modules'); api.use('rocketchat:i18n'); api.use('rocketchat:streamer'); diff --git a/packages/rocketchat-utils/client/index.js b/packages/rocketchat-utils/client/index.js index 46e4fcde8708e..97d18ad672b7b 100644 --- a/packages/rocketchat-utils/client/index.js +++ b/packages/rocketchat-utils/client/index.js @@ -1,37 +1,15 @@ -import { t, isRtl } from '../lib/tapi18n'; -import { isChrome, isFirefox } from './lib/browsers'; -import { getDefaultSubscriptionPref } from '../lib/getDefaultSubscriptionPref'; -import { Info } from '../rocketchat.info'; -import { isEmail } from '../lib/isEmail'; -import { handleError } from './lib/handleError'; -import { getUserPreference } from '../lib/getUserPreference'; -import { fileUploadMediaWhiteList, fileUploadIsValidContentType } from '../lib/fileUploadRestrictions'; -import { roomTypes } from './lib/roomTypes'; -import { RoomTypeRouteConfig, RoomTypeConfig, RoomSettingsEnum, UiTextContext } from '../lib/RoomTypeConfig'; -import { RoomTypesCommon } from '../lib/RoomTypesCommon'; -import { getAvatarUrlFromUsername } from '../lib/getAvatarUrlFromUsername'; -import { slashCommands } from '../lib/slashCommand'; -import { getUserNotificationPreference } from '../lib/getUserNotificationPreference'; - -export { - t, - isRtl, - isChrome, - isFirefox, - getDefaultSubscriptionPref, - Info, - isEmail, - handleError, - getUserPreference, - fileUploadIsValidContentType, - fileUploadMediaWhiteList, - roomTypes, - RoomTypeRouteConfig, - RoomTypesCommon, - RoomTypeConfig, - RoomSettingsEnum, - UiTextContext, - getAvatarUrlFromUsername, - slashCommands, - getUserNotificationPreference, -}; +export { t, isRtl } from '../lib/tapi18n'; +export { isChrome, isFirefox } from './lib/browsers'; +export { getDefaultSubscriptionPref } from '../lib/getDefaultSubscriptionPref'; +export { Info } from '../rocketchat.info'; +export { isEmail } from '../lib/isEmail'; +export { handleError } from './lib/handleError'; +export { getUserPreference } from '../lib/getUserPreference'; +export { fileUploadMediaWhiteList, fileUploadIsValidContentType } from '../lib/fileUploadRestrictions'; +export { roomTypes } from './lib/roomTypes'; +export { RoomTypeRouteConfig, RoomTypeConfig, RoomSettingsEnum, UiTextContext } from '../lib/RoomTypeConfig'; +export { RoomTypesCommon } from '../lib/RoomTypesCommon'; +export { getAvatarUrlFromUsername } from '../lib/getAvatarUrlFromUsername'; +export { slashCommands } from '../lib/slashCommand'; +export { getUserNotificationPreference } from '../lib/getUserNotificationPreference'; +export { applyCustomTranslations } from './lib/CustomTranslations'; diff --git a/packages/rocketchat-utils/client/lib/CustomTranslations.js b/packages/rocketchat-utils/client/lib/CustomTranslations.js new file mode 100644 index 0000000000000..0f424a13f2b74 --- /dev/null +++ b/packages/rocketchat-utils/client/lib/CustomTranslations.js @@ -0,0 +1,21 @@ +import { TAPi18n, TAPi18next } from 'meteor/tap:i18n'; +import { settings } from 'meteor/rocketchat:settings'; + +export function applyCustomTranslations() { + let CustomTranslations = settings.get('Custom_Translations'); + if (typeof CustomTranslations === 'string' && CustomTranslations.trim() !== '') { + try { + CustomTranslations = JSON.parse(CustomTranslations); + + for (const lang in CustomTranslations) { + if (CustomTranslations.hasOwnProperty(lang)) { + const translations = CustomTranslations[lang]; + TAPi18next.addResourceBundle(lang, 'project', translations); + } + } + TAPi18n._language_changed_tracker.changed(); + } catch (e) { + console.error('Invalid setting Custom_Translations', e); + } + } +}