xplo.re Medusa Core Framework 3.1
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Authentication
  • Authentication_Token
  • Autoloader
  • Cache
  • Charset
  • ClassDescriptor
  • Closure
  • Controller
  • Converter
  • Date
  • Decoder
  • Delegate
  • Dispatcher
  • Encoder
  • Env
  • Env_Field
  • Env_File
  • Env_FileList
  • Env_Request
  • Env_SERVER
  • Exchange
  • Fault
  • Field
  • Filter
  • Filter_Value
  • Formatter
  • Hash
  • IP
  • Loader
  • Locale
  • Locale_Iterator
  • Locale_Node
  • Log
  • Module
  • Module_Iterator
  • Nothing
  • Object
  • OS
  • Plugin
  • Profiler
  • Query
  • Registry
  • Resource
  • Server
  • Session
  • Session_Token
  • Set
  • Storage
  • Storage_Result
  • Storage_Statement
  • Stream
  • String
  • Translation
  • URI
  • URI_Parameters
  • UUID
  • Value
  • Version
  • View

Interfaces

  • Accessor
  • Chainable
  • Comparable
  • Configurable
  • Equality
  • Identity
  • Inquiry
  • Masquerade
  • Mutator
  • SeekableStream
  • Storable
  • Variator

Exceptions

  • Exception

Constants

  • Copyright
  • ProductName
  • UseVersion
  • Version

Functions

  • ns_expand
  • ns_file_exists
  • ns_get_version
  • ns_resolve

Class Translation

Provides translation of arbitrary data identified by keys with support for fallback locales.

Translation repositories are divided into domains. A domain is a logical group of translation entries that are used together; for example a client and server repository, or parts in an application that are not used together in a single request. Domains can be used to reduce the memory footprint of language files or separate responsibility onto several translation teams.

The locale designates the language of the repository. It uses the same notion as locales and hence does support different language regions. It is highly recommended to have a default locale for an application for which all language entries are defined. This default locale should be used as a fallback locale to use if an entry for a different locale does not exist.

The translation interface is generic; is can be used to translate different kinds of data. A driver both defines the type of data and storage access, e.g. for translating language entries. The translation driver might itself implement an own driver for the actual storage involved, e.g. XML-based language files.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Translation

Direct known subclasses

Core\Translation\Driver\language

Abstract
Namespace: Core
Package: Core\Translation
Since: 3.1
Requires: PHP 5.3
Version: 1.0
Located at Translation.inc.php

Methods summary

public
# __construct( Core\URI $uri )

Parameters

$uri
Configuration URI.

Since

3.1
public Core\Translation\Language_Node
# __invoke( string $key )

Fetches a translation from the configured translation engine.

Fetches a translation from the configured translation engine.

Parameters

$key
Translation repository entry to fetch.

Returns

Core\Translation\Language_Node
Translation query result.

Since

3.1
public static static
# autocreate( Core\URI $uri )

Translation factory.

Translation factory.

Parameters

$uri
Driver configuration URI.

Returns

static

Since

3.1
abstract public Core\Translation\Language
# get( string $domainName = null, string $localeName = null )

Gets the translation engine for a given domain and locale.

Gets the translation engine for a given domain and locale.

Parameters

$domainName
Domain to get translation engine for.
$localeName
Name of locale to get translation engine for.

Returns

Core\Translation\Language

Since

3.1
public Core\Translation\Language
# getValueForUndefinedKey( string $key )

Gets the translation engine for a given domain name.

Gets the translation engine for a given domain name.

Parameters

$key
Domain to get translation engine for.

Returns

Core\Translation\Language

Throws

Core\Exception\UndefinedKey
Failed to resolve value for the given key.

See

Core\Translation::get()

Since

3.1

Overrides

Core\Object::getValueForUndefinedKey
public Core\Translation\Language_Node
# query( string $key )

Fetches a translation from the configured translation engine.

Fetches a translation from the configured translation engine.

Parameters

$key
Translation repository entry to fetch.

Returns

Core\Translation\Language_Node
Translation query result.

Since

3.1
public boolean
# setDefaultLocaleAccept( string $localeAccept = null, string $default = null )

Automatically sets default locale based on the HTTP "Accept" header.

Automatically sets default locale based on the HTTP "Accept" header.

Parameters

$localeAccept
Value of HTTP "Accept" header to parse.
$default
Name of default locale to use if no suitable locale was found.

Returns

boolean

Since

3.1

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), __toString(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

string DefaultDomainParameter

Name of default domain to use if not specified.

Name of default domain to use if not specified.

Since

3.1
# 'default-domain'
string DefaultLocaleParameter

The default locale to use if the driver fails to automatically determine an active locale.

The default locale to use if the driver fails to automatically determine an active locale.

Since

3.1
# 'default-locale'
string FallbackLocaleParameter

If the active locale fails, use the provided fallback instead.

If the active locale fails, use the provided fallback instead.

Since

3.1
# 'fallback-locale'

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected array $_v_parameters

Associative array of configuration parameters.

Associative array of configuration parameters.

Since

3.1
#

Magic properties

public read-only array $parameters

Associative array of configuration parameters.

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.1 API documentation generated by ApiGen