Coder Social home page Coder Social logo

Comments (2)

Holo96 avatar Holo96 commented on June 4, 2024

I cannot upload patch here, but I've already created command for myself

diff --git a/src/Commands/core/LocaleCommands.php b/src/Commands/core/LocaleCommands.php
index fea828a6e..903b14519 100644
--- a/src/Commands/core/LocaleCommands.php
+++ b/src/Commands/core/LocaleCommands.php
@@ -27,6 +27,7 @@ final class LocaleCommands extends DrushCommands
     const UPDATE = 'locale:update';
     const EXPORT = 'locale:export';
     const IMPORT = 'locale:import';
+    const EXPORT_ALL = 'locale:export-all';
     const IMPORT_ALL = 'locale:import-all';
 
     protected function getLanguageManager(): LanguageManagerInterface
@@ -284,6 +285,30 @@ final class LocaleCommands extends DrushCommands
         drush_backend_batch_process();
     }
 
+    /**
+     * Exports multiple translation files into the defined directory.
+     *
+     * @throws \Exception
+     */
+    #[CLI\Command(name: self::EXPORT_ALL, aliases: ['locale-export-all', 'locale:export:all'])]
+    #[CLI\Argument(name: 'directory', description: 'Export directory for translation files.')]
+    #[CLI\Option(name: 'types', description: 'A comma separated list of string types to include, defaults to all types. Recognized values: <info>not-customized</info>, <info>customized</info>, </info>not-translated<info>')]
+    #[CLI\ValidateModulesEnabled(modules: ['locale'])]
+    public function exportAll($directory, $options = ['types' => self::REQ])
+    {
+        if (!is_dir($directory)) {
+            throw new \Exception('The defined directory does not exist.');
+        }
+
+        $languages = $this->getLanguageManager()->getLanguages();
+        $poreader_options = $this->convertTypesToPoDbReaderOptions(StringUtils::csvToArray($options['types']));
+        foreach ($languages as $language) {
+            $langcode = $language->getId();
+            $this->writePoFile($directory . '/' . $langcode . '.po', $language, $poreader_options);
+        }
+
+    }
+
     /**
      * Converts input of translation type.
      *

from drush.

weitzman avatar weitzman commented on June 4, 2024

Hi. We are in need of a new locale maintainer for Drush. Hopefully they will show up and evaluating this will be a nice first task for them.

from drush.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.