The expression ```request.env['HTTP_ACCEPT_LANGUAGE']``` are used here and inside the try... Maybe you can extract a local variable for it an use the local variable in the both calls, it's not the case of this, but in some cases, this can give much more performance.