get_current_locale() 공개 정적인 메소드

Tries to get the locale from Translatable, Fluent or the default i18n (depending on what is installed)
public static get_current_locale ( ) : string
리턴 string the locale in use
예제 #1
0
 /**
  * Force creating an order reference
  */
 protected function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->getField("Reference") && in_array($this->Status, self::$placed_status)) {
         $this->generateReference();
     }
     // perform status transition
     if ($this->isInDB() && $this->isChanged('Status')) {
         $this->statusTransition(empty($this->original['Status']) ? 'Cart' : $this->original['Status'], $this->Status);
     }
     // While the order is unfinished/cart, always store the current locale with the order.
     // We do this everytime an order is saved, because the user might change locale (language-switch).
     if ($this->Status == 'Cart') {
         $this->Locale = ShopTools::get_current_locale();
     }
 }
예제 #2
0
 /**
  * Force creating an order reference
  */
 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->getField("Reference") && in_array($this->Status, self::$placed_status)) {
         $this->generateReference();
     }
     // While the order is unfinished/cart, always store the current locale with the order.
     // We do this everytime an order is saved, because the user might change locale (language-switch).
     if ($this->Status == 'Cart') {
         $this->Locale = ShopTools::get_current_locale();
     }
 }