# Change app settings within Middleware

**URL:** https://discourse.slimframework.com/t/change-app-settings-within-middleware/145
**Category:** Questions
**Created:** [April 18, 2016, 8:35am UTC](https://discourse.slimframework.com/t/change-app-settings-within-middleware/145 "2016-04-18T08:35:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jaumec](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jaumec](https://discourse.slimframework.com/u/jaumec)
#### Post date: [April 18, 2016, 8:35am UTC](https://discourse.slimframework.com/t/change-app-settings-within-middleware/145/1 "2016-04-18T08:35:39Z")

</div>

Hi everyone,

What would be the correct way to change the application settings within a Middleware?

I’m passing the container in the constructor like so:  
`$app->add(new \App\Middleware\Language($app->getContainer()));`

Somewhere inside the middleware im doing:

> …  
> $this-\>ci-\>get(‘settings’)[‘locale’] = $routeInfo[2][‘lang’];  
> …  
> return $next($request, $response);

Then, im trying to initialize the Symfony Translator dependency using the setting I’ve just set in the middleware, but ‘locale’ has not changed his value previously:

```
 $translator = new \Symfony\Component\Translation\Translator($c->get('settings')['locale'],
        new \Symfony\Component\Translation\MessageSelector());

```

---

<div class="post-metadata">

### Author: ![silentworks](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/silentworks/32/10_2.png) [@silentworks](https://discourse.slimframework.com/u/silentworks)
#### Post date: [April 18, 2016, 5:49pm UTC](https://discourse.slimframework.com/t/change-app-settings-within-middleware/145/2 "2016-04-18T17:49:31Z")

</div>

Hi, where are you currently creating the instance of the Symfony Translator in your app? can you provide a bit more code so we can see the how the app is being bootstrapped please?
