Add Localisation Data

Add localization flow

Adding Localizations

  • From the search screen user can navigate to add localization screen by clicking the action button

  • In this screen user can specify the locale(language) and module in which messages have to be upserted

  • Once the language and module is selected a table is rendered in which user can add the keycode and the respective message. In one go, we can upsert upto 50 messages in this table.

  • These messages will be upserted into the default locale as well.

  • After adding the messages user can click on the "Save" action button. Upon success, a relevant toast message is shown and the table is cleared.

  • In case of failure, an error toast message is shown listing the list of errors due to which the messages could not be upserted.

API for adding localizations

Same API is utilized for edit and bulk upload as well.

Refer the below curl:

curl --location 'http://localhost:3000/localization/messages/v1/_upsert' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json;charset=UTF-8' \
--header 'Origin: http://localhost:3000' \
--header 'Referer: http://localhost:3000/workbench-ui/employee/workbench/localisation-add' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
--header 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Windows"' \
--data '{"tenantId":"pb","messages":[{"code":"sdf","message":"dsf","locale":"default","module":"rainmaker-test","id":0}],"RequestInfo":{"apiId":"Rainmaker","authToken":"5bbfa93c-adc2-42b2-992e-a708a83cb2cf","userInfo":{"id":80234,"uuid":"aeb85b37-c996-4218-bdca-1b00cc268f2f","userName":"WBQA","name":"LOC","mobileNumber":"9999991942","emailId":null,"locale":null,"type":"EMPLOYEE","roles":[{"name":"MDMS ADMIN","code":"MDMS_ADMIN","tenantId":"pb"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb"},{"name":"Localisation admin","code":"LOC_ADMIN","tenantId":"pb"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb"}],"active":true,"tenantId":"pb","permanentCity":null},"msgId":"1694166894795|en_IN","plainAccessRequest":{}}}'

Tenant Module Localization

  • State level users can upsert localizations to all modules

  • City level users can only upsert to module specific to the tenantId (eg -> pg.citya)

  • Some examples of city module localizations


       {
            "code": "PG_CITYA_ADMIN_B2",
            "message": "Ward Two",
            "module": "rainmaker-pg.citya",
            "locale": "en_IN"
        },
        
        {
            "code": "PG_CITYA_ADMIN_B3",
            "message": "Ward Three",
            "module": "rainmaker-pg.citya",
            "locale": "en_IN"
        }

Bulk Upload Localizations

Overview

The bulk upload feature allows users to upload multiple localization entries across different languages simultaneously using an Excel file template.

Initiating Bulk Upload

From the localization add screen, users can initiate bulk upload by clicking the "Bulk Upload" action button.

Selecting Module

A modal popup appears where users need to:

  • Select the module for which they want to upload localizations

  • The module dropdown displays all available modules

Once a module is selected, two options become available:

  1. Download Template - to download a pre-populated Excel template

  2. Bulk Upload - to upload the modified Excel file

Downloading Template

Template Generation

After selecting a module, click the "Download Template" button. The system will:

  • Fetch all existing localizations for the selected module across all configured languages

  • Generate an Excel file (template.xlsx) with pre-populated data

  • Automatically download the file to your system

Template Structure

The downloaded Excel template contains the following columns:

Column Name
Description
Status

Message

Default locale message

Locked (cannot be edited)

English

English language translations

Editable

[other languages]

Additional configured languages

Editable

code

Localization key code

Editable

Note: The actual language column names depend on the languages configured.

Template Features:

  • Sheet is protected to prevent accidental structural changes

  • "Message" column (default locale) is locked and cannot be modified

  • All other language columns are editable

  • Column widths are automatically sized based on content

  • Contains all existing localization codes for the selected module

Example Template:

Message
ENGLISH
FRENCH
code

Warehouse Manager

Warehouse Manager

Responsable d'entrepôt

ACCESSCONTROL_ROLES_ROLES_ACCESSCONTROL_ROLES_ROLES_WAREHOUSE_MANAGER

AssetReportViewer

AssetReportViewer

Visionneuse de rapport sur les actifs

ACCESSCONTROL_ROLES_ROLES_ASSETREPORTVIEWER

Editing the Template

  1. Open the downloaded template.xlsx file in Excel or compatible spreadsheet software

  2. Add new rows for new localization entries

  3. Edit translations in the editable language columns

  4. Save the file

Important Guidelines:

  • Do NOT modify the "Message" column (it is locked)

  • Ensure each code is unique

  • Fill translations for at least one language

  • Empty cells for a language will be skipped (no entry created for that locale)

  • Do NOT change the column headers

Uploading Modified Template

  1. Click the "Bulk Upload" button in the module selection modal

  2. A file upload modal appears

  3. Select or drag-and-drop your modified Excel file

  4. Click submit

Accepted file formats: .xls, .xlsx

File Processing and Submission

Once the file is uploaded:

  1. Excel file is parsed and converted to JSON format

  2. Language columns are mapped to locale codes - Example: "English" column → en_IN locale, "Hindi" column → hi_IN locale

  3. Data is transformed - Each row is split into multiple entries (one per language)

  4. Example: Excel Row: | Message | English | Hindi | code |

| Save | Save | सहेजें | CORE_SAVE |

Transformed to:

[ 
{ code: "CORE_SAVE", message: "Save", locale: "default", module: "rainmaker-common" }, { code: "CORE_SAVE", message: "Save", locale: "en_IN", module: "rainmaker-common" }, 
{ code: "CORE_SAVE", message: "सहेजें", locale: "hi_IN", module: "rainmaker-common" } 
] 

5. Data is validated for: - Duplicate code-message-locale-module combinations - Valid file format - Required fields presence

6. Entries are grouped by locale and submitted to the API

7. Multiple API calls are made in parallel (one per locale group) for faster processing

Success and Error Handling

On Success

  • A success toast message appears: "Localizations upserted successfully"

  • The bulk upload modal closes automatically

  • All uploaded localizations are now available in the system

On Failure

  • An error toast message displays the specific error(s)

  • Example: "Localization upsert failed: Invalid locale code, Duplicate entry"

  • The modal closes, allowing you to fix the issues and retry the upload

API for Bulk Upload

The bulk upload uses the same API as manual add and edit operations.

Endpoint: POST /localization/messages/v1/_upsert

Note: Multiple API calls are made (one per locale) with entries grouped by locale for efficient processing.

Validation Rules

The bulk upload validates the following:

Validation
Description

File Format

Only .xls and .xlsx files are accepted

Duplicate Combinations

No duplicate code-message-locale-module entries allowed

Required Fields

code and at least one message must be present

Empty Values

Rows with empty critical fields are skipped

Key Benefits

  1. Multi-Language Support - Upload translations for multiple languages in a single file

  2. Pre-populated Templates - Start with existing data, making updates easier

  3. Protected Editing - Default locale column is locked to prevent accidental changes

  4. Flexible Entry Creation - Only creates entries for languages with translations provided

  5. Efficient Processing - Parallel API calls for faster bulk operations

  6. Duplicate Prevention - Automatic validation prevents data conflicts

Last updated

Was this helpful?