git: f604686b3abc - main - textproc/dmenu-translate: New port: Quick text translation with dmenu
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Dec 2024 14:28:12 UTC
The branch main has been updated by fuz:
URL: https://cgit.FreeBSD.org/ports/commit/?id=f604686b3abcbead9f8add1f3aa674f3ec979e14
commit f604686b3abcbead9f8add1f3aa674f3ec979e14
Author: Yusuf Yaman <nxjoseph@protonmail.com>
AuthorDate: 2024-11-13 19:55:30 +0000
Commit: Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-12-02 14:27:27 +0000
textproc/dmenu-translate: New port: Quick text translation with dmenu
dmenu-translate is a simple and efficient tool that allows users to translate
text quickly using the dmenu or any other dmenu-like utility. It supports
multiple languages and translation services, making it easy
to get instant translations with minimal effort.
WWW: https://github.com/NikitaIvanovV/dmenu-translate
PR: 282733
---
textproc/Makefile | 1 +
textproc/dmenu-translate/Makefile | 40 +++++++++++++++++++
textproc/dmenu-translate/distinfo | 3 ++
.../dmenu-translate/files/patch-dmenu-translate | 45 ++++++++++++++++++++++
textproc/dmenu-translate/pkg-descr | 4 ++
5 files changed, 93 insertions(+)
diff --git a/textproc/Makefile b/textproc/Makefile
index 8668ddb95bde..68e257db3cbf 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -155,6 +155,7 @@
SUBDIR += diffutils
SUBDIR += dikt
SUBDIR += discount
+ SUBDIR += dmenu-translate
SUBDIR += doc-mode.el
SUBDIR += docbook
SUBDIR += docbook-sgml
diff --git a/textproc/dmenu-translate/Makefile b/textproc/dmenu-translate/Makefile
new file mode 100644
index 000000000000..eceb94db0491
--- /dev/null
+++ b/textproc/dmenu-translate/Makefile
@@ -0,0 +1,40 @@
+PORTNAME= dmenu-translate
+DISTVERSION= g20230526
+CATEGORIES= textproc
+
+MAINTAINER= nxjoseph@protonmail.com
+COMMENT= Quick text translation with dmenu
+WWW= https://github.com/NikitaIvanovV/dmenu-translate
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+RUN_DEPENDS= gsed:textproc/gsed \
+ notify-send:devel/libnotify \
+ trans:textproc/translate-shell \
+ xterm:x11/xterm
+
+USE_GITHUB= yes
+GH_ACCOUNT= NikitaIvanovV
+GH_TAGNAME= 8cc717d3d3bec7f1d7db804e1c339362536b6e45
+
+NO_ARCH= yes
+NO_BUILD= yes
+
+PLIST_FILES= bin/${PORTNAME}
+
+OPTIONS_DEFINE= WAYLAND X11
+OPTIONS_DEFAULT= WAYLAND X11
+WAYLAND_DESC= depend on x11/wmenu and x11/wl-clipboard for use with Wayland
+X11_DESC= depend on x11/dmenu and x11/xclip for use with X11
+
+WAYLAND_RUN_DEPENDS= wl-copy:x11/wl-clipboard \
+ wmenu:x11/wmenu
+X11_RUN_DEPENDS= dmenu:x11/dmenu \
+ xclip:x11/xclip
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} \
+ ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/textproc/dmenu-translate/distinfo b/textproc/dmenu-translate/distinfo
new file mode 100644
index 000000000000..309b3a1fb09e
--- /dev/null
+++ b/textproc/dmenu-translate/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1732713638
+SHA256 (NikitaIvanovV-dmenu-translate-g20230526-8cc717d3d3bec7f1d7db804e1c339362536b6e45_GH0.tar.gz) = 418e75f8913366095f2276ee2579228c60ab5b5c292ecf95c08e7a135b54a29c
+SIZE (NikitaIvanovV-dmenu-translate-g20230526-8cc717d3d3bec7f1d7db804e1c339362536b6e45_GH0.tar.gz) = 965509
diff --git a/textproc/dmenu-translate/files/patch-dmenu-translate b/textproc/dmenu-translate/files/patch-dmenu-translate
new file mode 100644
index 000000000000..c6f7f4151ae3
--- /dev/null
+++ b/textproc/dmenu-translate/files/patch-dmenu-translate
@@ -0,0 +1,45 @@
+--- dmenu-translate.orig 2024-11-26 19:46:24 UTC
++++ dmenu-translate
+@@ -53,7 +53,7 @@ formatmenu() {
+ }
+
+ formatmenu() {
+- echo "$1" | tr '\n' ' ' | sed 's/\s\{3,\}//g; s/^\(.\{30\}\).\+/\1.../; s/$/\n/'
++ echo "$1" | tr '\n' ' ' | gsed 's/\s\{3,\}//g; s/^\(.\{30\}\).\+/\1.../; s/$/\n/'
+ }
+
+ get_selection() {
+@@ -62,12 +62,12 @@ clip_menu() {
+
+ clip_menu() {
+ { formatmenu "$1"; formatmenu "$2"; } |
+- sed 's/^\s*$//; 1s/^./Primary: &/; 2s/^./Clipboard: &/' |
+- sed '/^$/d'
++ gsed 's/^\s*$//; 1s/^./Primary: &/; 2s/^./Clipboard: &/' |
++ gsed '/^$/d'
+ }
+
+ lang_menu() {
+- echo "$TRANS_LANGS" | sed 's/\s\+/\n/g' | sed '/:/!s/^/:/'
++ echo "$TRANS_LANGS" | gsed 's/\s\+/\n/g' | gsed '/:/!s/^/:/'
+ echo '[Define]'
+ }
+
+@@ -86,7 +86,7 @@ save_file() (
+ }
+
+ save_file() (
+- tmp="$(mktemp --tmpdir 'dmenu-translate.XXXXXX')"
++ tmp="$(mktemp --tmpdir -t dmenu-translate)"
+ echo "$1" > "$tmp"
+ echo "$tmp"
+ )
+@@ -98,7 +98,7 @@ get_text() {
+ get_text() {
+ echo "$2" | while IFS= read -r clip; do
+ [ "$1" = "$clip" ] && {
+- type="$(echo "$clip" | sed 's/^\(\w\+\):.*/\1/')"
++ type="$(echo "$clip" | gsed 's/^\(\w\+\):.*/\1/')"
+ case "$type" in
+ Primary) echo "$primary" ;;
+ Clipboard) echo "$clipboard" ;;
diff --git a/textproc/dmenu-translate/pkg-descr b/textproc/dmenu-translate/pkg-descr
new file mode 100644
index 000000000000..ed7fdda01517
--- /dev/null
+++ b/textproc/dmenu-translate/pkg-descr
@@ -0,0 +1,4 @@
+dmenu-translate is a simple and efficient tool that allows users to translate
+text quickly using the dmenu or any other dmenu-like utility. It supports
+multiple languages and translation services, making it easy
+to get instant translations with minimal effort.