# Aktuelle Template Sprache in Plugin ermitteln

**URL:** <https://forum.shopware.com/t/aktuelle-template-sprache-in-plugin-ermitteln/40263>\
**Category:** Programmierung\
**Created:** [4. Oktober 2016 um 12:13 UTC](https://forum.shopware.com/t/aktuelle-template-sprache-in-plugin-ermitteln/40263 "2016-10-04T12:13:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tromondo](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tromondo](https://forum.shopware.com/u/tromondo)\
**Post date:** [4. Oktober 2016 um 12:13 UTC](https://forum.shopware.com/t/aktuelle-template-sprache-in-plugin-ermitteln/40263/1 "2016-10-04T12:13:33Z")

</div>

Hallo zusammen,

für ein Plugin wollen wir in der Bootstrap.php für eine lokalisierte Datumsausgabe mittels&nbsp;strftime() den Language ISO Code anhand der Template Sprache setzen, da Shopware wohl von Haus aus nicht mit setlocale arbeitet.

Google spuckt diverse Informationen zu einer getLocale()-\>toString() Routine aus, welche in einer Klasse Shop ist, nur wie komme ich an diese aus einem Plugin ran?

```
public function onFrontendPostDispatch(Enlight_Event_EventArgs $args)
    {
        /** @var \Enlight_Controller_Action $controller */
        $controller = $args->get('subject');
        $view = $controller->View();
...

```

Vielen Dank für eure Hilfe.

Grüße

Tobias

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [6. Oktober 2016 um 12:21 UTC](https://forum.shopware.com/t/aktuelle-template-sprache-in-plugin-ermitteln/40263/2 "2016-10-06T12:21:20Z")

</div>

Probier mal das:

```
$shopContext = $this->get('shopware_storefront.context_service')->getShopContext();
$lang = $shopContext->getShop()->getLocale()->getLocale();

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![tromondo](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tromondo](https://forum.shopware.com/u/tromondo)\
**Post date:** [6. Oktober 2016 um 12:24 UTC](https://forum.shopware.com/t/aktuelle-template-sprache-in-plugin-ermitteln/40263/3 "2016-10-06T12:24:05Z")

</div>

Super, funktioniert :-)&nbsp;

Vielen Dank!
