This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Check if a command exists | |
| command_exists() { | |
| command -v "$1" >/dev/null 2>&1 | |
| } | |
| # Ensure drush is available | |
| if ! command_exists drush; then | |
| echo "Error: drush command not found. Please install drush and try again." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Shell script to extract $this->t() function translations in drupal 8+ custom module and generate .pot file | |
| # Extract from .php .module .js .twig from current custom module folder | |
| # Exclude .min.js for js libraries | |
| # Put this in your module folder, make it executable : chmod +x generate_pot.sh , run it | |
| # Feel free to improve it | |
| # Define the regex patterns for each file type | |
| php_t_regex="\$this->t\(\s*'([^']*(?:@[a-zA-Z0-9_]+[^']*)*)'\s*(?:,\s*\[[^\]]*\])?\s*\)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"lastUpload":"2021-11-13T10:46:51.041Z","extensionVersion":"v3.4.3"} |