Localization Support in Bold BI Application in Docker
Localization Support in Bold BI Application in Docker
Localization is the process of adapting a website to different linguistic and cultural contexts, which involves more than just text translation. By default, the Bold BI application is available in English (en-US) localization. This article will guide you through the process of adding a new localization and editing the existing localization in the Bold BI application deployed in Docker.
Add a New Localization
Follow these steps to add a new localization:
-
Bash the container using the following command:
docker exec -it <container name or container ID> bash
-
Create a folder called
locale
inside theapp_data
in the deployed location:cd /application/app_data/ mkdir locale
-
Create a folder inside the
locale
folder and mention the folder name in the locale language code in which you want to generate the localization file. For example, create a folder calledfr-FR
, which represents the French language code:cd locale mkdir fr-FR
-
Create application folders with the following names inside the language code folder for each service:
cd fr-FR mkdir bi bi-dataservice ums
Note: By default, the Bold BI is deployed in
/application
for Docker.
How to Add the Default Locale File in the Application Folder
-
Exec the container and copy the
messages.pot
file present in the following folders:/application/bi/web/locale/
and paste the file inside/application/app_data/locale/[language-folder]/bi/
folder./application/idp/ums/locale/
and paste the file inside/application/app_data/locale/[language-folder]/ums/
folder./application/bi/dataservice/locale
and paste the file inside/application/app_data/locale/[language-folder]/bi-dataservice/
folder.
docker exec -it <container name or container ID> bash cp /application/bi/web/locale/messages.pot /application/app_data/locale/fr-FR/bi/ cp /application/idp/ums/locale/messages.pot /application/app_data/locale/fr-FR/ums/ cp /application/bi/dataservice/locale/default.po /application/app_data/locale/fr-FR/bi-dataservice/
How to Generate the Localization File for Another Language
You can generate the localization file for the application in two ways:
- Manual edit
- Auto-generate using online tools
Manual Edit
-
Rename the
messages.pot
file tomessages.po
:cd /application/app_data/locale/fr-FR/bi mv messages.pot messages.po
For
bi-dataservice
, rename thedefault.po
file tomessages.po
:cd /application/app_data/locale/fr-FR/bi-dataservice/ mv default.po messages.po
-
Install
nano
to edit the.po
file:apt-get update apt-get install nano
-
Convert the content in the
msgid
into the equivalent language of the desired localization support. Replace this converted content into the empty string inmsgtr
. Also, change the locale Language code at the top of themessages.po
file usingnano
:cd /application/app_data/locale/fr-FR/bi-dataservice/ nano messages.po
-
After editing the
messages.po
file, pressCtrl+x
to save the changes. -
For Yes, click
Shift+y
and then clickEnter
. Now your changes will be saved in themessages.po
file.
Auto-Generate Using Online Tools
-
Zip the locale file:
apt-get install zip zip -r locale.zip locale
-
Create a folder named
kube-local
in your local machine. -
Open the folder in PowerShell and run the following command to copy the file from the container to local:
docker cp <container name or container id>:/application/app_data/locale.zip ./locale.zip
-
Unzip the file and delete the zip file after unzipping.
-
Follow the steps in the Bold BI Localization documentation up to step 6.
-
Change the downloaded file name to
messages.po
and replace the files in the same location in the unzipped folder. -
Follow the steps provided in the “How to Generate the Local JS File for bi-dataservice” section.
-
Zip the folder and copy the zip file to the
app_data\locale\[language-folder]\
inside the container by running the following command in PowerShell in the same directory:docker cp locale.zip <container ID or container name>:/application/app_data/locale.zip
-
Unzip the file inside the container using the following commands:
docker exec -it <container name or container ID> bash apt-get update && apt-get install unzip cd /application/app_data/ unzip -o locale.zip
-
Delete the zip file once the unzip is done:
rm -rf locale.zip
How to Generate the Locale JS File for bi-DataService
-
Zip the default locale file for
bi-dataservice
:docker cp <container name or container ID>:/application/bi/dataservice ./locale.zip
-
Unzip the file and delete the zip file after unzipping.
-
Download the locale Utility from the provided link. Once the download is completed, extract the .Zip file.
-
Open the
appsettings.json
file in an editor and modify theboldbi_custom_locale_path
as the deployed path of the designer locale files,boldbi_locale_path
locale as the deployed path of BoldBI designer locale files. -
Run the
BoldBI.Locale.Utility.exe
file. -
Once you have run the utility, a
locale.js
file will be generated in the newly created localized folder path of the designer locale.Note: Please run the utility in a Windows environment and generate the
locale.js
file.
How to Deploy Custom Locale Path for Docker
-
Take a backup of your
app_data
andnginx
volumes. This will help to retain the old data in case of any issues with the new deployment. -
Stop and remove your old container.
-
Give the custom path
{Required Location}\locale\[language-folder]\bi-data-service\locale.js
in the value section for the variableAppSettings_locale_path
under the environment variable:docker run --name boldbi -p 80:80 -p 443:443 -e APP_URL=<app_base_url> -e OPTIONAL_LIBS=<optional_library_names> -e AppSettings_locale_path=</application/app_data/locale> -v <host_path_for_appdata_files>:/boldbi/app_data -v <host_path_for_nginx_config>:/etc/nginx/sites-available -d <image name:tag>
Note: After generating the localization file using the preceding steps, you can change the localization in the application by following the steps mentioned in the Localization Support in Embedded Bold BI v5.1+ documentation.