0

I have simply Entity:

/**
 * Claudio\PageBundle\Entity\Page
 */
class Page
{
//
    private $id;

    private $title;

    private $text_en;

    private $text_fr;

    //getters and setters for all
}

And i would add for this getter:

public function getText()
{
    $culture = ???;
    if($culture == 'en') return $this->getTextEn();
    if($culture == 'fr') return $this->getTextFr();
}

but how can i get Culture/Local in Entity class? I know - i can make it by using Controller or Twig, but i would like use this in all views etc by $page->getText(). Is possible to make in Entity?

1 Answers1

1

setlocale(LC_ALL, 0);

Will return the locales that are set. It might return more than one locale.

Esteban Filardi
  • 726
  • 3
  • 16
  • 30