1 Star 0 Fork 0

sysdl132/snapd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update-pot 2.00 KB
一键复制 编辑 原始数据 按行查看 历史
Maciej Borzecki 提交于 2018-07-03 16:37 . many: assorted shellcheck fixes
#!/bin/sh
# -*- Mode: sh; indent-tabs-mode: t -*-
set -e
# In LP#1758684 we got reports that the pot file generation
# is broken. To get to the bottom of this add checks here
# so that we error the build if this happens. Note that the
# strings may be update if those change but spread tests will
# tell us when it is needed.
check_canaries() {
c1="Alternative command to run"
c2="Name of the key to use, otherwise use the default key"
c3="too many arguments for command"
for canary in "$c1" "$c2" "$c3"; do
if ! grep -q "$canary" "$OUTPUT"; then
echo "canary '$canary' not found, pot extraction broken"
ls -lh "$OUTPUT"
exit 1
fi
done
}
HERE="$(readlink -f "$(dirname "$0")")"
OUTPUT="$HERE/po/snappy.pot"
if [ -n "$1" ]; then
OUTPUT="$1"
fi
# ensure we have our xgettext-go
go install github.com/snapcore/snapd/i18n/xgettext-go
# exclude vendor and _build subdir
I18N_FILES="$(mktemp -d)/i18n.files"
find "$HERE" -type d \( -name "vendor" -o -name "_build" \) -prune -o -name "*.go" -type f -print > "$I18N_FILES"
# shellcheck disable=SC2064
trap "rm -rf $(dirname "$I18N_FILES")" EXIT
"${GOPATH%%:*}/bin/xgettext-go" \
-f "$I18N_FILES" \
-o "$OUTPUT" \
--add-comments-tag=TRANSLATORS: \
--no-location \
--sort-output \
--package-name=snappy\
--msgid-bugs-address=snappy-devel@lists.ubuntu.com \
--keyword=i18n.G \
--keyword-plural=i18n.DG
# check canary
check_canaries
sed -i 's/charset=CHARSET/charset=UTF-8/' "$OUTPUT"
# we need the || true because of
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891347
xgettext "$HERE"/data/polkit/*.policy \
-o "$OUTPUT" \
--its="$HERE/po/its/polkit.its" \
--no-location \
--package-name=snappy \
--msgid-bugs-address=snappy-devel@lists.ubuntu.com \
--join-existing || true
check_canaries
# language packs
for p in "${HERE}"/po/*.po; do
lang=$(basename "$p" .po)
mkdir -p "$HERE/share/locale/$lang/LC_MESSAGES"
msgfmt -v -o "$HERE/share/locale/$lang/LC_MESSAGES/snappy.mo" "$p"
done
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sysdl132/snapd.git
git@gitee.com:sysdl132/snapd.git
sysdl132
snapd
snapd
latest

搜索帮助

0d507c66 1850385 C8b1a773 1850385