diff --git a/app/controllers/api/v1/widget/base_controller.rb b/app/controllers/api/v1/widget/base_controller.rb index 9ef4a04f2..86bffb710 100644 --- a/app/controllers/api/v1/widget/base_controller.rb +++ b/app/controllers/api/v1/widget/base_controller.rb @@ -18,6 +18,7 @@ class Api::V1::Widget::BaseController < ApplicationController def set_web_widget @web_widget = ::Channel::WebWidget.find_by!(website_token: permitted_params[:website_token]) @account = @web_widget.account + switch_locale @account end def set_contact diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5bac8991e..b6473cf13 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,9 +24,14 @@ class ApplicationController < ActionController::Base elsif @resource&.is_a?(AgentBot) account_accessible_for_bot?(account) end + switch_locale account account end + def switch_locale(account) + I18n.locale = (I18n.available_locales.map(&:to_s).include?(account.locale) ? account.locale : nil) || I18n.default_locale + end + def account_accessible_for_user?(account) render_unauthorized('You are not authorized to access this account') unless account.account_users.find_by(user_id: current_user.id) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be7945..b52b2300e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,5 @@ module ApplicationHelper + def available_locales_with_name + LANGUAGES_CONFIG.map { |_key, val| val.slice(:name, :iso_639_1_code) } + end end diff --git a/app/javascript/dashboard/i18n/ca.js b/app/javascript/dashboard/i18n/ca.js deleted file mode 100644 index 796cced41..000000000 --- a/app/javascript/dashboard/i18n/ca.js +++ /dev/null @@ -1,37 +0,0 @@ -import en from './locale/ca'; - -export default { - ...en, - APP_GLOBAL: { - TRIAL_MESSAGE: 'dies de prova restants.', - TRAIL_BUTTON: 'Comprar ara', - }, - COMPONENTS: { - CODE: { - BUTTON_TEXT: 'Copiar', - COPY_SUCCESSFUL: 'Codi copiat al porta-retalls correctament', - }, - FILE_BUBBLE: { - DOWNLOAD: 'Descarrega', - UPLOADING: "S'està pujant...", - }, - }, - CONFIRM_EMAIL: "S'està verificant...", - SETTINGS: { - INBOXES: { - NEW_INBOX: "Afegeix una safata d'entrada", - }, - }, - SIDEBAR: { - CONVERSATIONS: 'Conversacions', - REPORTS: 'Informes', - SETTINGS: 'Configuració', - HOME: 'Inici', - AGENTS: 'Agents', - INBOXES: "Safates d'entrada", - CANNED_RESPONSES: 'Respostes Predeterminades', - BILLING: 'Facturació', - INTEGRATIONS: 'Integracions', - ACCOUNT_SETTINGS: 'Configuració del compte', - }, -}; diff --git a/app/javascript/dashboard/i18n/de.js b/app/javascript/dashboard/i18n/de.js deleted file mode 100644 index 6988a5d95..000000000 --- a/app/javascript/dashboard/i18n/de.js +++ /dev/null @@ -1,41 +0,0 @@ -import de from './locale/de'; - -export default { - ...de, - APP_GLOBAL: { - TRIAL_MESSAGE: 'verbleibende Tage Probezeit.', - TRAIL_BUTTON: 'Kaufe jetzt', - }, - COMPONENTS: { - CODE: { - BUTTON_TEXT: 'Kopieren', - COPY_SUCCESSFUL: 'Code erfolgreich in die Zwischenablage kopiert', - }, - FILE_BUBBLE: { - DOWNLOAD: 'Herunterladen', - UPLOADING: 'Hochladen...', - }, - - FORM_BUBBLE: { - SUBMIT: 'Einreichen', - }, - }, - CONFIRM_EMAIL: 'Überprüfen...', - SETTINGS: { - INBOXES: { - NEW_INBOX: 'Posteingang hinzufügen', - }, - }, - SIDEBAR: { - CONVERSATIONS: 'Gespräche', - REPORTS: 'Berichte', - SETTINGS: 'Die Einstellungen', - HOME: 'Zuhause', - AGENTS: 'Agenten', - INBOXES: 'Posteingänge', - CANNED_RESPONSES: 'Vorgefertigte Antworten', - BILLING: 'Abrechnung', - INTEGRATIONS: 'Integrationen', - ACCOUNT_SETTINGS: 'Kontoeinstellungen', - }, -}; diff --git a/app/javascript/dashboard/i18n/en.js b/app/javascript/dashboard/i18n/en.js deleted file mode 100644 index 61029e9af..000000000 --- a/app/javascript/dashboard/i18n/en.js +++ /dev/null @@ -1,40 +0,0 @@ -import en from './locale/en'; - -export default { - ...en, - APP_GLOBAL: { - TRIAL_MESSAGE: 'days trial remaining.', - TRAIL_BUTTON: 'Buy Now', - }, - COMPONENTS: { - CODE: { - BUTTON_TEXT: 'Copy', - COPY_SUCCESSFUL: 'Code copied to clipboard successfully', - }, - FILE_BUBBLE: { - DOWNLOAD: 'Download', - UPLOADING: 'Uploading...', - }, - FORM_BUBBLE: { - SUBMIT: 'Submit', - }, - }, - CONFIRM_EMAIL: 'Verifying...', - SETTINGS: { - INBOXES: { - NEW_INBOX: 'Add Inbox', - }, - }, - SIDEBAR: { - CONVERSATIONS: 'Conversations', - REPORTS: 'Reports', - SETTINGS: 'Settings', - HOME: 'Home', - AGENTS: 'Agents', - INBOXES: 'Inboxes', - CANNED_RESPONSES: 'Canned Responses', - BILLING: 'Billing', - INTEGRATIONS: 'Integrations', - ACCOUNT_SETTINGS: 'Account Settings', - }, -}; diff --git a/app/javascript/dashboard/i18n/es.js b/app/javascript/dashboard/i18n/es.js deleted file mode 100644 index 112de9079..000000000 --- a/app/javascript/dashboard/i18n/es.js +++ /dev/null @@ -1,37 +0,0 @@ -import en from './locale/es'; - -export default { - ...en, - APP_GLOBAL: { - TRIAL_MESSAGE: 'días de prueba restantes.', - TRAIL_BUTTON: 'Comprar ahora', - }, - COMPONENTS: { - CODE: { - BUTTON_TEXT: 'Copiar', - COPY_SUCCESSFUL: 'Código copiado al portapapeles correctamente', - }, - FILE_BUBBLE: { - DOWNLOAD: 'Descarga', - UPLOADING: 'Se está subiendo...', - }, - }, - CONFIRM_EMAIL: 'Se está verificando...', - SETTINGS: { - INBOXES: { - NEW_INBOX: 'Añadir bandeja de entrada', - }, - }, - SIDEBAR: { - CONVERSATIONS: 'Conversaciones', - REPORTS: 'Informes', - SETTINGS: 'Configuración', - HOME: 'Inicio', - AGENTS: 'Agentes', - INBOXES: 'Bandejas de entrada', - CANNED_RESPONSES: 'Respuestas Predeterminadas', - BILLING: 'Facturación', - INTEGRATIONS: 'Integraciones', - ACCOUNT_SETTINGS: 'Configuración de la cuenta', - }, -}; diff --git a/app/javascript/dashboard/i18n/index.js b/app/javascript/dashboard/i18n/index.js index f9169ab02..13d8329f0 100644 --- a/app/javascript/dashboard/i18n/index.js +++ b/app/javascript/dashboard/i18n/index.js @@ -1,11 +1,15 @@ -import ca from './ca'; -import en from './en'; -import de from './de'; -import ml from './ml'; +import ca from './locale/ca'; +import de from './locale/de'; +import el from './locale/el'; +import en from './locale/en'; +import ml from './locale/ml'; +import pt from './locale/pt'; export default { ca, de, + el, en, ml, + pt, }; diff --git a/app/javascript/dashboard/i18n/locale/ca/settings.json b/app/javascript/dashboard/i18n/locale/ca/settings.json index fcd7ef9ef..a36b33447 100644 --- a/app/javascript/dashboard/i18n/locale/ca/settings.json +++ b/app/javascript/dashboard/i18n/locale/ca/settings.json @@ -58,5 +58,37 @@ "SIDEBAR_ITEMS": { "PROFILE_SETTINGS": "Configuració del Perfil", "LOGOUT": "Sortir" + }, + "APP_GLOBAL": { + "TRIAL_MESSAGE": "dies de prova restants.", + "TRAIL_BUTTON": "Comprar ara" + }, + "COMPONENTS": { + "CODE": { + "BUTTON_TEXT": "Copiar", + "COPY_SUCCESSFUL": "Codi copiat al porta-retalls correctament" + }, + "FILE_BUBBLE": { + "DOWNLOAD": "Descarrega", + "UPLOADING": "S'està pujant..." + } + }, + "CONFIRM_EMAIL": "S'està verificant...", + "SETTINGS": { + "INBOXES": { + "NEW_INBOX": "Afegeix una safata d'entrada" + } + }, + "SIDEBAR": { + "CONVERSATIONS": "Conversacions", + "REPORTS": "Informes", + "SETTINGS": "Configuració", + "HOME": "Inici", + "AGENTS": "Agents", + "INBOXES": "Safates d'entrada", + "CANNED_RESPONSES": "Respostes Predeterminades", + "BILLING": "Facturació", + "INTEGRATIONS": "Integracions", + "ACCOUNT_SETTINGS": "Configuració del compte" } } diff --git a/app/javascript/dashboard/i18n/locale/de/settings.json b/app/javascript/dashboard/i18n/locale/de/settings.json index 9c81a7bd7..8ff24bb0b 100644 --- a/app/javascript/dashboard/i18n/locale/de/settings.json +++ b/app/javascript/dashboard/i18n/locale/de/settings.json @@ -58,5 +58,41 @@ "SIDEBAR_ITEMS": { "PROFILE_SETTINGS": "Profileinstellungen", "LOGOUT": "Ausloggen" + }, + "APP_GLOBAL": { + "TRIAL_MESSAGE": "verbleibende Tage Probezeit.", + "TRAIL_BUTTON": "Kaufe jetzt" + }, + "COMPONENTS": { + "CODE": { + "BUTTON_TEXT": "Kopieren", + "COPY_SUCCESSFUL": "Code erfolgreich in die Zwischenablage kopiert" + }, + "FILE_BUBBLE": { + "DOWNLOAD": "Herunterladen", + "UPLOADING": "Hochladen..." + }, + "FORM_BUBBLE": { + "SUBMIT": "Einreichen" + } + }, + "CONFIRM_EMAIL": "Überprüfen...", + "SETTINGS": { + "INBOXES": { + "NEW_INBOX": "Posteingang hinzufügen" + } + }, + "SIDEBAR": { + "CONVERSATIONS": "Gespräche", + "REPORTS": "Berichte", + "SETTINGS": "Die Einstellungen", + "HOME": "Zuhause", + "AGENTS": "Agenten", + "INBOXES": "Posteingänge", + "CANNED_RESPONSES": "Vorgefertigte Antworten", + "BILLING": "Abrechnung", + "INTEGRATIONS": "Integrationen", + "ACCOUNT_SETTINGS": "Kontoeinstellungen" } + } diff --git a/app/javascript/dashboard/i18n/locale/el/index.js b/app/javascript/dashboard/i18n/locale/el/index.js new file mode 100644 index 000000000..351906dd9 --- /dev/null +++ b/app/javascript/dashboard/i18n/locale/el/index.js @@ -0,0 +1,34 @@ +/* eslint-disable */ +import { default as _agentMgmt } from './agentMgmt.json'; +import { default as _billing } from './billing.json'; +import { default as _cannedMgmt } from './cannedMgmt.json'; +import { default as _chatlist } from './chatlist.json'; +import { default as _contact } from './contact.json'; +import { default as _conversation } from './conversation.json'; +import { default as _inboxMgmt } from './inboxMgmt.json'; +import { default as _login } from './login.json'; +import { default as _report } from './report.json'; +import { default as _resetPassword } from './resetPassword.json'; +import { default as _setNewPassword } from './setNewPassword.json'; +import { default as _settings } from './settings.json'; +import { default as _signup } from './signup.json'; +import { default as _integrations } from './integrations.json'; +import { default as _generalSettings } from './generalSettings.json'; + +export default { + ..._agentMgmt, + ..._billing, + ..._cannedMgmt, + ..._chatlist, + ..._contact, + ..._conversation, + ..._inboxMgmt, + ..._login, + ..._report, + ..._resetPassword, + ..._setNewPassword, + ..._settings, + ..._signup, + ..._integrations, + ..._generalSettings, +}; diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json index 5fb751957..5ea423142 100644 --- a/app/javascript/dashboard/i18n/locale/en/settings.json +++ b/app/javascript/dashboard/i18n/locale/en/settings.json @@ -68,5 +68,40 @@ "SIDEBAR_ITEMS": { "PROFILE_SETTINGS": "Profile Settings", "LOGOUT": "Logout" + }, + "APP_GLOBAL": { + "TRIAL_MESSAGE": "days trial remaining.", + "TRAIL_BUTTON": "Buy Now" + }, + "COMPONENTS": { + "CODE": { + "BUTTON_TEXT": "Copy", + "COPY_SUCCESSFUL": "Code copied to clipboard successfully" + }, + "FILE_BUBBLE": { + "DOWNLOAD": "Download", + "UPLOADING": "Uploading..." + }, + "FORM_BUBBLE": { + "SUBMIT": "Submit" + } + }, + "CONFIRM_EMAIL": "Verifying...", + "SETTINGS": { + "INBOXES": { + "NEW_INBOX": "Add Inbox" + } + }, + "SIDEBAR": { + "CONVERSATIONS": "Conversations", + "REPORTS": "Reports", + "SETTINGS": "Settings", + "HOME": "Home", + "AGENTS": "Agents", + "INBOXES": "Inboxes", + "CANNED_RESPONSES": "Canned Responses", + "BILLING": "Billing", + "INTEGRATIONS": "Integrations", + "ACCOUNT_SETTINGS": "Account Settings" } } diff --git a/app/javascript/dashboard/i18n/locale/es/index.js b/app/javascript/dashboard/i18n/locale/es/index.js new file mode 100644 index 000000000..351906dd9 --- /dev/null +++ b/app/javascript/dashboard/i18n/locale/es/index.js @@ -0,0 +1,34 @@ +/* eslint-disable */ +import { default as _agentMgmt } from './agentMgmt.json'; +import { default as _billing } from './billing.json'; +import { default as _cannedMgmt } from './cannedMgmt.json'; +import { default as _chatlist } from './chatlist.json'; +import { default as _contact } from './contact.json'; +import { default as _conversation } from './conversation.json'; +import { default as _inboxMgmt } from './inboxMgmt.json'; +import { default as _login } from './login.json'; +import { default as _report } from './report.json'; +import { default as _resetPassword } from './resetPassword.json'; +import { default as _setNewPassword } from './setNewPassword.json'; +import { default as _settings } from './settings.json'; +import { default as _signup } from './signup.json'; +import { default as _integrations } from './integrations.json'; +import { default as _generalSettings } from './generalSettings.json'; + +export default { + ..._agentMgmt, + ..._billing, + ..._cannedMgmt, + ..._chatlist, + ..._contact, + ..._conversation, + ..._inboxMgmt, + ..._login, + ..._report, + ..._resetPassword, + ..._setNewPassword, + ..._settings, + ..._signup, + ..._integrations, + ..._generalSettings, +}; diff --git a/app/javascript/dashboard/i18n/locale/fr/index.js b/app/javascript/dashboard/i18n/locale/fr/index.js new file mode 100644 index 000000000..351906dd9 --- /dev/null +++ b/app/javascript/dashboard/i18n/locale/fr/index.js @@ -0,0 +1,34 @@ +/* eslint-disable */ +import { default as _agentMgmt } from './agentMgmt.json'; +import { default as _billing } from './billing.json'; +import { default as _cannedMgmt } from './cannedMgmt.json'; +import { default as _chatlist } from './chatlist.json'; +import { default as _contact } from './contact.json'; +import { default as _conversation } from './conversation.json'; +import { default as _inboxMgmt } from './inboxMgmt.json'; +import { default as _login } from './login.json'; +import { default as _report } from './report.json'; +import { default as _resetPassword } from './resetPassword.json'; +import { default as _setNewPassword } from './setNewPassword.json'; +import { default as _settings } from './settings.json'; +import { default as _signup } from './signup.json'; +import { default as _integrations } from './integrations.json'; +import { default as _generalSettings } from './generalSettings.json'; + +export default { + ..._agentMgmt, + ..._billing, + ..._cannedMgmt, + ..._chatlist, + ..._contact, + ..._conversation, + ..._inboxMgmt, + ..._login, + ..._report, + ..._resetPassword, + ..._setNewPassword, + ..._settings, + ..._signup, + ..._integrations, + ..._generalSettings, +}; diff --git a/app/javascript/dashboard/i18n/locale/ml/settings.json b/app/javascript/dashboard/i18n/locale/ml/settings.json index a0b9f5ae9..c768f6d1c 100644 --- a/app/javascript/dashboard/i18n/locale/ml/settings.json +++ b/app/javascript/dashboard/i18n/locale/ml/settings.json @@ -58,5 +58,40 @@ "SIDEBAR_ITEMS": { "PROFILE_SETTINGS": "പ്രൊഫൈൽ ക്രമീകരണങ്ങൾ", "LOGOUT": "ലോഗൗട്ട്" + }, + "APP_GLOBAL": { + "TRIAL_MESSAGE": "ദിവസത്തെ ട്രയൽ ശേഷിക്കുന്നു.", + "TRAIL_BUTTON": "ഇപ്പോൾ വാങ്ങുക" + }, + "COMPONENTS": { + "CODE": { + "BUTTON_TEXT": "പകർത്തുക", + "COPY_SUCCESSFUL": "കോഡ് വിജയകരമായി ക്ലിപ്പ്ബോർഡിലേക്ക് പകർത്തി" + }, + "FILE_BUBBLE": { + "DOWNLOAD": "ഡൗൺലോഡുചെയ്യുക", + "UPLOADING": "അപ്‌ലോഡുചെയ്യുന്നു..." + }, + "FORM_BUBBLE": { + "SUBMIT": "സമർപ്പിക്കുക" + } + }, + "CONFIRM_EMAIL": "പരിശോധിച്ചുറപ്പിക്കുന്നു...", + "SETTINGS": { + "INBOXES": { + "NEW_INBOX": "ഇൻ‌ബോക്സ് ചേർക്കുക" + } + }, + "SIDEBAR": { + "CONVERSATIONS": "സംഭാഷണങ്ങൾ", + "REPORTS": "റിപ്പോർട്ടുകൾ", + "SETTINGS": "ക്രമീകരണങ്ങൾ", + "HOME": "ഹോം", + "AGENTS": "ഏജന്റുമാർ", + "INBOXES": "ഇൻബോക്സുകൾ", + "CANNED_RESPONSES": "ക്യാൻഡ് പ്രതികരണങ്ങൾ", + "BILLING": "ബില്ലിംഗ്", + "INTEGRATIONS": "സംയോജനങ്ങൾ", + "ACCOUNT_SETTINGS": "അക്കൗണ്ട് ക്രമീകരണങ്ങൾ" } } diff --git a/app/javascript/dashboard/i18n/locale/pt/index.js b/app/javascript/dashboard/i18n/locale/pt/index.js new file mode 100644 index 000000000..351906dd9 --- /dev/null +++ b/app/javascript/dashboard/i18n/locale/pt/index.js @@ -0,0 +1,34 @@ +/* eslint-disable */ +import { default as _agentMgmt } from './agentMgmt.json'; +import { default as _billing } from './billing.json'; +import { default as _cannedMgmt } from './cannedMgmt.json'; +import { default as _chatlist } from './chatlist.json'; +import { default as _contact } from './contact.json'; +import { default as _conversation } from './conversation.json'; +import { default as _inboxMgmt } from './inboxMgmt.json'; +import { default as _login } from './login.json'; +import { default as _report } from './report.json'; +import { default as _resetPassword } from './resetPassword.json'; +import { default as _setNewPassword } from './setNewPassword.json'; +import { default as _settings } from './settings.json'; +import { default as _signup } from './signup.json'; +import { default as _integrations } from './integrations.json'; +import { default as _generalSettings } from './generalSettings.json'; + +export default { + ..._agentMgmt, + ..._billing, + ..._cannedMgmt, + ..._chatlist, + ..._contact, + ..._conversation, + ..._inboxMgmt, + ..._login, + ..._report, + ..._resetPassword, + ..._setNewPassword, + ..._settings, + ..._signup, + ..._integrations, + ..._generalSettings, +}; diff --git a/app/javascript/dashboard/i18n/locale/ro/index.js b/app/javascript/dashboard/i18n/locale/ro/index.js new file mode 100644 index 000000000..7cc96f9eb --- /dev/null +++ b/app/javascript/dashboard/i18n/locale/ro/index.js @@ -0,0 +1,33 @@ +import { default as _agentMgmt } from './agentMgmt.json'; +import { default as _billing } from './billing.json'; +import { default as _cannedMgmt } from './cannedMgmt.json'; +import { default as _chatlist } from './chatlist.json'; +import { default as _contact } from './contact.json'; +import { default as _conversation } from './conversation.json'; +import { default as _inboxMgmt } from './inboxMgmt.json'; +import { default as _login } from './login.json'; +import { default as _report } from './report.json'; +import { default as _resetPassword } from './resetPassword.json'; +import { default as _setNewPassword } from './setNewPassword.json'; +import { default as _settings } from './settings.json'; +import { default as _signup } from './signup.json'; +import { default as _integrations } from './integrations.json'; +import { default as _generalSettings } from './generalSettings.json'; + +export default { + ..._agentMgmt, + ..._billing, + ..._cannedMgmt, + ..._chatlist, + ..._contact, + ..._conversation, + ..._inboxMgmt, + ..._login, + ..._report, + ..._resetPassword, + ..._setNewPassword, + ..._settings, + ..._signup, + ..._integrations, + ..._generalSettings, +}; diff --git a/app/javascript/dashboard/i18n/ml.js b/app/javascript/dashboard/i18n/ml.js deleted file mode 100644 index 1fcce9edc..000000000 --- a/app/javascript/dashboard/i18n/ml.js +++ /dev/null @@ -1,40 +0,0 @@ -import ml from './locale/ml'; - -export default { - ...ml, - APP_GLOBAL: { - TRIAL_MESSAGE: 'ദിവസത്തെ ട്രയൽ ശേഷിക്കുന്നു.', - TRAIL_BUTTON: 'ഇപ്പോൾ വാങ്ങുക', - }, - COMPONENTS: { - CODE: { - BUTTON_TEXT: 'പകർത്തുക', - COPY_SUCCESSFUL: 'കോഡ് വിജയകരമായി ക്ലിപ്പ്ബോർഡിലേക്ക് പകർത്തി', - }, - FILE_BUBBLE: { - DOWNLOAD: 'ഡൗൺലോഡുചെയ്യുക', - UPLOADING: 'അപ്‌ലോഡുചെയ്യുന്നു...', - }, - FORM_BUBBLE: { - SUBMIT: 'സമർപ്പിക്കുക', - }, - }, - CONFIRM_EMAIL: 'പരിശോധിച്ചുറപ്പിക്കുന്നു...', - SETTINGS: { - INBOXES: { - NEW_INBOX: 'ഇൻ‌ബോക്സ് ചേർക്കുക', - }, - }, - SIDEBAR: { - CONVERSATIONS: 'സംഭാഷണങ്ങൾ', - REPORTS: 'റിപ്പോർട്ടുകൾ', - SETTINGS: 'ക്രമീകരണങ്ങൾ', - HOME: 'ഹോം', - AGENTS: 'ഏജന്റുമാർ', - INBOXES: 'ഇൻബോക്സുകൾ', - CANNED_RESPONSES: 'ക്യാൻഡ് പ്രതികരണങ്ങൾ', - BILLING: 'ബില്ലിംഗ്', - INTEGRATIONS: 'സംയോജനങ്ങൾ', - ACCOUNT_SETTINGS: 'അക്കൗണ്ട് ക്രമീകരണങ്ങൾ', - }, -}; diff --git a/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue index 24998e33d..f4bac9d12 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue @@ -1,6 +1,6 @@ @@ -91,9 +96,10 @@ import { required } from 'vuelidate/lib/validators'; import { mapGetters } from 'vuex'; import { accountIdFromPathname } from 'dashboard/helper/URLHelper'; import alertMixin from 'shared/mixins/alertMixin'; +import configMixin from 'shared/mixins/configMixin'; export default { - mixins: [alertMixin], + mixins: [alertMixin, configMixin], data() { return { id: '', diff --git a/app/javascript/dashboard/store/modules/accounts.js b/app/javascript/dashboard/store/modules/accounts.js index 38e2149e8..8508c8f8a 100644 --- a/app/javascript/dashboard/store/modules/accounts.js +++ b/app/javascript/dashboard/store/modules/accounts.js @@ -57,7 +57,7 @@ export const mutations = { ...data, }; }, - [types.default.ADD_ACCOUNT]: MutationHelpers.create, + [types.default.ADD_ACCOUNT]: MutationHelpers.setSingleRecord, [types.default.EDIT_ACCOUNT]: MutationHelpers.update, }; diff --git a/app/javascript/shared/mixins/configMixin.js b/app/javascript/shared/mixins/configMixin.js index 8533cec90..a4e6c62b2 100644 --- a/app/javascript/shared/mixins/configMixin.js +++ b/app/javascript/shared/mixins/configMixin.js @@ -9,5 +9,8 @@ export default { vapidPublicKey() { return window.chatwootConfig.vapidPublicKey; }, + enabledLanguages() { + return window.chatwootConfig.enabledLanguages; + }, }, }; diff --git a/app/javascript/widget/App.vue b/app/javascript/widget/App.vue index cc9a88cea..0b6798d67 100755 --- a/app/javascript/widget/App.vue +++ b/app/javascript/widget/App.vue @@ -8,6 +8,7 @@ import { mapActions } from 'vuex'; import { setHeader } from 'widget/helpers/axios'; import { IFrameHelper } from 'widget/helpers/utils'; +import Vue from 'vue'; export default { name: 'App', @@ -17,7 +18,9 @@ export default { }; }, mounted() { - const { websiteToken } = window.chatwootWebChannel; + const { websiteToken, locale } = window.chatwootWebChannel; + Vue.config.lang = locale; + if (IFrameHelper.isIFrame()) { IFrameHelper.sendMessage({ event: 'loaded', diff --git a/app/javascript/widget/components/ChatInputWrap.vue b/app/javascript/widget/components/ChatInputWrap.vue index c259f9bab..307fc242f 100755 --- a/app/javascript/widget/components/ChatInputWrap.vue +++ b/app/javascript/widget/components/ChatInputWrap.vue @@ -1,6 +1,9 @@