You can replace the foreach with something like the following (from ucp_register.php) because the $user->lang() method returns empty when a language key doesn't exist, so you don't have to use isset() here:
```php
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
```