From cb11ca1bbf5446ca4be5f467eac0c2b1b0672070 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 30 Sep 2025 19:14:16 +0200 Subject: [PATCH] feat: forked xgettext-go --- Dockerfile | 10 +++++----- README.md | 3 ++- plugin.sh | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7744a49..8a0646f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM golang:1.24-alpine AS build +FROM golang:1.25-alpine AS build RUN apk add git && \ - git clone https://github.com/snapcore/snapd/ /tmp/snapd/ && \ - cd /tmp/snapd/i18n/xgettext-go && \ + git clone https://git.coopcloud.tech/toolshed/xgettext-go /tmp/xgettext-go && \ + cd /tmp/xgettext-go && \ go build -FROM golang:1.24-alpine +FROM golang:1.25-alpine WORKDIR /drone/src -COPY --from=build /tmp/snapd/i18n/xgettext-go/xgettext-go /bin/xgettext-go +COPY --from=build /tmp/xgettext-go/xgettext-go /bin/xgettext-go COPY plugin.sh /plugin/plugin.sh ENTRYPOINT ["/plugin/plugin.sh"] diff --git a/README.md b/README.md index f69ab7d..bfaf0c7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://build.coopcloud.tech/api/badges/toolshed/drone-xgettext-go/status.svg?ref=refs/heads/main)](https://build.coopcloud.tech/toolshed/drone-xgettext-go) -Use `xgettext-go` as a Drone plugin. +Use the forked [`xgettext-go`](https://git.coopcloud.tech/toolshed/xgettext-go) as a Drone plugin. !!! warning "Caution!" This is currently configured very specifically for use with Co-op Cloud abra. More customisability Coming Soon™, see #1 @@ -14,6 +14,7 @@ Use `xgettext-go` as a Drone plugin. - **in**: (default: `/drone/src`) The source directory to scan for source files - **out:** (default: `/drone/src/locales/default.pot`) The target directory in which to create a `pot` file. - **keyword:** (default: `gotext.Get`) The keyword to search for translatable strings. +- **keyword-ctx:** (default: `gotext.GetC`) The keyword to search for translatable strings with context. - **comments_tag**: (default: disabled) "place comment blocks starting with TAG and prceding keyword lines in output file" ## Example diff --git a/plugin.sh b/plugin.sh index 1644e98..08b4ac7 100755 --- a/plugin.sh +++ b/plugin.sh @@ -5,6 +5,7 @@ set -ex PLUGIN_IN=${PLUGIN_IN:-/drone/src/} PLUGIN_OUT=${PLUGIN_OUT:-/drone/src/locales/default.pot} PLUGIN_KEYWORD=${PLUGIN_KEYWORD:-gotext.Get} +PLUGIN_KEYWORD_CTX=${PLUGIN_KEYWORD_CTX:-gotext.GetC} run_xgettext_cmd() { echo "--- start command ---" @@ -15,6 +16,7 @@ run_xgettext_cmd() { xgettext-go \ -o "$PLUGIN_OUT" \ --keyword="$PLUGIN_KEYWORD" \ + --keyword-ctx="$PLUGIN_KEYWORD_CTX" \ --sort-output \ ${PLUGIN_COMMENTS_TAG:+--add-comments-tag=}${PLUGIN_COMMENTS_TAG}\ $(find . -name "*.go" -not -path '*vendor*' | sort)