Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Locale Class Reference

Public Member Functions

 __construct ($locale)
 
 __toString ()
 

Data Fields

const DEFAULT_SYSTEM_LOCALE = 'en_US'
 

Protected Attributes

 $_locale
 

Detailed Description

Locale

Definition at line 11 of file Locale.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $locale)

Locale construct

Parameters
string$locale
Exceptions

Definition at line 31 of file Locale.php.

32  {
33  if (!preg_match('/[a-z]{2}_[A-Z]{2}/', $locale)) {
34  throw new \InvalidArgumentException('Target locale must match the following format: "aa_AA".');
35  }
36  $this->_locale = $locale;
37  }

Member Function Documentation

◆ __toString()

__toString ( )

Return locale string

Returns
string

Definition at line 44 of file Locale.php.

45  {
46  return $this->_locale;
47  }

Field Documentation

◆ $_locale

$_locale
protected

Definition at line 23 of file Locale.php.

◆ DEFAULT_SYSTEM_LOCALE

const DEFAULT_SYSTEM_LOCALE = 'en_US'

Default system locale

Definition at line 16 of file Locale.php.


The documentation for this class was generated from the following file: