Skip to content

Instantly share code, notes, and snippets.

@theodesp
Created December 7, 2019 15:58
Show Gist options
  • Save theodesp/b740e303eb1660190f630197edcda2bb to your computer and use it in GitHub Desktop.
Save theodesp/b740e303eb1660190f630197edcda2bb to your computer and use it in GitHub Desktop.
<?php
namespace App\AppBundle;
use Symfony\Bundle\FrameworkBundle\Translation\Translator as BaseTranslator;
class PhraseTranslator extends BaseTranslator
{
public function trans($id, array $parameters = array(), $domain = "messages", $locale = null)
{
$prefix = "{{__phrase_";
$suffix = "__}}";
if (null === $domain) {
$domain = 'messages';
}
// Return ID of translation key with pre- and suffix for PhraseApp
return $prefix.$id.$suffix;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment