PHP Fatal error: Call to a member function locale() on a non-object

$sitepress is a global set by WPML, IIRC. Change your line 25 as follows:

if(isset($sitepress) && is_object($sitepress)) {
  setlocale(LC_TIME, $sitepress->locale() . '.UTF-8');
}

As a general rule you shouldn’t assume in a theme that anything included in or set by a plugin will be available, because it’s possible to disable the plugin while the theme is still active. Always include some sort of sanity check before attempting to access a variable, class or function from a plugin in your theme.

Edit: based on your discovery that the method you used has been deprecated, I’d suggest the following for your updated file:

if(isset($sitepress) && method_exists($sitepress, 'get_locale')) {
  setlocale(LC_TIME, $sitepress->get_locale(ICL_LANGUAGE_CODE) . '.UTF-8');
}