SproutCMS

This is the code documentation for the SproutCMS project

class I18n

Formats data according to local conventions.
This is an easier-to-use helper version of the LocaleInfo set of classes.

To set the locale, set the config param:
   sprout.locale

The default is AUS - Australia

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-11-25
**/
class NewClassName extends I18n {
    
    /**
    * Return a formatted number
    **/
    public function number (float $number, int $precision) {
        // Method code goes here
    }
    
    /**
    * Return a formatted currency value
    **/
    public function money (float $number, $precision) {
        // Method code goes here
    }
    
    /**
    * Return a formatted date in a short format (e.g. 3/1/2003)
    **/
    public function shortdate (int $timestamp) {
        // Method code goes here
    }
    
    /**
    * Return a formatted date in a short format (e.g. Mon 3rd Jan 2003)
    **/
    public function longdate (int $timestamp) {
        // Method code goes here
    }
    
    /**
    * Return a formatted dtime (e.g. 5:30pm)
    **/
    public function time (int $timestamp) {
        // Method code goes here
    }
    
    /**
    * Returns HTML for address fields
    **/
    public function addressFields (bool $required) {
        // Method code goes here
    }
    
    /**
    * Set the locale to the default as per the configuration
    **/
    public function init () {
        // Method code goes here
    }
    
    /**
    * Set the locale to something other than the default
    * Useful for multi-currency shopping carts, for example.
    **/
    public function setLocale (string $country) {
        // Method code goes here
    }
    
    /**
    * Return JavaScript code which initialises the I18n javascript library with the locale parameters
    **/
    public function initJavaScript () {
        // Method code goes here
    }
    
}
?>