Skip to content

I18n setup

The world is multilingual and Koded provides a simple I18n implementation.

Translation strings are stored on a disk, processed by a "catalog" and accessed with translation function __().

<?php

function __(
  string $string,
  array $arguments = [],
  string $locale = ''
): string

Configuration

I18n is set in the Koded DIModule and defaults to

Both can be changed in your app configuration:

<?php

return [
  'translation.catalog' => \Koded\I18n\GettextCatalog::class,
  'translation.formatter' => \Koded\I18n\StrtrFormatter::class,
  'translation.dir' => __DIR__ . '/locale/',
  'translation.locale' => 'mk_MK',
];