Overview

Namespaces

  • Core
    • Auth
    • Exceptions
    • Helpers
    • Providers
  • Kernel
    • Dispatch
    • Providers
  • None
  • Vendor
    • ExampleVendor

Classes

  • AbstractClass
  • ErrorController
  • Language
  • ParentController
  • ParentModel
  • Overview
  • Namespace
  • Class
  • Download

Class Language

Loads and sets the language *.ini files.

Namespace: Core
Package: Language
Located at app/models/Language.php
Methods summary
public static Core\Language
# singleton( )

/** Returns the Language instance, creating it if it did not exist.

Returns

Core\Language
public
# __construct( )

Populates the default properties of Language class

Populates the default properties of Language class

public
# getModel( )
public
# set( )

Sets the language for the user, by populating

$this->translations

for later use.

Sets the language for the user, by populating

$this->translations

for later use.

See

function t()
public string|boolean
# getTranslation( string $key )

Searches and retrieves the translation associated to the $key. Returns $key if it doesn't exist (useful for the default language)

Searches and retrieves the translation associated to the $key. Returns $key if it doesn't exist (useful for the default language)

Parameters

$key
The translation key

Returns

string|boolean
protected string
# get_user_language( string|boolean $preferredLanguage = false )

Parameters

$preferredLanguage

The language we will show to the user. Coincides with their browser language if it's translated

Returns

string
The user language (if it's translated) or the default (if it's not)
Properties summary
protected string $acceptLang

The "accept_lang" property of the client's browser

The "accept_lang" property of the client's browser

#
protected boolean $isBot

(and equals !$acceptLang) whether the user is a bot or not.

(and equals !$acceptLang) whether the user is a bot or not.

Note

All browsers send the accept_lang parameter, so a lack of such property will mean a lack of browser.
#
protected array $translations

The translations loaded for a given language

The translations loaded for a given language

# array()
protected array $languages

The configuration setting for languages

The configuration setting for languages

# [ 'default' => 'en', 'languages' => ['es', 'en'] ]
protected Core\Providers\Service $service

The service model

The service model

#
Ribosome API documentation generated by ApiGen