Saturn
Saturn 1.0.0
Saturn 1.0.0
  • Saturn 1.0.0
  • 😁User Guide
    • Settings
      • Maintenance Mode
      • Website Environment
    • Security
      • Good security practices
      • Security Notice
    • System Requirements and Support
    • Update your Server
  • ⚠️Troubleshooting
    • Errors
      • Database Errors
      • Saturn Errors
      • Checksum Issues
  • 🧩Plugins
    • Plugins in Saturn
    • Official Plugins
      • Control Panel
        • User Guide
        • Developer Guide
          • Control Panel Hooks
    • Marketplace Plugins
  • 💻Developer Documentation
    • Getting Started
    • Libraries and Functions
      • AccountManager
        • Permissions
        • UUID
      • DatabaseManager
        • DBMS
          • Sending Database Requests
          • Query Information
          • Database Security
        • Database Actions
      • HookManager
        • Actions
        • Runners
      • HTTP
      • LanguageManager
      • PluginManager
        • Manage Plugin Content
        • Plugin Compatability
        • Check if a plugin is loaded.
        • Fetch Manifest
      • RouteManager
      • SecurityManager
        • Cross-site Request Forgery
        • Cross-site Scripting
      • SessionManager
        • Start and End Sessions
        • Validate Sessions
        • Session Data
      • TestManager
    • Security
    • Plugins
      • How to structure a plugin
      • Manifest
      • APIs
      • Checking for Dependencies
      • Power Features
        • 💤Hibernate
    • Hooks
    • Tests and Profiling
    • Global Variables
Powered by GitBook
On this page
  • Custom Translations
  • Example: English and French
  1. Developer Documentation
  2. Libraries and Functions

LanguageManager

Custom Translations

Custom Translations are useful for if you'd like your plugin to be available in multiple languages.

Example: English and French

In this example, we'll support English and French. You can of course create as many language files as you'd like.

By default, users will only be able to see in languages that are supported by Saturn, but you could create your own settings file that supports more languages if you'd like.

en-gb.json
{
  "Hello": "Hello",
  "ControlPanel": "Control Panel"
}
fr.json
{
  "Hello": "Bonjour",
  "ControlPanel": "Panneau de commande"
}
index.php
<?php
use Saturn\LanguageManager\Translation;
$Translation = new Translation('.../'.SATURN_LANGUAGE.'/.json');
?>
...

<h1><?= $Translation->$Translate('ControlPanel'); ?></h1>
<p><?= $Translation->$Translate('Hello'); ?></p>

...

PreviousHTTPNextPluginManager

Last updated 1 year ago

💻