Copied!

MultiLanguageName

MultiLanguageName.php : 18

This is the interface for all ValueObjects implementing translated name logic.

Provides a uniform way for API consuming logic to generate translated names / labels for API objects. Language logic is meant to also be used for description, fields, ... lookup as well.

Methods

publicgetName()

MultiLanguageName.php : 47

Return the name of the domain object in a given language.

public getName([string|null $languageCode = null ]) : string|null
  • If $languageCode is defined, return if available, otherwise null
  • If not, pick using the following languages codes when applicable:
    1. Prioritized languages (if provided to api on object retrieval)
    2. Main language if object is $alwaysAvailable
    3. Fallback to return in initial (version objects) or main language

Parameters

Name Type Default value Description
$languageCode string|null null -

Return values

string|null

The name for a given language, or null if $languageCode is not set or does not exist.

publicgetNames()

MultiLanguageName.php : 30

Return the human readable name in all provided languages.

public getNames() : array<string|int, string>

The structure of the return value is: array( 'eng' => '<name_eng>', 'de' => '<name_de>' );

Return values

array<string|int, string>