Localization

Add multi-language support to your v5 apps using UXP's localization system.


Setup

1. Create localization.json

In your app's Resources/views/ folder:

{
    "ivivalocation.text.new-location": {
        "en": "New Location"
    },
    "ivivalocation.text.update-location": {
        "en": "Update Location"
    },
    "ivivalocation.text.delete-location": {
        "en": "Delete Location"
    },
    "ivivalocation.field.location-name": {
        "en": "Location Name"
    },
    "ivivalocation.field.location-type": {
        "en": "Location Type"
    },
    "ivivalocation.status.active": {
        "en": "Active",
        "ar-sa": "نشط"
    },
    "ivivalocation.status.inactive": {
        "en": "Inactive",
        "ar-sa": "غير نشط"
    },
    "ivivalocation.message.created": {
        "en": "Location created successfully"
    }
}

Format: Message key at top level → language codes → translations

2. Enable Localization

In your app's entry point (src/index.tsx):


Using Translations

Use the $L() function from UXPContext:


Parameters in Translations

Use $ prefix for parameters:

Pass parameters as object:


Naming Conventions

Use hierarchical keys: appname.category.message-id


See Location 5.0 app (/Location/5.0/Resources/views/localization.json) for complete localization examples.


Next Steps

Last updated