Skip to content

Instantly share code, notes, and snippets.

View ku-enza's full-sized avatar

Yemoko - Mabika Ntumba ku-enza

  • Kuenza
  • Belgium
View GitHub Profile
@ku-enza
ku-enza / Generate .po files
Last active April 26, 2023 13:38
Generate po files based on .pot file of a custom moduke in drupal 9
#!/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."
@ku-enza
ku-enza / generate_pot.sh
Last active June 2, 2025 05:36
Shell script to extract t() function translations in drupal custom module and generate .pot file
#!/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*\)"
@ku-enza
ku-enza / cloudSettings
Last active November 13, 2021 10:46
vsc dev settings
{"lastUpload":"2021-11-13T10:46:51.041Z","extensionVersion":"v3.4.3"}