polyglot/translator

PHP Polyglot translator

Fund package maintenance!
Other

v1.0.0 2023-09-08 20:07 UTC

This package is not auto-updated.

Last update: 2024-11-03 00:05:28 UTC


README

A polyglot translator.

Install

composer require polyglot/translator:^1.0

Using

<?php

/**
 * @var \Polyglot\Contract\TemplateProvider\TemplateProvider $templateProvider
 * @var \Polyglot\Contract\TemplateResolver\TemplateResolver $templateResolver
 */
$polyglot = new \Polyglot\Translator\Polyglot('en_US', $templateProvider, $templateResolver);

$french = $polyglot->trans('translation_id', [], 'domain', 'fr_FR');
$default = $polyglot->trans('translation_id', [], 'domain');