summaryrefslogtreecommitdiff
path: root/scripts/build_i18n_json.sh
blob: 36b3b48401f82250c046644ef069583d368a13d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

TARGET_DIR="defaults/i18n"

# Check if the directory exists
if [ ! -d "$TARGET_DIR" ]; then
    echo "Error: Directory $TARGET_DIR not found."
    exit 1
fi

# Use jq to merge files
jq -n '
  reduce inputs as $i ( {}; . + { (input_filename | split("/") | last | split(".json")[0]): $i } )
' "$TARGET_DIR"/*.json > './src/i18n/languages.json'