Core Features
Get Translation String
Use the getPageString() method to retrieve translated text:
java
// Basic usage
String translatedText = LoxilyLocalize.getPageString("home_page", "110100");
// With default value
String translatedText = LoxilyLocalize.getPageString(
"home_page", // Page ID
"110100", // String ID
"Default text" // Returned if the string is not found
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| pageId | String | Yes | Page identifier |
| code | String | Yes | String ID |
| defaultStr | String | No | Default text (returned when not found) |
Placeholder Replacement
The SDK supports placeholder replacement using {0}, {1}, etc.:
java
// String content: "Hello {0}, welcome {1}!"
String result = LoxilyLocalize.getPageString(
"home_page",
"110100",
new String[]{"John", "back"}
);
// Result: "Hello John, welcome back!"Switch Language
Use the updateLanguage() method to switch the target language:
java
// Switch language
LoxilyLocalize.updateLanguage("en");
// After switching, the SDK will:
// 1. Clear the in-memory cache for the current language
// 2. Download translation files for the new language
// 3. Load into memory
// 4. Trigger the initialization callback (if set)Supported Language Codes
The following language codes are supported:
ar- Arabiczh-cn- Chinese (Mainland)zh-tw- Chinese (Taiwan)zh-hans- Simplified Chineseen- Englishfr- Frenchde- Germanid- Indonesianit- Italianja- Japaneseko- Koreanpt- Portugueseru- Russianes- Spanishth- Thaitr- Turkishvi- Vietnamesefil- Filipinoms- Malayhi- Hindi