diff --git a/README.md b/README.md
index 12d7efb..21346d2 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ The ineptly named tool which may one day supercede the older [build tools](https
![moo](https://media.giphy.com/media/8AsXV477ls6LS/giphy.gif)
## DEV_MODE
-Enable DEV_MODE by adding DEV_MODE=1 to a .env file. This will prevent pushing to github and transifex.
+Enable DEV_MODE by adding DEV_MODE=1 to a .env file. This will prevent pushing to github.
Do not perform a release on a directory if you previously used DEV_MODE on that directory because the steps will be out of order. Instead, delete the directory that had DEV_MODE run on it and start the entire release again with DEV_MODE disabled.
@@ -63,7 +63,6 @@ To run Cow without Docker, reference the `Dockerfile` for system requirements.
## Extra setup
-* For translation steps you may need the Transifex API Key and ~/.transifexrc (run `./docker/bin/tx init` to generate it).
* When publishing to GitHub make sure you have `ssh-agent` running and your SSH keys loaded (run `ssh-add`)
## Commands
diff --git a/docker/Dockerfile b/docker/Dockerfile
index a1f096d..bc2c947 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -44,8 +44,6 @@ FROM php as base
RUN apt-get update -y \
&& apt-get install -y git python3-pip openssh-client \
- && pip3 install -U pip \
- && pip install transifex-client awscli \
&& apt-get install -y ruby \
&& gem install yamlclean
diff --git a/docker/README.md b/docker/README.md
index 8ec90e2..fd6679d 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -71,7 +71,7 @@ but only used within `docker-compose.yml`
### Scripts
-When you run Cow via one of these scripts, Docker will be given access to the contents of the folder you ran it from, along with some of your environment variables, .transifexrc and SSH agent, to allow creating / modifying releases and publishing them to GitHub.
+When you run Cow via one of these scripts, Docker will be given access to the contents of the folder you ran it from, along with some of your environment variables, and SSH agent, to allow creating / modifying releases and publishing them to GitHub.
#### ./docker/bin/debug
@@ -105,8 +105,3 @@ Runs a stable Cow release, based on the latest published Docker container.
Runs `./vendor/bin/phpunit` within a container with Xdebug knocking to port 9000 (configurable through `docker/.env`).
Can be used for Cow tests development and debugging.
-
-
-#### ./docker/bin/tx
-
-Runs transifex client within the latest stable container published.
diff --git a/docker/bin/run b/docker/bin/run
index bb1341e..92b28a7 100755
--- a/docker/bin/run
+++ b/docker/bin/run
@@ -47,9 +47,6 @@ docker_compose_params()
docker_compose_run()
{
- # make sure .transifexrc exists (otherwise docker creates a folder there
- [ -f ~/.transifexrc ] || touch ~/.transifexrc;
-
cd $DOCKER_DIR && \
docker-compose run --rm $(docker_compose_params) $EXTRA_FLAGS $1 ${@:2}
}
diff --git a/docker/bin/tx b/docker/bin/tx
deleted file mode 100755
index 1738099..0000000
--- a/docker/bin/tx
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-# Run Release mode (mounts ssh-agent and scans github ssh keys)
-
-# Portable versions of the path functions (should work on Linux, MacOS and Windows)
-function _dirname() { python -c 'import sys; from os.path import realpath, dirname; print(dirname(realpath(sys.argv[-1])))' $@ ; }
-function _realpath() { python -c 'import sys; from os.path import realpath; print(realpath(sys.argv[-1]))' $@ ; }
-
-SKIP_RUN_EXEC="1"
-. "$(_dirname $(_realpath "$0"))/run"
-
-EXTRA_FLAGS="-e COW_MODE_TRANSIFEX=1"
-docker_compose_run release $@
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index d92b710..cf22292 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -14,7 +14,6 @@ x-volumes: &volumes
- '${GIT_CONFIG}:/home/cow/.gitconfig:ro'
# - '${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}:rw' # macOS socket is not writeable by non-root users
- '~/.ssh:/home/cow/.ssh'
- - '~/.transifexrc:/home/cow/.transifexrc'
x-debug-env-var: &x-debug-env-var 'remote_enable=1 remote_mode=req remote_port=${XDEBUG_PORT} remote_host=${XDEBUG_HOST} remote_connect_back=0'
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 6ac2007..05f5dd8 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -29,11 +29,6 @@ if [ ! -z "$COW_MODE_RELEASE" ] ; then
ssh -qT git@github.com 2>&1 | grep "successfully authenticated" || (echo "GitHub authentication error" && exit 1)
fi
-if [ ! -z "$COW_MODE_TRANSIFEX" ] ; then
- tx $@
- exit;
-fi
-
if [ ! -z "$COW_MODE_COMPOSER" ] ; then
composer $@
exit;
diff --git a/src/Application.php b/src/Application.php
index a0eca59..d95afbc 100644
--- a/src/Application.php
+++ b/src/Application.php
@@ -101,7 +101,6 @@ protected function getDefaultCommands(): array
$commands[] = new Commands\Release\Create();
$commands[] = new Commands\Release\Plan();
$commands[] = new Commands\Release\Branch();
- $commands[] = new Commands\Release\Translate();
$commands[] = new Commands\Release\Test();
$commands[] = new Commands\Release\Changelog($this);
$commands[] = new Commands\Release\MergeUp();
@@ -114,7 +113,6 @@ protected function getDefaultCommands(): array
$commands[] = new Commands\Release\Publish();
// Module commands
- $commands[] = new Commands\Module\TranslateBuild();
$commands[] = new Commands\Module\Sync\Metadata($supportedModuleLoader);
// Schema commands
diff --git a/src/Commands/Module/TranslateBuild.php b/src/Commands/Module/TranslateBuild.php
deleted file mode 100644
index 7e3f387..0000000
--- a/src/Commands/Module/TranslateBuild.php
+++ /dev/null
@@ -1,37 +0,0 @@
-run($this->input, $this->output);
- }
-}
diff --git a/src/Commands/Release/Release.php b/src/Commands/Release/Release.php
index cf2770b..2143cff 100644
--- a/src/Commands/Release/Release.php
+++ b/src/Commands/Release/Release.php
@@ -11,7 +11,6 @@
use SilverStripe\Cow\Steps\Release\PlanRelease;
use SilverStripe\Cow\Steps\Release\RewriteReleaseBranches;
use SilverStripe\Cow\Steps\Release\RunTests;
-use SilverStripe\Cow\Steps\Release\UpdateTranslations;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\Output;
@@ -39,24 +38,6 @@ protected function configureOptions()
InputOption::VALUE_NONE,
'Skip the tests suite run when performing the release'
)
- ->addOption(
- 'skip-i18n',
- null,
- InputOption::VALUE_NONE,
- 'Skip the text collection task when performing the release'
- )
- ->addOption(
- 'skip-i18n-translations-pull-and-update',
- null,
- InputOption::VALUE_NONE,
- 'Skip running tx pull, i18nTextCollectorTask and js/json updates'
- )
- ->addOption(
- 'i18n-translations-push',
- null,
- InputOption::VALUE_NONE,
- 'Run tx push -s - only do this during the beta1 release of a new minor'
- )
->addOption(
'skip-emulate-requirements',
null,
@@ -127,16 +108,6 @@ protected function fire()
$branchAlias = new RewriteReleaseBranches($this, $project, $releasePlan);
$branchAlias->run($this->input, $this->output);
- // Update all translations
- if (!$this->input->getOption('skip-i18n')) {
- $translate = new UpdateTranslations($this, $project, $releasePlan);
- $doTxPullAndUpdate = !$this->input->getOption('skip-i18n-translations-pull-and-update');
- $translate->setDoTransifexPullAndUpdate($doTxPullAndUpdate);
- $doTxPush = $this->input->getOption('i18n-translations-push');
- $translate->setDoTransifexPush($doTxPush);
- $translate->run($this->input, $this->output);
- }
-
// Run tests
if (!$this->input->getOption('skip-tests')) {
$test = new RunTests($this, $project);
diff --git a/src/Commands/Release/Translate.php b/src/Commands/Release/Translate.php
deleted file mode 100644
index 513e20a..0000000
--- a/src/Commands/Release/Translate.php
+++ /dev/null
@@ -1,39 +0,0 @@
-getInputVersion();
- $project = $this->getProject();
- $branching = $this->getBranching();
-
- // Build and confirm release plan
- $buildPlan = new PlanRelease($this, $project, $version, $branching, $this->progressBar);
- $buildPlan->run($this->input, $this->output);
- $releasePlan = $buildPlan->getReleasePlan();
-
- // Update all translations
- $translate = new UpdateTranslations($this, $project, $releasePlan);
- $doTxPullAndUpdate = !$this->input->getOption('skip-i18n-translations-pull-and-update');
- $translate->setDoTransifexPullAndUpdate($doTxPullAndUpdate);
- $doTxPush = $this->input->getOption('i18n-translations-push');
- $translate->setDoTransifexPush($doTxPush);
- $translate->run($this->input, $this->output);
- }
-}
diff --git a/src/Model/Modules/Module.php b/src/Model/Modules/Module.php
index 2a8cd2b..90b4b14 100644
--- a/src/Model/Modules/Module.php
+++ b/src/Model/Modules/Module.php
@@ -7,62 +7,6 @@
*/
class Module extends Library
{
- /**
- * Gets the module lang dir
- *
- * @return string
- */
- public function getLangDirectory()
- {
- $sources = $this->getTransifexSources();
- foreach ($sources as $source) {
- if (preg_match('#^(?
.+)\\/(?[^\\/]+)\\.yml$#', $source, $matches)) {
- return $this->getDirectory() . '/' . $matches['dir'];
- }
- }
- return null;
- }
-
- /**
- * Gets the directories of the JS lang folder.
- *
- * @return array
- */
- public function getJSLangDirectories()
- {
- $sources = $this->getTransifexSources();
- $dirs = [];
- foreach ($sources as $source) {
- // Strip out /src/ dir and trailing file.js
- if (preg_match('#^(?.+)\\/src\\/(?[^\\/]+)\\.js(on)?$#', $source, $matches)) {
- $dirs[] = $this->getDirectory() . '/' . $matches['dir'];
- }
- }
- return $dirs;
- }
-
- /**
- * Get list of transifex source files. E.g. lang/en.yml
- *
- * @return string[]
- */
- public function getTransifexSources()
- {
- if (!$this->isTranslatable()) {
- return [];
- }
-
- $path = $this->getDirectory() . '/.tx/config';
- $content = file_get_contents($path);
- $sources = [];
- foreach (preg_split('~\R~u', $content) as $line) {
- if (preg_match('#source_file\s=\s(?\S+)#', $line, $matches)) {
- $sources[] = $matches['path'];
- }
- }
- return $sources;
- }
-
/**
* Directory where module files exist; Usually the one that sits just below the top level project
*
@@ -73,47 +17,6 @@ public function getMainDirectory()
return $this->getDirectory();
}
- /**
- * Get path of main directory (with sources, lang, etc) relative to BASE_DIR.
- * This is necessary for i18nTextCollector
- *
- * @return string
- */
- public function getRelativeMainDirectory()
- {
- $dir = $this->getMainDirectory();
- $base = $this->getProject()->getDirectory();
-
- // Remove base dir (plus /) from main directory
- return substr($dir, strlen($base) + 1);
- }
-
- /**
- * Get parameter to pass to i18n text collector
- *
- * @return string
- */
- public function getI18nTextCollectorName()
- {
- $dir = $this->getRelativeMainDirectory();
- // If short name has any slashes just use composer name instead
- if (preg_match('#\w[\\/]\w#', $dir)) {
- return $this->getName();
- }
- return $dir;
- }
-
- /**
- * Determine if this project has a .tx configured
- *
- * @return bool
- */
- public function isTranslatable()
- {
- return $this->getDirectory() && realpath($this->getDirectory() . '/.tx/config');
- }
-
-
/**
* Cached link
*
diff --git a/src/Steps/Module/BuildTranslations.php b/src/Steps/Module/BuildTranslations.php
deleted file mode 100644
index dba8db3..0000000
--- a/src/Steps/Module/BuildTranslations.php
+++ /dev/null
@@ -1,36 +0,0 @@
-module = $module;
- }
-
- public function getStepName()
- {
- return 'module:translations:build';
- }
-
- public function run(InputInterface $input, OutputInterface $output)
- {
- $modules = [ $this->module ];
- Translations::generateJavascript($this->getCommandRunner($output), $modules);
- }
-}
diff --git a/src/Steps/Release/UpdateTranslations.php b/src/Steps/Release/UpdateTranslations.php
deleted file mode 100644
index 209355a..0000000
--- a/src/Steps/Release/UpdateTranslations.php
+++ /dev/null
@@ -1,534 +0,0 @@
-getTranslatableModules(), false);
- $count = count($modules);
- if ($count === 0) {
- $this->log($output, "No modules require translation: skipping");
- return;
- }
- if ($this->doTransifexPullAndUpdate) {
- $this->log($output, "Updating translations for {$count} module(s)");
- $this->storeJson($output, $modules);
- $this->storeYaml($output, $modules);
- $this->transifexPullSource($output, $modules);
- $this->mergeYaml($output);
- $this->cleanYaml($output, $modules);
- $this->mergeJson($output);
- $this->collectStrings($output, $modules);
- $this->generateJavascript($output, $modules);
- }
- if ($this->doTransifexPush) {
- $this->transifexPushSource($output, $modules);
- }
- $this->commitChanges($output, $modules);
- $this->log($output, 'Translations complete');
- }
-
- /**
- * @deprecated 2.3..3.0
- * @param OutputInterface $output
- */
- protected function checkTransifexVersion(OutputInterface $output)
- {
- // noop
- }
-
- /**
- * Backup local yaml files in memory
- *
- * @param OutputInterface $output
- * @param Module[] $modules
- */
- protected function storeYaml(OutputInterface $output, array $modules): void
- {
- $this->log($output, 'Backing up local yaml files');
- // Backup files prior to replacing local copies with transifex
- $this->originalYaml = [];
- foreach ($modules as $module) {
- foreach (glob($module->getLangDirectory() . '/*.yml') as $path) {
- if ($output->isVerbose()) {
- $this->log($output, "Backing up $path");
- }
- $rawYaml = file_get_contents($path);
- $this->originalYaml[$path] = Yaml::parse($rawYaml);
- }
- }
- $this->log($output, 'Finished backing up ' . count($this->originalYaml) . ' yaml files');
- }
-
- /**
- * Merge any missing keys from old yaml content into yaml files
- *
- * @param OutputInterface $output
- */
- protected function mergeYaml(OutputInterface $output): void
- {
- // skip if no translations for this run
- if (empty($this->originalYaml)) {
- return;
- }
- $this->log($output, 'Merging local yaml files');
- foreach ($this->originalYaml as $path => $contentYaml) {
- if (file_exists($path)) {
- // If there are any keys in the original yaml that are missing now, add them back in.
- $rawYaml = file_get_contents($path);
- $parsedYaml = Yaml::parse($rawYaml);
- $contentYaml = $this->arrayMergeRecursive($contentYaml, $parsedYaml);
- }
-
- // Write back to local
- file_put_contents($path, Yaml::dump($contentYaml));
- }
- $this->log($output, 'Finished merging ' . count($this->originalYaml) . ' yaml files');
- }
-
- /**
- * Backup local json files
- *
- * @param OutputInterface $output
- * @param Module[] $modules
- */
- protected function storeJson(OutputInterface $output, $modules)
- {
- $this->log($output, 'Backing up local json files');
- // Backup files prior to replacing local copies with transifex
- $this->originalJson = [];
- foreach ($modules as $module) {
- $jsPath = $module->getJSLangDirectories();
- foreach ((array)$jsPath as $langDir) {
- foreach (glob($langDir . '/src/*.json') as $path) {
- if ($output->isVerbose()) {
- $this->log($output, "Backing up $path");
- }
- $this->originalJson[$path] = $this->decodeJSONFile($path);
- }
- }
- }
- $this->log($output, 'Finished backing up ' . count($this->originalJson) . ' json files');
- }
-
- /**
- * Check for errors in the last json_decode
- *
- * @param string $path
- * @throws \Exception
- */
- protected function checkJsonDecode($path)
- {
- if (json_last_error()) {
- $message = json_last_error_msg();
- throw new Exception("Error json decoding file {$path}: {$message}");
- }
- }
-
- /**
- * Merge any missing keys from old json content into json files
- *
- * @param OutputInterface $output
- */
- protected function mergeJson(OutputInterface $output)
- {
- // skip if no translations for this run
- if (empty($this->originalJson)) {
- return;
- }
- $this->log($output, 'Merging local json files');
- foreach ($this->originalJson as $path => $contentJSON) {
- if (file_exists($path)) {
- // If there are any keys in the original json that are missing now, add them back in.
- $parsedJSON = $this->decodeJSONFile($path);
- $contentJSON = array_merge($contentJSON, $parsedJSON);
- }
-
- // Write back to local
- file_put_contents($path, json_encode($contentJSON, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
- }
- $this->log($output, 'Finished merging ' . count($this->originalJson) . ' json files');
- }
-
- /**
- * Update sources from transifex
- *
- * @param OutputInterface $output
- * @param Module[] $modules List of modules
- */
- protected function transifexPullSource(OutputInterface $output, $modules)
- {
- foreach ($modules as $module) {
- $name = $module->getName();
- $this->log(
- $output,
- "Pulling sources from transifex for {$name} (min %{$this->txMinimumPerc} delta)"
- );
-
- // Set mtime to a year ago so that transifex will see these as obsolete
- $ymlLang = $module->getLangDirectory();
- if ($ymlLang) {
- $touchCommand = sprintf(
- 'find %s -type f \( -name "*.yml" \) -exec touch -t %s {} \;',
- $ymlLang,
- date('YmdHi.s', strtotime('-1 year'))
- );
- $this->runCommand($output, $touchCommand);
- }
- $jsLangDirs = $module->getJSLangDirectories();
- foreach ($jsLangDirs as $jsLangDir) {
- $jsLangDir = $jsLangDir . '/src';
- $touchCommand = sprintf(
- 'find %s -type f \( -name "*.json*" \) -exec touch -t %s {} \;',
- $jsLangDir,
- date('YmdHi.s', strtotime('-1 year'))
- );
- $this->runCommand($output, $touchCommand);
- }
-
- // Run tx pull
- $pullCommand = sprintf(
- '(cd %s && tx pull -a -s -f --minimum-perc=%d)',
- $module->getDirectory(),
- $this->txMinimumPerc
- );
- $this->runCommand($output, $pullCommand);
- }
- }
-
- /**
- * Tidy yaml files using symfony yaml
- *
- * @param OutputInterface $output
- * @param Module[] $modules List of modules
- */
- protected function cleanYaml(OutputInterface $output, $modules)
- {
- foreach ($modules as $module) {
- $name = $module->getName();
- $this->log(
- $output,
- "Cleaning YAML sources for {$name}"
- );
-
- $num = 0;
- foreach (glob($module->getLangDirectory() . "/*.yml") as $sourceFile) {
- $dirty = file_get_contents($sourceFile);
- $sourceData = Yaml::parse($dirty);
- $cleaned = Yaml::dump($sourceData, 9999, 2);
- if ($dirty !== $cleaned) {
- $num++;
- file_put_contents($sourceFile, $cleaned);
- }
- }
-
- $this->log($output, "{$num} yml files cleaned");
- }
- }
-
- /**
- * Run text collector on the given modules
- *
- * @param OutputInterface $output
- * @param Module[] $modules List of modules
- */
- protected function collectStrings(OutputInterface $output, $modules)
- {
- $this->log($output, "Running i18nTextCollectorTask");
-
- // Get code dirs for each module
- $dirs = array();
- foreach ($modules as $module) {
- $dirs[] = $module->getI18nTextCollectorName();
- }
-
- $sakeCommand = sprintf(
- '(cd %s && %s dev/tasks/i18nTextCollectorTask "flush=all" "merge=1" "module=%s")',
- $this->getProject()->getDirectory(),
- $this->getProject()->getSakePath(),
- implode(',', $dirs)
- );
- $this->runCommand($output, $sakeCommand, "Error encountered running i18nTextCollectorTask");
- }
-
- /**
- * Generate javascript for all modules
- *
- * @param OutputInterface $output
- * @param Module[] $modules
- */
- protected function generateJavascript(OutputInterface $output, $modules)
- {
- Translations::generateJavascript($this->getCommandRunner($output), $modules);
- }
-
- /**
- * Push source updates to transifex
- *
- * @param OutputInterface $output
- * @param Module[] $modules
- */
- protected function transifexPushSource(OutputInterface $output, $modules)
- {
- $this->log($output, "Pushing updated sources to transifex");
- if (Application::isDevMode()) {
- echo "Not pushing to transifex because DEV_MODE is enabled\n";
- return;
- }
- foreach ($modules as $module) {
- $pushCommand = sprintf('(cd %s && tx push -s)', $module->getDirectory());
- $moduleName = $module->getName();
- $this->runCommand($output, $pushCommand, "Error pushing module {$moduleName} to origin");
- }
- }
-
- /**
- * Commit changes for all modules
- *
- * @param OutputInterface $output
- * @param Module[] $modules
- */
- public function commitChanges(OutputInterface $output, $modules)
- {
- $this->log($output, 'Committing translations to git');
-
- foreach ($modules as $module) {
- $repo = $module->getRepository();
-
- // Add all changes
- $jsPath = $module->getJSLangDirectories();
- $langPath = $module->getLangDirectory();
- foreach (array_merge((array)$jsPath, (array)$langPath) as $path) {
- if (is_dir($path)) {
- $repo->run("add", array($path . "/*"));
- }
- }
-
- // Commit changes if any exist
- $status = $repo->run("status");
- if (stripos($status, 'Changes to be committed:')) {
- $this->log($output, "Comitting changes for module " . $module->getName());
- $repo->run("commit", array("-m", "Update translations"));
- }
-
- // Do push if selected
- if (Application::isDevMode()) {
- echo "Not pushing changes because DEV_MODE is enabled\n";
- } else {
- if ($this->doGitPush) {
- $this->log($output, "Pushing upstream for module " . $module->getName());
- $repo->run("push", array("origin"));
- }
- }
- }
- }
-
- /**
- * @return bool
- */
- public function getDoGitPush()
- {
- return $this->doGitPush;
- }
-
- /**
- * @param bool $doGitPush
- * @return $this
- */
- public function setDoGitPush($doGitPush)
- {
- $this->doGitPush = $doGitPush;
- return $this;
- }
-
- /**
- * @return bool
- */
- public function getDoTransifexPullAndUpdate()
- {
- return $this->doTransifexPullAndUpdate;
- }
-
- /**
- * @param bool $doTransifexPullAndUpdate
- * @return $this
- */
- public function setDoTransifexPullAndUpdate($doTransifexPullAndUpdate)
- {
- $this->doTransifexPullAndUpdate = $doTransifexPullAndUpdate;
- return $this;
- }
-
- /**
- * @return bool
- */
- public function getDoTransifexPush()
- {
- return $this->doTransifexPush;
- }
-
- /**
- * @param bool $doTransifexPush
- * @return $this
- */
- public function setDoTransifexPush($doTransifexPush)
- {
- $this->doTransifexPush = $doTransifexPush;
- return $this;
- }
-
- /**
- * @return Module[]|Generator
- */
- public function getTranslatableModules()
- {
- // Don't translate upgrade-only
- foreach ($this->getNewReleases() as $release) {
- // Only translate modules with .tx directories
- $library = $release->getLibrary();
- if ($library instanceof Module && $library->isTranslatable()) {
- yield $library;
- }
- }
- }
-
- /**
- * Decode json file
- *
- * @param string $path
- * @return array
- */
- protected function decodeJSONFile($path)
- {
- $masterJSON = json_decode(file_get_contents($path), true);
- $this->checkJsonDecode($path);
- return $masterJSON;
- }
-
- /**
- * Recursively merges two arrays.
- *
- * Behaves similar to array_merge_recursive(), however it only merges
- * values when both are arrays rather than creating a new array with
- * both values, as the PHP version does.
- *
- * @param array $array1
- * @param array $array2
- * @return array
- */
- private function arrayMergeRecursive(array $array1, array $array2): array
- {
- foreach ($array2 as $key => $value) {
- if (is_array($value) && array_key_exists($key, $array1) && is_array($array1[$key])) {
- $array1[$key] = $this->arrayMergeRecursive($array1[$key], $value);
- } else {
- $array1[$key] = $value;
- }
- }
-
- return $array1;
- }
-}
diff --git a/src/Utility/Translations.php b/src/Utility/Translations.php
deleted file mode 100644
index 17d0103..0000000
--- a/src/Utility/Translations.php
+++ /dev/null
@@ -1,92 +0,0 @@
-log("Generating javascript locale files");
- // Check which paths in each module require processing
- $count = 0;
- foreach ($modules as $module) {
- $base = $module->getMainDirectory();
- $jsPath = $module->getJSLangDirectories();
- foreach ((array)$jsPath as $path) {
- $count += static::generateJavascriptInDirectory($runner, $base, $path);
- }
- }
- $runner->log("Finished generating {$count} files");
- }
-
-
- /**
- * Process all javascript in a given path
- *
- * @param CommandRunner $runner
- * @param string $base Base directory of the module
- * @param string $path Path to the location of JS files
- * @return int Number of files generated
- * @internal param Step $step
- * @internal param OutputInterface $output
- */
- protected static function generateJavascriptInDirectory(CommandRunner $runner, $base, $path)
- {
- // Iterate through each source file
- $count = 0;
- $template = <<log("Generating file {$targetFile}", "info", OutputInterface::VERBOSITY_VERY_VERBOSE);
-
- file_put_contents(
- $targetFile,
- str_replace(
- array(
- '%TRANSLATIONS%',
- '%FILE%',
- '%LOCALE%'
- ),
- array(
- $sourceContents,
- substr($sourceFile, strlen($base) + 1), // Trim off base dir
- $locale
- ),
- $template
- )
- );
- }
- return $count;
- }
-}