Virtual Pet Game Template
  • VIRTUAL PET GAME TEMPLATE
  • Getting Started
    • 🎯 Project Setup Guide
    • 🧩 Home Scene Overview
    • 🗺️ UI Main Menu
    • 🗺️ LoadingManager
    • 🗺️ GameInstance
    • 🗺️ ToolsManager
    • 🗺️ AudioManager
    • 🗺️ LanguageManager
    • 🗺️ MonetizationManager
    • 🗺️ PlayerSave
  • Modifying the project
    • 🐾 How to Add a New Pet
    • 📜How Add a New Pet Rules
    • 💰 How to Add a New Currency
    • 🍎 How to Add a New Food Item
    • 🧢 Adding a New Accessory
    • 🎮 How to Add a New Minigame
  • Modifying Minigames
    • 🌤️ Minigame "Jump Sky"
    • 🍔 Minigame "Food Flicker"
    • 🐦 Minigame “Flappy”
    • 💎 Minigame “Gem Hunter”
Powered by GitBook
On this page
  • 🌍 What It Does
  • 🔧 Inspector Configuration
  • 🧠 How It Works
  • 🧩 Integration Example
  • ✅ Highlights
  1. Getting Started

🗺️ 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 inspector

    • ExternalFiles: loaded per-language file from StreamingAssets/Languages/

    • GlobalExternalFiles: loaded from a single global file (JSON/XML/CSV)

  • Handles translation data in TextEntry → Translation format

  • Enables 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 reflection

  • enableTextFormatting: 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 (from PlayerPrefs 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) lookup

  • Applies 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 file

  • ImportLanguagesFromJSON / CSV / XML – Loads and replaces current list

  • ExportBaseModel() – Outputs a blank translation template for filling


🧩 Integration Example

string translated = LanguageManager.LanguageManager.Instance.GetTextEntryByID("menu_start");
  • Can be used for UI labels, buttons, tooltips, etc.

  • To change language at runtime:

LanguageManager.LanguageManager.Instance.SetLanguage("pt");

✅ 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.

Previous🗺️ AudioManagerNext🗺️ MonetizationManager

Last updated 28 days ago