Translate column names to the current language.
Used in subclasses.

@param array $names
@return array
488509
protected function translateColumnNames($names)
    {
        if (!$this->apiMethod) {
            return $names;
        }

        // load the translations only once
        // when multiple dates are requested (date=...,...&period=day), the meta data would
        // be loaded lots of times otherwise
        if ($this->columnTranslations === false) {
            $meta = $this->getApiMetaData();
            if ($meta === false) {
                return $names;
            }

            $t = Metrics::getDefaultMetricTranslations();
            foreach (array('metrics', 'processedMetrics', 'metricsGoal', 'processedMetricsGoal') as $index) {
                if (isset($meta[$index]) && is_array($meta[$index])) {
                    $t = array_merge($t, $meta[$index]);
                }
            }

            foreach (Dimension::getAllDimensions() as $dimension) {
                $dimensionId   = str_replace('.', '_', $dimension->getId());
                $dimensionName = $dimension->getName();

                if (!empty($dimensionId) && !empty($dimensionName)) {
                    $t[$dimensionId] = $dimensionName;
                }
            }

            $this->columnTranslations = & $t;
        }

        foreach ($names as &$name) {
            if (isset($this->columnTranslations[$name])) {
                $name = $this->columnTranslations[$name];
            }
        }

        return $names;
    }
1318593
protected function getGenericColumns(array $columns)
    {
        $genericColumns = array();

        foreach ($columns as $column) {
            $genericColumns[] = $this->getGenericColumn($column);
        }

        return $genericColumns;
    }
366032
public function rename($tableNames = [])
    {
        $schema = '';

        $schema .= strtoupper(__FUNCTION__).' TABLE '.PHP_EOL;

        if (is_array($tableNames)) {
            $i = 0;

            $arrCount = count($tableNames);

            foreach ($tableNames as $key => $value) {
                $schema .= '`'.$key.'` TO `'.$value.'`';

                $comma = ($i < $arrCount - 1) ? ',' : '';
                $schema .= $comma.PHP_EOL;
                $i++;
            }
        } else {
            $schema .= '`'.$this->database.'.`'.$this->tableName.'` TO `'.$tableNames.'`'.PHP_EOL;
        }

        $this->schema = $schema;

        return $this;
    }
32560
private function transformColumns($columns)
    {
        return array_map(function ($column) {
            return [
                'Field' => $column->column_name,
                'Type' => $column->data_type,
                'Null' => $column->is_nullable,
                'Key' => $column->ordinal_position,
                'Default' => $column->column_default,
//                'Extra' => $column->Extra
            ];
        }, $columns);
    }
180308
public static function setNames(array $names)
    {
        if(static::$isInited)
        {
            throw new \RuntimeException('addName failed, MemoryTableManager was inited');
        }
        foreach($names as $key => $value)
        {
            if(is_numeric($key))
            {
                static::$tables[$value] = 0;
            }
            else
            {
                static::$tables[$key] = $value;
            }
        }
    }
1151857
public static function renameColumns($tableName, array $columnNames)
    {
        return [
            'up' => function (Builder $schema) use ($tableName, $columnNames) {
                $schema->table($tableName, function (Blueprint $table) use ($columnNames) {
                    foreach ($columnNames as $from => $to) {
                        $table->renameColumn($from, $to);
                    }
                });
            },
            'down' => function (Builder $schema) use ($tableName, $columnNames) {
                $schema->table($tableName, function (Blueprint $table) use ($columnNames) {
                    foreach ($columnNames as $to => $from) {
                        $table->renameColumn($from, $to);
                    }
                });
            }
        ];
    }
397162
public function spansColumns(array $columnNames)
    {
        $columns         = $this->getColumns();
        $numberOfColumns = count($columns);
        $sameColumns     = true;

        for ($i = 0; $i < $numberOfColumns; $i++) {
            if (isset($columnNames[$i]) && $this->trimQuotes(strtolower($columns[$i])) === $this->trimQuotes(strtolower($columnNames[$i]))) {
                continue;
            }

            $sameColumns = false;
        }

        return $sameColumns;
    }
1132144
public function getAssociatedByName($names)
    {
        $return = [];

        $table = $this->_table();
        foreach ($names as $association) {
            $associationClass = $table->associations()->get($association);
            if (!$associationClass) {
                throw new RuntimeException(sprintf(
                    'Table "%s" is not associated with "%s"',
                    get_class($table),
                    $association
                ));
            }
            $return[$associationClass->getName()] = $associationClass;
        }

        return $return;
    }
306887
protected function prepareTranslations($translations) {
        $return = [];

        foreach($translations as $translation)
            $return[$translation['locale']][!is_null($translation['group']) ? $translation['group']. '.' . $translation['key'] : ''. $translation['key']] = $translation['value'];

       return $return;
    }
45799
protected function getNameForLocale($locale, &$names)
    {
        if (isset($names[$locale][1])) {
            $name = $names[$locale][1];
            unset($names[$locale][1]);
        } elseif (isset($names[$locale][4])) {
            $name = $names[$locale][4];
            unset($names[$locale][4]);
        } else {
            $name = array_shift($names[$locale]);
        }

        return $name;
    }
1038054
protected function getTransfredFields(array $columns)
    {
        $collection = [];

        foreach ($columns as $column) {
            // While constructing the array for each field
            // there is no need to set translations for options
            // or even labels. This step is handled using the FieldTransformer
            $properties['name'] = $column->COLUMN_NAME;
            $properties['is-nullable'] = ($column->IS_NULLABLE == 'YES');
            $properties['data-value'] = $column->COLUMN_DEFAULT;
            $properties['data-type'] = $this->getDataType($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['data-type-params'] = $this->getPrecision($column->CHARACTER_MAXIMUM_LENGTH, $column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-primary'] = in_array($column->COLUMN_KEY, ['PRIMARY KEY', 'PRI']);
            $properties['is-index'] = ($column->COLUMN_KEY == 'MUL');
            $properties['is-unique'] = ($column->COLUMN_KEY == 'UNI');
            $properties['is-auto-increment'] = ($column->EXTRA == 'AUTO_INCREMENT');
            $properties['comment'] = $column->COLUMN_COMMENT ?: null;
            $properties['options'] = $this->getHtmlOptions($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-unsigned'] = (strpos($column->COLUMN_TYPE, 'unsigned') !== false);

            $constraint = $this->getForeignConstraint($column->COLUMN_NAME);

            $properties['foreign-constraint'] = !is_null($constraint) ? $constraint->toArray() : null;

            if (intval($column->CHARACTER_MAXIMUM_LENGTH) > 255
                || in_array($column->DATA_TYPE, $this->largeDataTypes)) {
                $properties['is-on-index'] = false;
            }

            $collection[] = $properties;
        }

        $localeGroup = Helpers::makeLocaleGroup($this->tableName);

        $fields = FieldTransformer::fromArray($collection, $localeGroup, $this->languages);

        // At this point we constructed the fields collection with the default html-type
        // We need to set the html-type using the config::getEloquentToHtmlMap() setting
        $this->setHtmlType($fields);

        return $fields;
    }
645856
public function getColumnName( $column )
    {
        if ( $this->getColumnsUseTranslation() )
        {
            $column = $this->view->translate(
                $this->getColumnId( $column ),
                $this->getColumnTranslateTextDomain()
            );
        }

        return $column;
    }
1250568
public function renameIndex(array $columns, string $name): AbstractTable
    {
        if (!$this->hasIndex($columns)) {
            throw new SchemaException(
                "Undefined index ['" . join("', '", $columns) . "'] in '{$this->getName()}'"
            );
        }

        //Declaring new index name
        $this->index($columns)->setName($name);

        return $this;
    }
744318
public function getColumns()
    {
        $translationManager = $this->framework->getInstance('\\Zepi\\Core\\Language\\Manager\\TranslationManager');
        
        return array(
            new Column('name', $translationManager->translate('Username', '\\Zepi\\Web\\AccessControl'), 50, true, true, Column::DATA_TYPE_HTML, 'icon-column'),
            new Column('uuid', $translationManager->translate('UUID', '\\Zepi\\Web\\AccessControl'), 50, true, true, Column::DATA_TYPE_STRING),
            new Column('actions', '', Column::WIDTH_AUTO, false, false, Column::DATA_TYPE_HTML, 'auto-width button-column')
        );
    }
462624
public function getTranslatedLabels(array $languages)
    {
        $labels = [];
        foreach ($languages as $language) {

            foreach (Config::getCustomModelTemplates() as $key => $properties) {
                $label = $this->makeModelLabel($key, $properties, false, $language);
                $labels[$language][] = $label;
            }
        }

        return $labels;
    }
1266798
protected function getViewNames(array $names)
    {
        return array_map(function ($name) {
            $name = str_replace('.', '/', $name);

            return $name.$this->config->getExtension();
        }, $names);
    }
1160710
public function getHeaderValues($names) {
        if (is_string($names))
            $names = array($names);
        elseif (is_array($names)) {
            foreach ($names as $name)
                if (!is_string($name)) throw new IllegalTypeException('Illegal argument type in argument $names: '.gettype($name));
        }
        else                         throw new IllegalTypeException('Illegal type of parameter $names: '.gettype($names));

        $headers = $this->getHeaders($names);
        if ($headers)
            return \array_map('trim', explode(',', join(',', $headers)));

        return $headers; // empty array;
    }