The most difficult here is the @api interface, because it cannot be
changed. I think it's a problem, because here, it would be great to move
the "loader/resource" logic to some back-end service.
Here is the @api contract:
*Translator*
class Translator implements TranslatorInterface
{
public function __construct($locale, MessageSelector $selector)
public function addLoader($format, LoaderInterface $loader)
public function addResource($format, $resource, $locale, $domain =
'messages')
public function setLocale($locale)
public function getLocale()
public function setFallbackLocale($locale)
public function trans($id, array $parameters = array(), $domain =
'messages', $locale = null)
public function transChoice($id, $number, array $parameters = array(),
$domain = 'messages', $locale = null)
}
*LoaderInterface*
interface LoaderInterface
{
function load($resource, $locale, $domain = 'messages');
}