Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2declare( strict_types = 1 );
3
4/**
5 * ILocalizer.php
6 *
7 * This file is part of the Codex design system, the official design system
8 * for Wikimedia projects. It defines the `ILocalizer` interface, which
9 * standardizes the localization method for retrieving translated messages
10 * within the Codex design system. Implementations of this interface provide
11 * localized messages from various environments, such as MediaWiki and Intuition.
12 *
13 * By defining this interface, Codex components gain flexibility in message
14 * localization, allowing the system to select the appropriate localization
15 * service at runtime.
16 *
17 * @category Contract
18 * @package  Codex\Contract
19 * @since    0.1.0
20 * @author   Doğu Abaris <abaris@null.net>
21 * @license  https://www.gnu.org/copyleft/gpl.html GPL-2.0-or-later
22 * @link     https://doc.wikimedia.org/codex/main/ Codex Documentation
23 */
24
25namespace Wikimedia\Codex\Contract;
26
27/**
28 * Interface for localization services in Codex.
29 *
30 * The `ILocalizer` interface defines the method required for retrieving localized
31 * messages. Implementations of this interface enable message localization in
32 * different environments, ensuring flexibility and consistency in translations
33 * across Codex components.
34 *
35 * @category Contract
36 * @package  Codex\Contract
37 * @since    0.1.0
38 * @author   Doğu Abaris <abaris@null.net>
39 * @license  https://www.gnu.org/copyleft/gpl.html GPL-2.0-or-later
40 * @link     https://doc.wikimedia.org/codex/main/ Codex Documentation
41 */
42interface ILocalizer {
43
44    /**
45     * Retrieve a localized message.
46     *
47     * This method fetches a translated message based on a message key.
48     * Optional parameters can be included for placeholder replacements in the message.
49     *
50     * @since 0.1.0
51     * @param string $key The message key.
52     * @param mixed ...$params Optional parameters for placeholders in the message.
53     * @return string The localized message.
54     */
55    public function msg( string $key, ...$params ): string;
56}