0 follower

Interface Yiisoft\Translator\MessageReaderInterface

Implemented byYiisoft\Translator\IdMessageReader, Yiisoft\Translator\InMemoryMessageSource

Reader obtains a translated message for a given locale by ID and category. Parameters may be used to decide about the message to obtain as well.

Method Details

Hide inherited methods

getMessage() public abstract method

Obtains a translation message.

public abstract string|null getMessage ( string $id, string $category, string $locale, array $parameters = [] )
$id string

ID of the message to get.

$category string

Category of the message to get.

$locale string

Locale of the message to get.

$parameters array

Parameters that may be used to decide about the message to obtain.

return string|null

The translated message or null if translation wasn't found.

                public function getMessage(string $id, string $category, string $locale, array $parameters = []): ?string;

            
getMessages() public abstract method

public abstract array getMessages ( string $category, string $locale )
$category string

Category of messages to get.

$locale string

Locale of messages to get.

return array

All messages from category. The format is the following:

[
  'key1' => [
    'message' => 'translation1',
    // Extra metadata that writer may use:
    'comment' => 'Translate carefully!',
  ],
  'key2' => [
    'message' => 'translation2',
    // Extra metadata that writer may use:
    'comment' => 'Translate carefully!',
  ],
]

                public function getMessages(string $category, string $locale): array;