Commit 3aabf8ab authored by Peter Serwylo's avatar Peter Serwylo

Script to automatically update the Jekyll config with available languages.

Looks at the child directories in `_data/` which contain a
`strings.json` file. The name of these folders are languages which need
to be added to the `_config.yml` `languages:` array.
parent 9478ca45
......@@ -24,3 +24,9 @@ gems:
feed:
path: feed
fdroid-repo: https://f-droid.org/repo
# The "languages" entry is automatically overridden by the tools/update_langs.sh script when
# new translations become available.
languages: [ "en", "fr" ]
default_lang: "en"
exclude_from_localization: ["css", "js"]
#!/usr/bin/env bash
DIR=`dirname $0`
JEKYLL_DIR=${DIR}/../
LANGS='"en"'
for I18N_DIR in `find ${JEKYLL_DIR}/_data/*/ -name 'strings.json' -printf '%h\n' | sort -u`; do
LANG=`basename ${I18N_DIR}`
# Check if string contains $LANG already or not: http://stackoverflow.com/a/229606/2391921
if [[ ${LANGS} != *"$LANG"* ]]; then
LANGS="$LANGS, \"$LANG\""
fi
done
echo "Updating languages to: ${LANGS}"
sed -i "s/^languages: \[.*\]/languages: [ ${LANGS} ]/" ${JEKYLL_DIR}/_config.yml
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment