models/LanguageSource.php
public function insertLanguageItems($languageItems)
    {
        $data = [];
        foreach ($languageItems as $category => $messages) {
            foreach (array_keys($messages) as $message) {
                $data[] = [
                    $category,
                    $message,
                ];
            }
        }

        $count = count($data);
        for ($i = 0; $i < $count; $i += self::INSERT_LANGUAGE_ITEMS_LIMIT) {
            static::getDb()
                ->createCommand()
                ->batchInsert(static::tableName(), ['category', 'message'], array_slice($data, $i, self::INSERT_LANGUAGE_ITEMS_LIMIT))
                ->execute();
        }

        return $count;
    }
public function insertLanguageItems($languageItems)
    {
        $data = [];
        foreach ($languageItems as $category => $messages) {
            foreach (array_keys($messages) as $message) {
                $data[] = [
                    $category,
                    $message,
                ];
            }
        }

        $count = count($data);
        for ($i = 0; $i < $count; $i += self::INSERT_LANGUAGE_ITEMS_LIMIT) {
            static::getDb()
                ->createCommand()
                ->batchInsert(static::tableName(), ['category', 'message'], array_slice($data, $i, self::INSERT_LANGUAGE_ITEMS_LIMIT))
                ->execute();
        }

        return $count;
    }
public function insertLanguageItems ( $ languageItems ) { $ data = [ ] ; foreach ( $ languageItems as $ category => $ messages ) { foreach ( array_keys ( $ messages ) as $ message ) { $ data [ ] = [ $ category , $ message , ] ; } } $ count = count ( $ data ) ; for ( $ i = 0 ; $ i < $ count ; $ i += self :: INSERT_LANGUAGE_ITEMS_LIMIT ) { static :: getDb ( ) -> createCommand ( ) -> batchInsert ( static :: tableName ( ) , [ 'category' , 'message' ] , array_slice ( $ data , $ i , self :: INSERT_LANGUAGE_ITEMS_LIMIT ) ) -> execute ( ) ; } return $ count ; }
Inserting new language elements into the language_source table.

@param array $languageItems

@return int The number of new language elements.
Inserting new language elements into the language_source table .