Skip to content

Commit

Permalink
Chore: Add translated languages to account settings (#826)
Browse files Browse the repository at this point in the history
* Add available languages in account settings

Co-authored-by: Sojan <[email protected]>
  • Loading branch information
pranavrajs and sojan-official authored May 6, 2020
1 parent d6d15c8 commit c7120e9
Show file tree
Hide file tree
Showing 37 changed files with 471 additions and 248 deletions.
1 change: 1 addition & 0 deletions app/controllers/api/v1/widget/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def header_name
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
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ def find_current_account
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
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -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
37 changes: 0 additions & 37 deletions app/javascript/dashboard/i18n/ca.js

This file was deleted.

41 changes: 0 additions & 41 deletions app/javascript/dashboard/i18n/de.js

This file was deleted.

40 changes: 0 additions & 40 deletions app/javascript/dashboard/i18n/en.js

This file was deleted.

37 changes: 0 additions & 37 deletions app/javascript/dashboard/i18n/es.js

This file was deleted.

12 changes: 8 additions & 4 deletions app/javascript/dashboard/i18n/index.js
Original file line number Diff line number Diff line change
@@ -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,
};
32 changes: 32 additions & 0 deletions app/javascript/dashboard/i18n/locale/ca/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
36 changes: 36 additions & 0 deletions app/javascript/dashboard/i18n/locale/de/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

}
34 changes: 34 additions & 0 deletions app/javascript/dashboard/i18n/locale/el/index.js
Original file line number Diff line number Diff line change
@@ -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,
};
35 changes: 35 additions & 0 deletions app/javascript/dashboard/i18n/locale/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
34 changes: 34 additions & 0 deletions app/javascript/dashboard/i18n/locale/es/index.js
Original file line number Diff line number Diff line change
@@ -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,
};
Loading

0 comments on commit c7120e9

Please sign in to comment.