Skip to content

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

ParameterTypeRequiredDescription
pageIdStringYesPage identifier
codeStringYesString ID
defaultStrStringNoDefault 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 - Arabic
  • zh-cn - Chinese (Mainland)
  • zh-tw - Chinese (Taiwan)
  • zh-hans - Simplified Chinese
  • en - English
  • fr - French
  • de - German
  • id - Indonesian
  • it - Italian
  • ja - Japanese
  • ko - Korean
  • pt - Portuguese
  • ru - Russian
  • es - Spanish
  • th - Thai
  • tr - Turkish
  • vi - Vietnamese
  • fil - Filipino
  • ms - Malay
  • hi - Hindi