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 contentExample:
"Successfully converted {$points} points"
might display as "Successfully converted 500 points"
How to Modify Language Settings
Changing Server-Side Text
Open
config.lua
Locate the relevant key in the
Config.Language
tableModify the value while preserving any placeholders (
%s
)Save the file
Example:
-- Original
['loyalty_title'] = "Loyalty",
-- Modified
['loyalty_title'] = "Customer Rewards",
Changing Client-Side Text
Open
/ui/assets/config.json
Locate the relevant key in the
translations
objectModify the value while preserving any placeholders (
{$variableName}
)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:
In
config.lua
:
['currency_symbol'] = "€", -- Changed from "$"
In
/ui/assets/config.json
:
"currency": {
"sign": "€" // Changed from "$"
},
Translation Tips
Maintain Placeholders: Always preserve placeholders (
%s
in Lua,{$variableName}
in JSON) in the same order they appear.Test Changes: After modifying language settings, test the system to ensure all text displays correctly.
Special Characters: If using special characters, ensure your files are saved with UTF-8 encoding.
Length Considerations: Keep translations reasonably close to the original length to prevent UI display issues.
Last updated