Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 932 Bytes

8. Translations.md

File metadata and controls

18 lines (13 loc) · 932 Bytes

PHPFUI\ORM Translation

If you are using validation, you need to provide a translation. This library uses the PHPFUI\Translation class, or provide a callback with the following parameter signature:

function translate(string $text, array $values = []) : string;

Due to static initialization issues on PHP, you will need to initialize the translation via the setTranslationCallback method.

You will need to copy the provided translations (in ./translations directory) into your project or specify the path to the vendor directory.

Suggested usage:

\PHPFUI\ORM::setTranslationCallback(\PHPFUI\Translation\Translator::trans(...));
\PHPFUI\Translation\Translator::setTranslationDirectory(__DIR__ . '/../vendor/phpfui/orm/translations');
\PHPFUI\Translation\Translator::setLocale(\Locale::getDefault());