🎁
Loyalty - QBCore
  • What's new?
  • Royalty Program - QBCore
  • App Configuration
  • Tiers
  • Exports
  • Custom Money Handling
  • Loyalty Program Language Configuration Guide
Powered by GitBook
On this page
  • Overview
  • Server Language Configuration (config.lua)
  • Client Language Configuration (/ui/assets/config.json)
  • How to Modify Language Settings
  • Translation Tips

Loyalty Program Language Configuration Guide

Overview

This guide covers how to configure and customize language settings for the Loyalty Program system across both server (Lua) and client (Flutter) components.

Server Language Configuration (config.lua)

All server-side text is managed through the Config.Language table in config.lua:

Config.Language = {
    ['loyalty_title'] = "Loyalty",   -- Title for loyalty
    ['currency_symbol'] = "$",  -- Currency symbol for the dollar
    ['loyalty_content'] = "You have %s loyalty points.",  -- Content with placeholder for points
    
    -- Notification messages
    ['conversion_failed'] = "Failed to fetch conversion rates",
    ['loyalty_failed'] = "Failed to retrieve loyalty card info.",
    ['error_minimum_points'] = "Minimum points for conversion not met",
    
    -- Success messages
    ['points_converted'] = "Points Converted",
    ['conversion_success'] = "Successfully Converted %s points to %s%s!",
    
    -- Error messages
    ['conversion_failed_title'] = "Points Conversion Failed",
    ['conversion_failed_content'] = "Failed to convert points to bank money!",
    
    -- Additional notification messages
    -- ... (remaining entries)
}

Placeholders

Many strings contain placeholders that will be replaced at runtime:

  • %s - For dynamic content (points, amounts, etc.)

  • Example: "Added %s points to your loyalty card!" might display as "Added 500 points to your loyalty card!"

Client Language Configuration (/ui/assets/config.json)

All Flutter app text is managed through the translations object in /ui/assets/config.json:

{
  "currency": {
    "sign": "$"
  },
  "translations": {
    "title": "Loyalty Program",
    "loading": "Loading...",
    "successConvertedMessage": "Successfully converted {$points} points",
    "errorConvertedMessage": "Error converting points",
    
    // UI labels
    "convert_points": "Convert Points",
    "convert_to_cash": "Convert to Cash",
    "my_points": "My Points",
    
    // Card labels
    "loyalty_card": "LOYALTY CARD",
    "platinum": "PLATINUM",
    "gold": "GOLD",
    "silver": "SILVER",
    
    // ... (remaining entries)
  }
}

Placeholders

The Flutter app uses a different placeholder format:

  • {$variableName} - For dynamic content

  • Example: "Successfully converted {$points} points" might display as "Successfully converted 500 points"

How to Modify Language Settings

Changing Server-Side Text

  1. Open config.lua

  2. Locate the relevant key in the Config.Language table

  3. Modify the value while preserving any placeholders (%s)

  4. Save the file

Example:

-- Original
['loyalty_title'] = "Loyalty",

-- Modified
['loyalty_title'] = "Customer Rewards",

Changing Client-Side Text

  1. Open /ui/assets/config.json

  2. Locate the relevant key in the translations object

  3. Modify the value while preserving any placeholders ({$variableName})

  4. Save the file

Example:

// Original
"title": "Loyalty Program",

// Modified
"title": "Customer Rewards Program",

Changing Currency Symbol

To ensure consistency, update the currency symbol in both files:

  1. In config.lua:

['currency_symbol'] = "€",  -- Changed from "$"
  1. In /ui/assets/config.json:

"currency": {
  "sign": "€"  // Changed from "$"
},

Translation Tips

  1. Maintain Placeholders: Always preserve placeholders (%s in Lua, {$variableName} in JSON) in the same order they appear.

  2. Test Changes: After modifying language settings, test the system to ensure all text displays correctly.

  3. Special Characters: If using special characters, ensure your files are saved with UTF-8 encoding.

  4. Length Considerations: Keep translations reasonably close to the original length to prevent UI display issues.

PreviousCustom Money Handling

Last updated 2 months ago