# image-optimization/1.5.3/classes/locale.php

Image Optimizer – Compress Images and Convert to WebP or AVIF, version 1.5.3. 28 lines.

- Page: https://pluginprobe.com/plugins/image-optimization/1.5.3/code/classes/locale.php
- Raw: https://pluginprobe.com/plugins/image-optimization/1.5.3/raw/classes/locale.php
- Modified: 2024-02-06T14:05:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/image-optimization/1.5.3/code/classes/locale.php#L10-L20`.

```php
<?php

namespace ImageOptimization\Classes;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Locale {
	private $original_locale;

	public function set_utf_locale( int $category = LC_CTYPE ) {
		setlocale( $category, 'en_US.UTF-8' );
	}

	public function get_locale( int $category = LC_CTYPE ) {
		return setlocale( $category, 0 );
	}

	public function reset_to_original( int $category = LC_CTYPE ) {
		return setlocale( $category, $this->original_locale );
	}

	public function __construct() {
		$this->original_locale = $this->get_locale();
	}
}

```
