# Localisation

## Overview

This guide helps you add and verify translations (labels, status, messages) used in the CMS  module, using Postman APIs.

Localisation allows the Complaints module to support multiple languages, such as English (en\_IN), Hindi (hi\_IN), etc. It ensures users see the correct labels and messages on the UI, based on their selected language.

***

### **Localisation Data Loading in Workbench**

You can load localisation data in **two ways**:

1. **From the UI** – Best for small updates or quick entries.
2. **Using the API** – Recommended for bulk uploads.

from ui where we can load based on the steps mentioned below, but for bulk upload, follow the api way to do it quickly&#x20;

#### Method 1 – From the UI

**Step 1:** Log in as a **Super User** in DIGIT UI\
🔗 Example: `https://pgr-demo.digit.org/digit-ui/employee/user/login`

<div align="left"><figure><img src="https://805553164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FszvWp0bRxYU0P0l6DKOo%2Fuploads%2FvORw8u5t9Is3UJD6zEMM%2FScreenshot%20from%202025-08-11%2014-06-20.png?alt=media&#x26;token=7a74b5c7-ddd1-4273-8d01-b59c9dd1748a" alt=""><figcaption></figcaption></figure></div>

**Step 2:** Go to **Workbench → Localisation**.

<div align="left"><figure><img src="https://805553164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FszvWp0bRxYU0P0l6DKOo%2Fuploads%2F9DsUaQOcsZ7s21NUwSah%2FScreenshot%20from%202025-08-11%2014-06-42.png?alt=media&#x26;token=3a7a999c-eb5f-477a-b5ac-64f6e28615c0" alt=""><figcaption></figcaption></figure></div>

**Step 3:** Click **"Add New"** (bottom-right corner).

<figure><img src="https://805553164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FszvWp0bRxYU0P0l6DKOo%2Fuploads%2FtnFA4A4RPS86Hy8aOQUW%2FScreenshot%20from%202025-08-11%2014-07-38.png?alt=media&#x26;token=b2ebea26-25f1-4dbb-b256-c1405db1634d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://805553164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FszvWp0bRxYU0P0l6DKOo%2Fuploads%2FJDe4K9RS1hqjldIJ0CmP%2FScreenshot%20from%202025-08-11%2014-08-30.png?alt=media&#x26;token=3a7ce304-6fc7-431f-aa6b-a4ecfb4cbbaa" alt=""><figcaption></figcaption></figure>

**Step 4:** Fill the form:

* Select **Language**
* Select **Module**
* Enter **Unique Code** and **Message**
* Click **"Add Row"** to add more entries

**Step 5:** Click **"Save"**.\
✅ A success message means your data is loaded successfully.

### **Method 2 – Using API (For Bulk Upload)**

* Prepare your localisation data in JSON format.
* Call the localisation create/update API with your bulk data payload.
* This method is faster for large-scale entries and avoids manual UI input.

## Configure Localisation

{% stepper %}
{% step %}

### Setup Postman

* Use the DIGIT Postman collection provided for localisation APIs.
* The following two APIs are used:
  * Upsert (Add) messages
  * Search (Verify) messages
    {% endstep %}

{% step %}

### Prepare Required Details

Before running the API, replace these values in Postman:

<table><thead><tr><th width="176.890625">Field </th><th>What to enter</th></tr></thead><tbody><tr><td>Domain URL</td><td>Replace with your environment’s base URL (e.g., https://unifed-demo.digit.org)</td></tr><tr><td>authToken</td><td><p>Use a token with a user's credentials that has "Superuser" role</p><p>Add reaction</p></td></tr><tr><td>locale</td><td>en_IN for English, hi_IN for Hindi</td></tr><tr><td>tenantId</td><td>Use state-level tenant like pb (❌ Do NOT use ULBs like pb.amritsar)</td></tr><tr><td>module</td><td>Always set this to rainmaker-pgr for CCRS</td></tr><tr><td>messages</td><td>Load from DIGIT GitHub localisation <a href="https://github.com/egovernments/Citizen-Complaint-Resolution-System/tree/master/utilities/default-data-handler/src/main/resources/localisations">files</a></td></tr></tbody></table>
{% endstep %}

{% step %}

### Load Localisation Messages

* API Endpoint: POST /localisation/messages/v1/\_upsert

Sample Payload:

```
{
  "RequestInfo": {
    "authToken": "REPLACE_WITH_VALID_TOKEN"
  },
  "messages": [
    {
      "code": "PGR.SERVICEDEFS.NoStreetlight",
      "message": "No Streetlight",
      "module": "rainmaker-pgr",
      "locale": "en_IN",
      "tenantId": "pb"
    },
    {
      "code": "PGR.SERVICEDEFS.StreetLightNotWorking",
      "message": "Street Light Not Working",
      "module": "rainmaker-pgr",
      "locale": "en_IN",
      "tenantId": "pb"
    }
  ]
}

```

Repeat the same for hi\_IN or other required locales.
{% endstep %}

{% step %}

### Verify Loaded LocalisationLocalization

* API Endpoint: POST /localisation/messages/v1/\_search

Request Payload:

```
{
  "RequestInfo": {
    "authToken": "REPLACE_WITH_VALID_TOKEN"
  },
  "tenantId": "pb",
  "module": "rainmaker-pgr",
  "locale": "en_IN"
}

```

What to check:

* Confirm if your keys and translations appear correctly.
* If you don't see the expected keys, check for:
  * Missing or wrong tenantId, module, or locale
  * Incorrect format in the payload
    {% endstep %}
    {% endstepper %}

***

### Localisation Keys

Localise the following types of messages:

<table><thead><tr><th width="306.43359375">Key Format</th><th>Usage Example</th></tr></thead><tbody><tr><td>PGR.SERVICEDEFS.&#x3C;ServiceCode></td><td>"Street Light Not Working"</td></tr><tr><td>PGR.&#x3C;Status>.Label</td><td>Status labels like PGR.RESOLVED.Label</td></tr><tr><td>PGR.&#x3C;Action>.Label</td><td>Workflow actions like PGR.REOPEN.Label</td></tr><tr><td>Other UI strings</td><td>Page titles, menu items, form labels</td></tr></tbody></table>

Copy the localisation  from:

* DIGIT’s[ localisation GitHub repo](https://github.com/egovernments/Citizen-Complaint-Resolution-System/tree/master/utilities/default-data-handler/src/main/resources/localisations)

***

## Notes & Best Practices

<table><thead><tr><th width="162.34375">Item</th><th>Recommendation</th></tr></thead><tbody><tr><td>authToken</td><td>Use a superuser or user with permissions to update localisation</td></tr><tr><td>tenantId</td><td>Always use state-level tenant ID like pb</td></tr><tr><td>module</td><td>Must be set to rainmaker-pgr for the CCRS module</td></tr><tr><td>locale</td><td>Use supported codes: en_IN, hi_IN, etc.</td></tr></tbody></table>

***

## &#x20;Summary

* Use Postman to upload and verify messages.
* Make sure the format, module name, and tenant ID are correct.
* Load keys for both English and other required languages.
* After loading, use the search API to verify your keys.
