🗺️ LanguageManager
LanguageManager – Component Overview
The LanguageManager
provides a complete solution for multilingual text management in the Virtual Pet Game Template. It supports internal and external language files (JSON, XML, CSV), offers text formatting, font switching, and UI updates upon language change.
🌍 What It Does
Supports multiple language modes:
InternalDatabase
: hardcoded in Unity inspectorExternalFiles
: loaded per-language file fromStreamingAssets/Languages/
GlobalExternalFiles
: loaded from a single global file (JSON/XML/CSV)
Handles translation data in
TextEntry
→Translation
formatEnables font swapping, bold/uppercase rendering per language
Provides utilities to export/import languages in multiple formats
🔧 Inspector Configuration
Languages
: List of available languages (ID, icon, font, options)TextEntries
: List of translatable entries (TextID → per-language translations)disableTMPWarnings
: Disables TMPro font warnings via reflectionenableTextFormatting
: Enables tags like[b]
, ,[i]
, etc.languageMode
: Selects the loading mode (internal vs external)currentLanguageID
: Default language at runtime
🧠 How It Works
Runtime
Calls
SetLanguage(languageId)
on start (fromPlayerPrefs
or default)Depending on mode, it loads:
Internal Unity
TextEntries
OR JSON/XML/CSV language file from
StreamingAssets
Populates a dictionary for fast
GetTextEntryByID(id)
lookupApplies font override, bold, uppercase if configured per language
Triggers
onLanguageChanged
event so UI can update
Export/Import Tools
ExportLanguagesToJSON
/CSV
/XML
– Saves full data to fileImportLanguagesFromJSON
/CSV
/XML
– Loads and replaces current listExportBaseModel()
– Outputs a blank translation template for filling
🧩 Integration Example
Can be used for UI labels, buttons, tooltips, etc.
To change language at runtime:
✅ Highlights
🗂 Supports multi-format (CSV, JSON, XML)
🖼 Font swap and case formatting per language
🧪 Tools for import/export of full database
🧠 Global fallback for editor testing
This component is powerful, flexible, and production-ready for games targeting multiple regions or user groups.
Last updated