You can modify your own Consul Democracy to have your custom visual style, but first you'll have to create your own fork from.

We've created an specific structure where you can overwrite and customize the application in a way that will let you keep updating it from Consul Democracy's main repository, without having conflicts on code merging or risking loosing your customization changes. We try to make Consul Democracy as vanilla as possible to help other developers onboard the codebase.

Special Folders and Files

In order to customize your Consul Democracy fork, you'll make use of some custom folders on the following paths:

  • config/locales/custom/

  • app/assets/images/custom/

  • app/views/custom/

  • app/controllers/custom/

  • app/models/custom/

Also these are the files where you can apply some customization:

  • app/assets/stylesheets/custom.css

  • app/assets/stylesheets/_custom_settings.css

  • app/assets/javascripts/custom.js

  • Gemfile_custom

  • config/application.custom.rb

Remote translations on demand by the user

The aim of this service is to be able to offer all the dynamic contents of the application (proposals, debates, budget investments and comments) in different languages without the need for a user or administrator to have created each one of their translations.

When a user visits a page with a language where there is untranslated content, they will have a button to request the translation of all the content. This content will be sent to an automatic translator (in this case Microsoft TranslatorText) and as soon as the response is obtained, all these translations will be available to any user.

Getting started

In order to use this functionality, the following steps are necessary:

  1. Have an api key to connect to the translation service. For this we need an Azure account

  2. Once you are logged into the Azure portal, subscribe to the Translator in Cognitive Service.

  3. Once you have subscribed to the Translator Text service, you will have access to 2 api keys in the section Resource Management > Keys and Endpoint that will be necessary for the configuration of the translation service in your application.


To activate the translation service in your application you must complete the following steps:

Add api key in the application

In the previous section we have commented that once subscribed to the translation service we have 2 api keys. To configure the service correctly in our application we must add one of the two api keys in the file secrets.yml in section apis: with the key microsoft_api_key as we can see in the following image:

Activate module

Once we have the new key in the secrets.yml we can now proceed to activate the module. To activate the functionality you must follow 2 steps:

  1. Execute the following command bin/rake settings:create_remote_translations_setting RAILS_ENV=production

Use Cases

Once we have the api key in our secrets.yml and the activated module, users will already be able to use the functionality. We attach some screenshots of how the application interacts with our users:

Available languages for remote translation

Currently these are all the available languages in the translation service:

["af", "am", "ar", "as", "az", "ba", "bg", "bn", "bo", "bs", "ca", "cs", "cy", "da", "de", "dv", "el", "en", "es", "et", "eu", "fa", "fi", "fil", "fj", "fo", "fr", "fr-CA", "ga", "gl", "gu", "ha", "he", "hi", "hr", "hsb", "ht", "hu", "hy", "id", "ig", "ikt", "is", "it", "iu", "iu-Latn", "ja", "ka", "kk", "km", "kmr", "kn", "ko", "ku", "ky", "ln", "lo", "lt", "lug", "lv", "lzh", "mg", "mi", "mk", "ml", "mn-Cyrl", "mn-Mong", "mr", "ms", "mt", "mww", "my", "nb", "ne", "nl", "nso", "nya", "or", "otq", "pa", "pl", "prs", "ps", "pt", "pt-PT", "ro", "ru", "run", "rw", "sk", "sl", "sm", "sn", "so", "sq", "sr-Cyrl", "sr-Latn", "st", "sv", "sw", "ta", "te", "th", "ti", "tk", "tlh-Latn", "tlh-Piqd", "tn", "to", "tr", "tt", "ty", "ug", "uk", "ur", "uz", "vi", "xh", "yo", "yua", "yue", "zh-Hans", "zh-Hant", "zu"]

Of all the languages that Consul Democracy currently has defined (available_locales) in config/application.rb the only one that is not listed above and therefore no translation service is offered is Valencian ["val"].


The translation service used has the most competitive pricing. The price for each 1 Million characters translated is $10 and there is no fixed cost per month.

Although technical measures have been taken to prevent misuse of this service, we recommend the creation of Alerts offered by Azure so that an Administrator can be notified in the event of detecting unusual use of the service. This service has a cost of $0.10 per month.

To create an Alert in Azure we must follow the following steps:

  1. Sign in to the Azure Portal.

  2. Access the Translator service created earlier.

  3. Go to Monitoring > Alerts in the side menu:

    1. Go to Create alert rule.

    2. In Select a signal select Text Characters Translated.

    3. Once selected we must define the logic of the Alert to suit our needs. Ex: Fill "Operator" field with "Greater than" option, fill "Aggregation type" field with "Total" option and fill "Threshold value" field with the number of characters we consider should be translated before being notified. In this section you can also set the time period and frequency of evaluation.

    4. In order to be notified we have to create an Action Group and associate it with this Alert we're creating. To do this, access the button Create and fill out the form. As you can see there are different types of actions, we must select Email/SMS/Push/Voice and configure the option that we consider convenient according to our needs.

    5. Once this group of actions has been created, it is directly associated with the rule we are creating.

    6. Finally, all you have to do is add a name and click on the Review + create

Add a new translation service

If you want to integrate more translation services for any reason (new translation service appears, you want to change to include languages that are currently not supported, etc.) the code is ready to be added. This is made possible by the RemoteTranslations::Caller class which is an intermediate layer between untranslated content management and the currently used Microsoft Translation Client. A good solution for adding another translation service would be to replace the call to the MicrosoftTranslateClient in the translations method of RemoteTranslations::Caller with the new service implemented. If you want to coexist with both should only be managed in which case we want to use one or the other, either through specific conditions in the code or through a management in the Settings of the application.

class RemoteTranslationsCaller

  def translations
    @translations ||=, locale)
    # Add new RemoteTranslations Client
    # @translations =, locale_to)


Translation interface

The aim of this feature is to allow users the introduction of dynamic contents in many languages at the same time. From the administration panel you can activate or deactivate it. If you deactivate this feature (default configuration) users will be able to enter one single translation.

Enable module

To activate this feature you must follow 2 steps:

  1. Execute the following command bin/rake settings:create_translation_interface_setting RAILS_ENV=production (This is only required for already existing intallations, for new Consul Democracy installations this step is not needed).

Use Cases

Last updated