mihaildev\elfinder\Assets::addLangFile PHP Method

addLangFile() public static method

public static addLangFile ( string $lang, View $view )
$lang string
$view yii\web\View
    public static function addLangFile($lang, $view)
    {
        $lang = ElFinder::getSupportedLanguage($lang);
        if ($lang !== false && $lang !== 'en') {
            $view->registerJsFile(self::getPathUrl() . '/js/i18n/elfinder.' . $lang . '.js', ['depends' => [Assets::className()]]);
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Registers TinyMce JS
  */
 protected function registerClientScript()
 {
     $view = $this->getView();
     if (!isset($this->options['language']) || empty($this->options['language'])) {
         $this->options['language'] = strtolower(substr(Yii::$app->language, 0, 2));
     }
     // Insert plugins in options
     if (isset($this->options['plugins'])) {
         foreach ($this->options['plugins'] as $pluginLine) {
             foreach (explode(' ', $pluginLine) as $plugin) {
                 //if load elfinder plugin ,load elfinder asserts first
                 if ($plugin == 'elfinder') {
                     \mihaildev\elfinder\Assets::register($this->getView());
                     \mihaildev\elfinder\Assets::addLangFile($this->options['language'], $this->getView());
                 }
                 $this->registerPlugin($plugin);
             }
         }
     }
     $options = empty($this->options) ? '' : Json::encode($this->options);
     $js = "tinymce.init({$options});";
     $view->registerJs($js);
 }
All Usage Examples Of mihaildev\elfinder\Assets::addLangFile