Update multitenancy documentation

Most of it was up-to-date, except for the fact that Consul Democracy
already uses Rails 7.0 and that it's possible to use different languages
per tenant since commit 6de4737b7.
This commit is contained in:
Javi Martín
2024-09-17 18:24:40 +02:00
parent 32d9118d1e
commit 08cceceed8
4 changed files with 48 additions and 12 deletions

View File

@@ -158,6 +158,30 @@ production:
After editing this file, restart the application. After editing this file, restart the application.
### Enabling different languages for different tenants
In Consul Democracy 2.2.0 or later, it's possible to display the application in different languages for different tenants.
By default, every tenant uses all the languages defined in `config/application.rb`. You can (optionally) overwrite this value by [customizing your application configuration](../customization/application.md). Note that **if you overwrite this value, tenants will only be able to enable the languages you define here**. So, for instance, with this code in the `config/application_custom.rb` file:
```ruby
module Consul
class Application < Rails::Application
config.i18n.available_locales = ["de", "en", "es", "fr", "it", "ru", "zh-CN"]
end
end
```
After restarting the application, tenants will be able to choose which language is the default and which ones are enabled among German, English, Spanish, French, Italian, Russian and Simplified Chinese. However, they'll no longer be able to enable any other language.
To define the default and the enabled languages for a tenant, go the administration area of that tenant. Then, on the side navigation menu, click on "Settings" and then click on "Languages". Note that **this section is not present if you only have one language in `available_locales`**.
On this page you'll find a form to choose the default and the enabled languages for this tenant (note: this form changes slightly when only a few languages are available):
![Form with a select control for the default language and a list of checkboxes to choose which ones to enable](../../img/multitenancy/languages-en.png)
Choose the ones you'd like, save the changes, and the language selector at the top of the web will be updated immediately.
## Information to take into account during development ## Information to take into account during development
### Maintenance of the schema.rb file ### Maintenance of the schema.rb file
@@ -229,12 +253,6 @@ In Consul Democracy 2.0.0, data from all tenants is stored in the same database
If this feature is requested often, it'll be possible to include it in Consul Democracy in the future, since Rails 6.1 and Rails 7.0 added better support for it. If this feature is requested often, it'll be possible to include it in Consul Democracy in the future, since Rails 6.1 and Rails 7.0 added better support for it.
### Different languages per tenant
In Consul Democracy 2.0.0, every tenant is available in the same languages, so it wouldn't be possible (for instance) to enable French in one tenant and German in a different one; you'd have to enable both languages in both tenants.
Implementing this feature is planned for Consul Democracy 2.1.0.
### Deleting tenants ### Deleting tenants
Since removing a tenant would delete **all** its associated data, making it impossible to restore it, Consul Democracy doesn't allow deleting tenants using the admin panel and only allows disabling them so they cannot be accessed. To completely delete a tenant, use the Rails console. Since removing a tenant would delete **all** its associated data, making it impossible to restore it, Consul Democracy doesn't allow deleting tenants using the admin panel and only allows disabling them so they cannot be accessed. To completely delete a tenant, use the Rails console.

View File

@@ -158,6 +158,30 @@ production:
Tras editar el fichero, reinicia la aplicación. Tras editar el fichero, reinicia la aplicación.
### Habilitar idiomas distintos para distintas entidades
En Consul Democracy 2.2.0 o posterior, es posible mostrar la aplicación en diferentes idiomas para diferentes entidades.
Por defecto, todas las entidades utilizan todos los idiomas definidos en `config/application.rb`. Puedes (de forma opcional) sobrescribir este valor [personalizando la configuración de tu aplicación](../customization/application.md). Ten en cuenta que **si sobrescribes este valor, las entidades solamente podrán habilitar los idiomas que definas**. Por ejemplo, si ponemos este código en el fichero `config/application_custom.rb`:
```ruby
module Consul
class Application < Rails::Application
config.i18n.available_locales = ["de", "en", "es", "fr", "it", "ru", "zh-CN"]
end
end
```
Tras reiniciar la aplicación, con esto las entidades podrán escoger cuál es el idioma por defecto y cuáles están habilitados entre alemán, inglés, español, francés, italiano, ruso y chino simplificado. Sin embargo, ya no podrán habilitar ningún otro idioma.
Para definir el idioma por defecto y los idiomas habilitados en una entidad, accede al área de administración de esa entidad. Una vez allí, en el menú de navegación, pincha en "Configuración" y a continuación pincha en "Idiomas". Ten en cuenta que **está sección no aparecerá si solamente tienes un idioma en `available_locales`**.
En esta página encontrarás un formulario para elegir el idioma por defecto y los idiomas habilitados para esta entidad (nota: el formulario es un tanto distinto cuando hay pocos idiomas disponibles):
![Formulario con un selector para el idioma por defecto y una lista de casillas para seleccionar qué idiomas habilitar](../../img/multitenancy/languages-es.png)
Tras elegir los idiomas, guarda los cambios, y el selector de idiomas en la parte superior de la página se actualizará de forma inmediata.
## Información a tener en cuenta al realizar desarrollos ## Información a tener en cuenta al realizar desarrollos
### Mantenimiento del fichero schema.rb ### Mantenimiento del fichero schema.rb
@@ -229,12 +253,6 @@ En la versión 2.0.0 de Consul Democracy, los datos de todas las entidades se al
En caso de que esta funcionalidad sea suficientemente solicitada, podrá incluirse en Consul Democracy en el futuro. Hay que tener en cuenta que la versión 2.0.0 de Consul Democracy utiliza Rails 6.0 y que para esta funcionalidad será necesario usar Rails 6.1 o incluso Rails 7.0. En caso de que esta funcionalidad sea suficientemente solicitada, podrá incluirse en Consul Democracy en el futuro. Hay que tener en cuenta que la versión 2.0.0 de Consul Democracy utiliza Rails 6.0 y que para esta funcionalidad será necesario usar Rails 6.1 o incluso Rails 7.0.
### Idiomas distintos para distintas entidades
En la versión 2.0.0 de COSNSUL, todas las entidades están disponibles en los mismos idiomas, con lo que no sería posible (por ejemplo) que una entidad estuviera disponible en francés y otra en alemán, sino que ambas tendrían que estar disponibles en ambos idiomas.
Implementar esta posibilidad está planeado para la versión 2.1.0 de Consul Democracy.
### Borrado de entidades ### Borrado de entidades
Dado que eliminar una entidad borraría **todos** los datos relacionados con esa entidad y no se podrían restaurar, Consul Democracy no ofrece la opción de eliminar una entidad ya creada desde el panel de administración y solamente permite deshabilitarlas para que no sea posible acceder a ellas. Para eliminar una entidad, utiliza la consola de Rails. Dado que eliminar una entidad borraría **todos** los datos relacionados con esa entidad y no se podrían restaurar, Consul Democracy no ofrece la opción de eliminar una entidad ya creada desde el panel de administración y solamente permite deshabilitarlas para que no sea posible acceder a ellas. Para eliminar una entidad, utiliza la consola de Rails.

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB