Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
vendor/
composer.lock
24 changes: 24 additions & 0 deletions bin/extract-locales
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,29 @@ if [ ! -z "$JS_FILES" ]; then
--keyword=i18n.pgettext:$F_ARGS_X
fi

# Append locales from Vue
VUE_FILES=`find -not -regex $EXCLUDE_REGEX -type f -name "*.vue"`
if [ ! -z "$VUE_FILES" ]; then
cd $WORKING_DIR/vendor/glpi-project/tools
npm install
npm run vue:gettext:extract

cd $WORKING_DIR
if [ -f locales/vue.pot ]; then
echo "merge vue locales"

# replace ../../.. by nothing in locales/vue.pot
sed -e 's#../../../##g' -i locales/vue.pot

# merge vue pot with existing global pot file
xgettext -o $POTFILE --join-existing locales/vue.pot

rm locales/vue.pot
else
echo "no vue locales to merge"
exit 1
fi
fi

# Update main language
LANG=C msginit --no-translator -i $POTFILE -l en_GB -o $WORKING_DIR/locales/en_GB.po
23 changes: 23 additions & 0 deletions gettext.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
input: {
path: "../../../js",
include: ["**/*.vue"],
parserOptions: {
overrideDefaultKeywords: true,
mapping: {
simple: ["__"],
plural: ["_n"],
ctxPlural: ["_nx"],
ctx: ["_x"]
}
}
},
output: {
path: "./",
potPath: "../../../locales/vue.pot",
locales: [],
splitJson: false,
linguas: false,
flat: true
},
};
Loading