add basic translation interface and default translator

This commit is contained in:
KHOUBZA Younes
2022-05-25 02:18:57 +01:00
parent b41327dfa2
commit cc01750283
2 changed files with 51 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Prime\Translation;
final class EchoTranslator implements TranslatorInterface
{
/**
* {@inheritdoc}
*/
public function translate($id, $locale = null)
{
return $id;
}
/**
* {@inheritdoc}
*/
public function getLocale()
{
return 'en';
}
}
@@ -0,0 +1,24 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Prime\Translation;
interface TranslatorInterface
{
/**
* @param string $id
* @param string|null $locale
*
* @return string
*/
public function translate($id, $locale = null);
/**
* @return string
*/
public function getLocale();
}