i18n is the abbreviation for internationalization. Magento adds i18n support out of the box, thus adapting to various languages and regions without application changes. Within app/functions.php, there is a __() translation function, which is defined as follows:

function __()
    $argc = func_get_args();

    $text = array_shift($argc);
    if (!empty($argc) && is_array($argc[0])) {
        $argc = $argc[0];

    return new \Magento\Framework\Phrase($text, $argc);

This translation function accepts a variable number of arguments and passes them to a constructor of the \Magento\Framework\Phrase class and returns its instance. The Phrase class has the __toString method, which then returns the translated string.

Here are a few examples of how we can use the __() function: ...

Get Magento 2 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.