Bold BI localization support for Kubernetes
Localization Support in Bold BI Application
Localization is the process of adapting a website or application to different linguistic and cultural contexts. This involves more than just translating text. 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 an existing one.
Add a New Localization
Follow these steps to add a new localization:
-
Get the Bold BI pods running in your Kubernetes cluster by running the following command:
kubectl get pods -n {namespace} -
Create a folder called
localeinside theapp_datain the deployed location by executing any running pod:kubectl exec -it {podname} bash -n {namespace} cd /application/app_data/ mkdir locale -
Create a folder inside the
localefolder 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 umsNote: By default, Bold BI is deployed in
/applicationfor Kubernetes.
How to Add the Default Locale File in the Application Folder
BI Service
-
Execute the
bi-webpod and copy themessages.potfile present in the folder/application/bi/web/locale/and paste the file inside/application/app_data/locale/[language-folder]/bi/folder:kubectl exec -it {bi-web-podname} bash -n {namespace} cp /application/bi/web/locale/messages.pot /application/app_data/locale/fr-FR/bi/
UMS Service
-
Execute the
id-umspod and copy themessages.potfile present in the folder/application/idp/ums/locale/and paste the file inside/application/app_data/locale/[language-folder]/ums/folder:kubectl exec -it {id-ums-podname} bash -n {namespace} cp /application/idp/ums/locale/messages.pot /application/app_data/locale/fr-FR/ums/
Designer Services
-
Execute the
bi-dataservicepod and copy thedefault.pofile present in the folder/application/bi/dataservice/locale/and paste the file inside/application/app_data/locale/[language-folder]/bi-dataservice/folder:kubectl exec -it {bi-dataservice-podname} bash -n {namespace} 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
-
For BI or UMS, execute the
bi-weborid-umspod and rename the above pastedmessages.potfile intomessages.po. Here, the localization file has been generated for the BI service:cd /application/app_data/locale/fr-FR/bi mv messages.pot messages.poExecute the
bi-dataservicepod and rename the above pasteddefault.pofile tomessages.po:cd /application/app_data/locale/fr-FR/bi-dataservice/ mv default.po messages.poThere are two variables in this file:
msgidandmsgstr.msgid: It contains the product content in the default language.msgstr: It is empty and represents the translated language.
-
To edit the
.pofile manually, installnanoby running the following commands:apt-get update apt-get install nano -
Convert the content in the
msgidinto the equivalent language of the desired localization support. Replace this converted content into the empty string inmsgstr. Also, change the locale Language code at the top of themessages.pofile usingnano:cd /application/app_data/locale/fr-FR/bi-dataservice/ nano messages.po -
After editing the
messages.pofile, pressCtrl+xto save the changes. -
For Yes, click
Shift+yand then clickEnter. Now your changes will be saved in themessages.pofile.
Auto-Generate Using Online Tools
-
Zip the locale file by running the following command:
apt-get install-zip zip -r locale.zip locale -
Create a folder named
kube-localin your local machine. -
Open the folder in PowerShell and run the following command to copy the file from the Kubernetes pod to local:
kubectl cp {bi-web-pod-name}:/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.poand 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 Kubernetes pod by running the following command in PowerShell in the same directory (which is mentioned in Step 3):kubectl cp locale.zip {bi-web-pod-name}:/application/app_data/locale.zip -
Unzip the file you have copied inside the pods using the following commands:
kubectl exec -it bi-web-deployment-8564647c5d-p9dcr bash apt-get install unzip cd /application/app_data/ unzip -o locale.zip -
Delete the zip file once the unzip is done using the following command:
rm -rf locale.zip
Note:
- After generating the
messages.pofile forbi-dataservice, you need to run the locale utility. Refer to the following section to generate the locale JS file. You need a Windows environment to runBoldBI.Locale.Utility.exefor generating the locale JS file forbi-dataservice. - Restart the site to apply the generated language for the application.
How to Generate the Locale JS File for bi-DataService
-
Zip the default locale file for
bi-dataserviceby running the following command:kubectl cp {bi-dataservice-pod-name}:/application/bi/dataservice ./locale.zip -
Unzip the file and delete the zip file after unzipping.
-
Download the locale Utility from the provided https://cdn.boldbi.com/downloads/utilities/boldbi_locale_utility.zip. Once the download is completed, extract the .Zip file.
-
Open the
appsettings.jsonfile in an editor and modify theboldbi_custom_locale_pathas the deployed path of the designer locale files,boldbi_locale_pathlocale as the deployed path of Bold BI designer locale files.For example:
boldbi_locale_path: D:\\kube-local\\locale – Default locale file path (en-US) Boldbi_custom_locale_path: D:\\kube-local\\locale – Locale file path for new language -
Then, run the
BoldBI.Locale.Utility.exefile. -
Once you have run the utility, a
locale.jsfile will be generated in the newly created localized folder path of the designer localeD:\kube-local\[language-folder].
Note: BoldBI.Locale.Utility.exe must be run in a Windows environment to generate the locale.js file.
How to Deploy Custom Locale Path for Kubernetes
-
You can use a custom locale folder path while deploying the Bold BI application in Kubernetes.
-
Open the
deployment.yamlfile by referring to boldbi-kubernetes/deployment.yaml. -
In the
deployment.yamlfile, provide the custom path{Required Location}\locale\[language-folder]\bi-data-service\locale.jsin the value section for the variableAppSettings_locale-pathunder the container namedbi-dataservice-container. -
Once you have run the application in Kubernetes, a
locale.jsfile will be referred to in the provided custom location path, and the generated path structure will be as follows in the deployed location.
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.