if (OC_Util::isSetLocaleWorking()) { setlocale(LC_ALL, 'en_US.utf8'); } else { // fallback to default locale }
if (!OC_Util::isSetLocaleWorking()) { die('Locale cannot be set!'); }This example checks if the locale can be set and if it cannot be set, terminates the script with an error message. `isSetLocaleWorking` method is part of the ownCloud PHP package library.