class-translator.php
<?php
namespace HivePress\Components;
use HivePress\Helpers as hp;
defined( 'ABSPATH' ) || exit;
final class Translator extends Component {
public function get_language() {
return hp\get_first_array_value( explode( '_', get_locale() ) );
}
public function get_region() {
$parts = explode( '_', get_locale() );
if ( count( $parts ) > 1 ) {
return hp\get_last_array_value( $parts );
}
}
public function get_string( $key ) {
return hp\get_array_value( hivepress()->get_config( 'strings' ), $key );
}
}