protected function set_localeString($value) { // Create the locale if necessary if (!$this->_i18n->hasLocale($value)) { // Get the directory path $localeDirectory = $this->_localesPath . '/' . $value; if (!is_dir($localeDirectory)) { return; } // Create the locale instance $locale = new Locale($value); // Add the messages $messagesPath = $localeDirectory . '/messages.json'; if (is_file($messagesPath)) { if (!is_readable($messagesPath)) { throw new \Exception("{$messagesPath} is not readable"); } $messages = file_get_contents($messagesPath); $messages = Json::removeComments($messages); $locale->addMessagesJson($messages); } // Add the locale $this->_i18n->addLocale($locale); } // Select the locale $this->_i18n->localeString = $value; }