ICanBoogie
  • Documentation
  • API Reference
  • I18n 3.0.x
Namespaces
  • ICanBoogie
    • Binding
      • I18n
    • I18n
      • Translator
Classes
  • FormattedString
  • Helpers
  • Hooks
  • Translator

Class Translator

ICanBoogie\I18n\Translator implements ArrayAccess uses ICanBoogie\PrototypeTrait (not available)
Namespace: ICanBoogie\I18n
Located at I18n/Translator.php

Methods summary

public static from( string $id ) : ICanBoogie\I18n\Translator

Return the translator for the specified locale.

Return the translator for the specified locale.

Parameters

$id
The locale identifier.

Returns

ICanBoogie\I18n\Translator
The translator for the locale.
protected static get_cache( void )
public static messages_construct( $id )
protected lazy_get_messages( void )
protected lazy_get_fallback( void ) : ICanBoogie\I18n\Translator|null

Returns a translator fallback for this translator.

Returns a translator fallback for this translator.

Returns

ICanBoogie\I18n\Translator|null

The translator fallback for this translator or null if there is none.

protected __construct( string $id )

Constructor.

Constructor.

Parameters

$id
Locale identifier
public __invoke( string $native, array $args = [], array $options = [] ) : string

Translate a native string in a locale string.

Translate a native string in a locale string.

Parameters

$native
The native string to translate.
$args
$options

Returns

string

The translated string, or the same native string if no translation could be found.

public offsetExists( $offset )

Implementation of

ArrayAccess::offsetExists()
public offsetGet( $offset )

Implementation of

ArrayAccess::offsetGet()
public offsetSet( $offset, $value )

Implementation of

ArrayAccess::offsetSet()
public offsetUnset( $offset )

Implementation of

ArrayAccess::offsetUnset()

Properties summary

protected static $cache

		
protected $messages : array

Translation messages.

Translation messages.


		
protected $fallback : ICanBoogie\I18n\Translator

Fallback translator.

Fallback translator.


		
protected $id : string

Locale id for this translator.

Locale id for this translator.


		
public static $missing : array
[]
I18n 3.0.x – Check on GitHub – API documentation generated by ApiGen