Wouldn't that go crazy if you pass an unsupported locale? In that case `old_locale` will be undefined, but still used in the `ensure` section.

I think you'll have to do something like that:

```ruby
def with_locale(locale)
  raise "Unsupported locale" unless supported_locale?(locale)

  begin
    old_locale = @locale
    @locale = locale
    result = yield
  ensure
    @locale = old_locale
    result
  end
end
```

`begin...end` inside a method looks ugly, but I don't know how to handle it nicer.