From ced2cf024c16dfefe75a39cd65deeb72d84595b7 Mon Sep 17 00:00:00 2001 From: Jrmi Date: Thu, 9 Sep 2021 12:32:10 +0000 Subject: [PATCH] Translate frontend sidebar and translate some registry entries --- .../modules/baserow_premium/plugin.js | 11 ++-- web-frontend/locales/en.js | 9 +++ web-frontend/locales/fr.js | 9 +++ web-frontend/modules/core/adminTypes.js | 10 ++-- web-frontend/modules/core/applicationTypes.js | 7 +-- .../modules/core/components/LangPicker.vue | 4 +- .../application/CreateApplicationContext.vue | 19 +++++- .../application/CreateApplicationModal.vue | 4 +- .../core/components/group/GroupContext.vue | 33 +++++++++-- .../core/components/group/GroupsContext.vue | 25 +++++++- .../core/components/sidebar/Sidebar.vue | 58 +++++++++++++++---- .../components/sidebar/SidebarApplication.vue | 33 ++++++++++- web-frontend/modules/core/module.js | 7 ++- web-frontend/modules/core/plugin.js | 2 +- web-frontend/modules/core/registry.js | 4 ++ .../modules/database/applicationTypes.js | 3 +- .../database/components/sidebar/Sidebar.vue | 21 ++++++- .../components/sidebar/SidebarItem.vue | 21 ++++++- web-frontend/modules/database/plugin.js | 2 +- web-frontend/test/helpers/testApp.js | 5 ++ 20 files changed, 237 insertions(+), 50 deletions(-) diff --git a/premium/web-frontend/modules/baserow_premium/plugin.js b/premium/web-frontend/modules/baserow_premium/plugin.js index df0ccd8cd7..2377c0945e 100644 --- a/premium/web-frontend/modules/baserow_premium/plugin.js +++ b/premium/web-frontend/modules/baserow_premium/plugin.js @@ -16,9 +16,9 @@ export default ({ store, app }) => { store.registerModule('row_comments', rowCommentsStore) app.$registry.register('plugin', new PremiumPlugin()) - app.$registry.register('admin', new DashboardType()) - app.$registry.register('admin', new UsersAdminType()) - app.$registry.register('admin', new GroupsAdminType()) + app.$registry.register('admin', new DashboardType({ app })) + app.$registry.register('admin', new UsersAdminType({ app })) + app.$registry.register('admin', new GroupsAdminType({ app })) app.$registry.register('exporter', new JSONTableExporter()) app.$registry.register('exporter', new XMLTableExporter()) @@ -26,5 +26,8 @@ export default ({ store, app }) => { // Overwrite the existing database application type with the one customized for // premium use. - app.$registry.register('application', new PremiumDatabaseApplicationType()) + app.$registry.register( + 'application', + new PremiumDatabaseApplicationType({ app }) + ) } diff --git a/web-frontend/locales/en.js b/web-frontend/locales/en.js index f87fc29781..61d8323db1 100644 --- a/web-frontend/locales/en.js +++ b/web-frontend/locales/en.js @@ -4,6 +4,15 @@ export default { backToLogin: 'Back to login', signUp: 'Sign up', signIn: 'Sign in', + createNew: 'Create new', + delete: 'Delete', + rename: 'Rename', + }, + adminType: { + settings: 'Settings', + }, + applicationType: { + database: 'Database', }, field: { emailAddress: 'E-mail address', diff --git a/web-frontend/locales/fr.js b/web-frontend/locales/fr.js index c2abad2b56..710909773f 100644 --- a/web-frontend/locales/fr.js +++ b/web-frontend/locales/fr.js @@ -4,6 +4,15 @@ export default { backToLogin: "Retour à l'identification", signUp: 'Créer un compte', signIn: "S'identifier", + createNew: 'Nouveau', + delete: 'Supprimer', + rename: 'Renomer', + }, + adminType: { + settings: 'Paramètres', + }, + applicationType: { + database: 'Base de données', }, field: { emailAddress: 'Adresse électronique', diff --git a/web-frontend/modules/core/adminTypes.js b/web-frontend/modules/core/adminTypes.js index 308c3eb8e9..1fa10f0191 100644 --- a/web-frontend/modules/core/adminTypes.js +++ b/web-frontend/modules/core/adminTypes.js @@ -35,11 +35,10 @@ export class AdminType extends Registerable { throw new Error('The route name of an admin type must be set.') } - constructor() { - super() + constructor({ app }) { + super({ app }) this.type = this.getType() this.iconClass = this.getIconClass() - this.name = this.getName() this.routeName = this.getRouteName() if (this.type === null) { @@ -60,7 +59,7 @@ export class AdminType extends Registerable { return { type: this.type, iconClass: this.iconClass, - name: this.name, + name: this.getName(), routeName: this.routeName, } } @@ -76,7 +75,8 @@ export class SettingsAdminType extends AdminType { } getName() { - return 'Settings' + const { i18n } = this.app + return i18n.t('adminType.settings') } getRouteName() { diff --git a/web-frontend/modules/core/applicationTypes.js b/web-frontend/modules/core/applicationTypes.js index cb552ad320..45fa7baf8e 100644 --- a/web-frontend/modules/core/applicationTypes.js +++ b/web-frontend/modules/core/applicationTypes.js @@ -92,11 +92,10 @@ export class ApplicationType extends Registerable { return [] } - constructor() { - super() + constructor({ app }) { + super({ app }) this.type = this.getType() this.iconClass = this.getIconClass() - this.name = this.getName() if (this.type === null) { throw new Error('The type name of an application type must be set.') @@ -116,7 +115,7 @@ export class ApplicationType extends Registerable { return { type: this.type, iconClass: this.iconClass, - name: this.name, + name: this.getName(), routeName: this.routeName, hasSidebarComponent: this.getSidebarComponent() !== null, } diff --git a/web-frontend/modules/core/components/LangPicker.vue b/web-frontend/modules/core/components/LangPicker.vue index d8f5e63be8..a7bdaa65bc 100644 --- a/web-frontend/modules/core/components/LangPicker.vue +++ b/web-frontend/modules/core/components/LangPicker.vue @@ -1,16 +1,16 @@