summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rw-r--r--.local/bin/Makefile30
-rw-r--r--.local/bin/po/sv/vlt.po164
-rw-r--r--.local/bin/po/vlt.pot162
-rwxr-xr-x.local/bin/vlt78
4 files changed, 402 insertions, 32 deletions
diff --git a/.local/bin/Makefile b/.local/bin/Makefile
new file mode 100644
index 0000000..2f659f9
--- /dev/null
+++ b/.local/bin/Makefile
@@ -0,0 +1,30 @@
+TEXTDOMAINDIR=/usr/local/share/locale
+
+all:
+
+extract:
+ mkdir -p po/sv
+ for x in vlt; \
+ do \
+ xgettext -L Shell -k_ --from-code=UTF-8 -o "po/$$x.pot" "$$x"; \
+ for l in sv_SE; \
+ do \
+ d="$${l%_*}"; \
+ if [ -e "po/$$d/$$x.po" ]; \
+ then \
+ msgmerge -U "po/$$d/$$x.po" "po/$$x.pot"; \
+ else \
+ msginit -l "$$l.UTF-8" -i "po/$$x.pot" -o "po/$$d/$$x.po"; \
+ fi; \
+ done; \
+ done
+
+compile:
+ mkdir -p "$(TEXTDOMAINDIR)/sv/LC_MESSAGES"
+ for l in sv; \
+ do \
+ for x in vlt; \
+ do \
+ msgfmt "po/$$l/$$x.po" -o "$(TEXTDOMAINDIR)/$$l/LC_MESSAGES/$$x.mo"; \
+ done; \
+ done
diff --git a/.local/bin/po/sv/vlt.po b/.local/bin/po/sv/vlt.po
new file mode 100644
index 0000000..9a426ca
--- /dev/null
+++ b/.local/bin/po/sv/vlt.po
@@ -0,0 +1,164 @@
+# Swedish translations for PACKAGE package
+# Svenska översättningar för paket PACKAGE.
+# Copyright (C) 2025 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Thomas Voss <mail@thomasvoss.com>, 2025.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2025-09-01 22:42+0200\n"
+"PO-Revision-Date: 2025-09-01 22:45+0200\n"
+"Last-Translator: Thomas Voss <mail@thomasvoss.com>\n"
+"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: vlt:25
+#, fuzzy
+msgid "Invalid input"
+msgstr "Ogiltig inmatning"
+
+#: vlt:26
+msgid "Empty strings do not constitute valid input"
+msgstr "Tomma strängar utgör ej giltig indata"
+
+#: vlt:98
+msgid "Password name"
+msgstr "Lösenordsnamn"
+
+#: vlt:103
+msgid "Failed to add password"
+msgstr "Misslyckades med att skapa lösenord"
+
+#: vlt:104
+#, sh-printf-format
+msgid "The password ‘%s’ already exists"
+msgstr "Lösenordet ”%s” finns redan"
+
+#: vlt:110 vlt:260
+msgid "Secret key"
+msgstr "Hemlig nyckel"
+
+#: vlt:111 vlt:261
+msgid "Digits"
+msgstr "Siffror"
+
+#: vlt:112 vlt:262
+msgid "Period"
+msgstr "Period"
+
+#: vlt:126 vlt:276
+msgid "2FA key added"
+msgstr "2FA-nyckel tillagd"
+
+#: vlt:127 vlt:277
+#, sh-printf-format
+msgid "The 2FA key ‘%s’ was added with the digit length ‘%d’ and period ‘%d’"
+msgstr "2FA-nyckeln ”%s” lades till med siffralägden ”%d” och perioden ”%d”"
+
+#: vlt:129 vlt:279
+msgid "Password"
+msgstr "Lösenord"
+
+#: vlt:134
+msgid "Password added"
+msgstr "Lösenord tillagt"
+
+#: vlt:135
+#, sh-printf-format
+msgid "The password ‘%s’ was added to the category ‘%s’"
+msgstr "Lösenordet ”%s” tillagt till kategorin ”%s”"
+
+#: vlt:143
+msgid "Category to create"
+msgstr "Kategori att skapa"
+
+#: vlt:146
+msgid "Failed to Create Category"
+msgstr "Misslyckades med att skapa kategori"
+
+#: vlt:146
+#, sh-printf-format
+msgid "The category ‘%s’ already exists"
+msgstr "Kategorin ”%s” finns redan"
+
+#: vlt:154
+msgid "Category created"
+msgstr "Kategori skapad"
+
+#: vlt:154
+#, sh-printf-format
+msgid "The password category ‘%s’ was created"
+msgstr "Lösenordskategorin ”%s” skapades"
+
+#: vlt:178
+msgid "2FA code copied to the clipboard"
+msgstr "2FA-kod kopierad till urklipp"
+
+#: vlt:179
+#, sh-printf-format
+msgid "The 2FA code for ‘%s’ was copied to the clipboard"
+msgstr "2FA-koden för ”%s” har kopierats till urklipp"
+
+#: vlt:184
+msgid "Password copied to the clipboard"
+msgstr "Lösenord kopierat till urklipp"
+
+#: vlt:185
+#, sh-printf-format
+msgid "The password for ‘%s’ was copied to the clipboard"
+msgstr "Lösenordet ”%s” har kopierats till urklipp"
+
+#: vlt:214
+msgid "Password removed"
+msgstr "Lösenord borttaget"
+
+#: vlt:215
+#, sh-printf-format
+msgid "The password ‘%s’ was removed from the category ‘%s’"
+msgstr "Lösenordet ”%s” har tagits bort från kategorin ”%s”"
+
+#: vlt:226
+msgid "Failed to remove category"
+msgstr "Kategorin kunde ej tas bort"
+
+#: vlt:226
+#, sh-printf-format
+msgid "The category ‘%s’ is not empty"
+msgstr "Kategorin ”%s” är ej tom"
+
+#: vlt:233
+msgid "Category removed"
+msgstr "Kategori borttagen"
+
+#: vlt:233
+#, sh-printf-format
+msgid "The category ‘%s’ was removed"
+msgstr "Kategorin ”%s” har tagits bort"
+
+#: vlt:283
+msgid "Password edited"
+msgstr "Lösenord redigerat"
+
+#: vlt:284
+#, sh-printf-format
+msgid "The password ‘%s’ in the category ‘%s’ was edited"
+msgstr "Lösenordet ”%s” i kategorin ”%s” har redigerats"
+
+#: vlt:293
+msgid "Category name"
+msgstr "Kategorinamn"
+
+#: vlt:298
+msgid "Category edited"
+msgstr "Kategori redigerad"
+
+#: vlt:298
+#, sh-printf-format
+msgid "The category ‘%s’ was renamed"
+msgstr "Kategorin ”%s” har bytt namn"
diff --git a/.local/bin/po/vlt.pot b/.local/bin/po/vlt.pot
new file mode 100644
index 0000000..58eede0
--- /dev/null
+++ b/.local/bin/po/vlt.pot
@@ -0,0 +1,162 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2025-09-01 22:42+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: vlt:25
+msgid "Invalid input"
+msgstr ""
+
+#: vlt:26
+msgid "Empty strings do not constitute valid input"
+msgstr ""
+
+#: vlt:98
+msgid "Password name"
+msgstr ""
+
+#: vlt:103
+msgid "Failed to add password"
+msgstr ""
+
+#: vlt:104
+#, sh-printf-format
+msgid "The password ‘%s’ already exists"
+msgstr ""
+
+#: vlt:110 vlt:260
+msgid "Secret key"
+msgstr ""
+
+#: vlt:111 vlt:261
+msgid "Digits"
+msgstr ""
+
+#: vlt:112 vlt:262
+msgid "Period"
+msgstr ""
+
+#: vlt:126 vlt:276
+msgid "2FA key added"
+msgstr ""
+
+#: vlt:127 vlt:277
+#, sh-printf-format
+msgid "The 2FA key ‘%s’ was added with the digit length ‘%d’ and period ‘%d’"
+msgstr ""
+
+#: vlt:129 vlt:279
+msgid "Password"
+msgstr ""
+
+#: vlt:134
+msgid "Password added"
+msgstr ""
+
+#: vlt:135
+#, sh-printf-format
+msgid "The password ‘%s’ was added to the category ‘%s’"
+msgstr ""
+
+#: vlt:143
+msgid "Category to create"
+msgstr ""
+
+#: vlt:146
+msgid "Failed to Create Category"
+msgstr ""
+
+#: vlt:146
+#, sh-printf-format
+msgid "The category ‘%s’ already exists"
+msgstr ""
+
+#: vlt:154
+msgid "Category created"
+msgstr ""
+
+#: vlt:154
+#, sh-printf-format
+msgid "The password category ‘%s’ was created"
+msgstr ""
+
+#: vlt:178
+msgid "2FA code copied to the clipboard"
+msgstr ""
+
+#: vlt:179
+#, sh-printf-format
+msgid "The 2FA code for ‘%s’ was copied to the clipboard"
+msgstr ""
+
+#: vlt:184
+msgid "Password copied to the clipboard"
+msgstr ""
+
+#: vlt:185
+#, sh-printf-format
+msgid "The password for ‘%s’ was copied to the clipboard"
+msgstr ""
+
+#: vlt:214
+msgid "Password removed"
+msgstr ""
+
+#: vlt:215
+#, sh-printf-format
+msgid "The password ‘%s’ was removed from the category ‘%s’"
+msgstr ""
+
+#: vlt:226
+msgid "Failed to remove category"
+msgstr ""
+
+#: vlt:226
+#, sh-printf-format
+msgid "The category ‘%s’ is not empty"
+msgstr ""
+
+#: vlt:233
+msgid "Category removed"
+msgstr ""
+
+#: vlt:233
+#, sh-printf-format
+msgid "The category ‘%s’ was removed"
+msgstr ""
+
+#: vlt:283
+msgid "Password edited"
+msgstr ""
+
+#: vlt:284
+#, sh-printf-format
+msgid "The password ‘%s’ in the category ‘%s’ was edited"
+msgstr ""
+
+#: vlt:293
+msgid "Category name"
+msgstr ""
+
+#: vlt:298
+msgid "Category edited"
+msgstr ""
+
+#: vlt:298
+#, sh-printf-format
+msgid "The category ‘%s’ was renamed"
+msgstr ""
diff --git a/.local/bin/vlt b/.local/bin/vlt
index 20219d8..6583689 100755
--- a/.local/bin/vlt
+++ b/.local/bin/vlt
@@ -5,19 +5,32 @@ set -e
export NOTIFY_LONG=vault
export NOTIFY_SHORT="${0##*/}"
+export TEXTDOMAIN=vlt
+export TEXTDOMAINDIR=/usr/local/share/locale
+
+. gettext.sh
+_()
+{
+ fmt="$1"
+ shift
+ printf "$(eval_gettext "$fmt")" "$@"
+}
+
sanitize()
{
s="${1#"${1%%[![:space:]]*}"}"
s="${s%"${s##*[![:space:]]}"}"
if [ "${#s}" -eq 0 ]
then
- notify 'Invalid Input' 'Empty strings do not constitute valid input'
+ notify "$(_ 'Invalid input')" \
+ "$(_ 'Empty strings do not constitute valid input')"
exit 1
fi
}
usage()
{
+ # TODO: Translate into Swedish
cat <<-EOF >&2
Usage: ${0##*/} add [-c]
${0##*/} edit [-c]
@@ -82,20 +95,21 @@ add()
c="$(xecho "$data" | jq -r 'keys | .[]' | osel)"
- prompt 'Password name'
+ prompt "$(_ 'Password name')"
n="$s"
xecho "$data" \
| jq -e --arg c "$c" --arg n "$n" '.[$c] | has($n) | not' >/dev/null || {
- notify 'Failed To Add Password' "The password ‘$n’ already exists"
+ notify "$(_ 'Failed to add password')" \
+ "$(_ "The password ‘%s’ already exists" "$n")"
exit 1
}
if [ "$VAULT_2FA" = "$c" ]
then
- xprompt 'Secret key'; k="$s"
- prompt 'Digits'; d="$s"
- prompt 'Period'
+ xprompt "$(_ 'Secret key')"; k="$s"
+ prompt "$(_ 'Digits')"; d="$s"
+ prompt "$(_ 'Period')"
xecho "$data" \
| jq --arg c "$c" \
@@ -109,16 +123,16 @@ add()
"period": ($p | tonumber)
}}' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify '2FA Key Added' \
- "The 2FA key ‘$n’ was added with the digit length ‘$d’ and period ‘$p’"
+ [ ! -t 2 ] && notify "$(_ '2FA key added')" \
+ "$(_ "The 2FA key ‘%s’ was added with the digit length ‘%d’ and period ‘%d’" "$n" "$d" "$p")"
else
- xprompt 'Password'
+ xprompt "$(_ 'Password')"
xecho "$data" \
| jq --arg c "$c" --arg n "$n" --arg s "$s" '.[$c] += {($n): $s}' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify 'Password Added' \
- "The password ‘$n’ was added to the category ‘$c’"
+ [ ! -t 2 ] && notify "$(_ 'Password added')" \
+ "$(_ "The password ‘%s’ was added to the category ‘%s’" "$n" "$c")"
fi
}
@@ -126,10 +140,10 @@ add_c()
{
readonly data="$(enchive extract <"$VAULT")"
- prompt 'Category to create'
+ prompt "$(_ 'Category to create')"
xecho "$data" | jq -e --arg s "$s" 'has($s) | not' >/dev/null || {
- notify 'Failed To Create Category' "The category ‘$s’ already exists"
+ notify "$(_ 'Failed to Create Category')" "$(_ "The category ‘%s’ already exists" "$s")"
exit 1
}
@@ -137,7 +151,7 @@ add_c()
| jq --arg s "$s" '. + {($s): {}}' \
| enchive archive >"$VAULT"
[ ! -t 2 ] && \
- notify 'Category Created' "The password category ‘$s’ was created"
+ notify "$(_ 'Category created')" "$(_ "The password category ‘%s’ was created" "$s")"
}
get()
@@ -161,14 +175,14 @@ get()
')" \
| wl-copy -no \
&& [ ! -t 2 ] \
- && notify '2FA Code Copied To The Clipboard' \
- "The 2FA code for ‘$o’ was copied to the clipboard"
+ && notify "$(_ '2FA code copied to the clipboard')" \
+ "$(_ "The 2FA code for ‘%s’ was copied to the clipboard" "$o")"
else
jq -r --arg c "$c" --arg o "$o" '.[$c] | .[$o]' \
| wl-copy -no \
&& [ ! -t 2 ] \
- && notify 'Password Copied To The Clipboard' \
- "The password for ‘$o’ was copied to the clipboard"
+ && notify "$(_ 'Password copied to the clipboard')" \
+ "$(_ "The password for ‘%s’ was copied to the clipboard" "$o")"
fi
}
@@ -197,8 +211,8 @@ rm_()
xecho "$data" \
| jq --arg c "$c" --arg n "$n" 'del(.[$c] | .[$n])' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify 'Removed Password' \
- "The password ‘$n’ was removed from the category ‘$c’"
+ [ ! -t 2 ] && notify "$(_ 'Password removed')" \
+ "$(_ "The password ‘%s’ was removed from the category ‘%s’" "$n" "$c")"
}
rm_c()
@@ -209,14 +223,14 @@ rm_c()
xecho "$data" \
| jq -e --arg c "$c" '.[$c] | length == 0' >/dev/null || {
- notify 'Failed To Remove Category' "The category ‘$c’ is not empty"
+ notify "$(_ 'Failed to remove category')" "$(_ "The category ‘%s’ is not empty" "$c")"
exit 1
}
xecho "$data" \
| jq --arg c "$c" 'del(.[$c])' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify 'Removed Category' "The category ‘$c’ was removed"
+ [ ! -t 2 ] && notify "$(_ 'Category removed')" "$(_ "The category ‘%s’ was removed" "$c")"
}
edit()
@@ -243,9 +257,9 @@ edit()
if [ "$VAULT_2FA" = "$c" ]
then
- xprompt 'Secret key'; k="$s"
- prompt 'Digits'; d="$s"
- prompt 'Period'
+ xprompt "$(_ 'Secret key')"; k="$s"
+ prompt "$(_ 'Digits')"; d="$s"
+ prompt "$(_ 'Period')"
xecho "$data" \
| jq --arg c "$c" \
@@ -259,15 +273,15 @@ edit()
"period": ($p | tonumber)
}}' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify '2FA Key Added' \
- "The 2FA key ‘$n’ was added with the digit length ‘$d’ and period ‘$p’"
+ [ ! -t 2 ] && notify "$(_ '2FA key added')" \
+ "$(_ "The 2FA key ‘%s’ was added with the digit length ‘%d’ and period ‘%d’" "$n" "$d" "$p")"
else
- xprompt 'Password'
+ xprompt "$(_ 'Password')"
xecho "$data" \
| jq --arg c "$c" --arg n "$n" --arg s "$s" '.[$c] += {($n): $s}' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify 'Password Edit' \
- "The password ‘$n’ in the category ‘$c’ was changed"
+ [ ! -t 2 ] && notify "$(_ 'Password edited')" \
+ "$(_ "The password ‘%s’ in the category ‘%s’ was edited" "$n" "$c")"
fi
}
@@ -276,12 +290,12 @@ edit_c()
readonly data="$(enchive extract <"$VAULT")"
c="$(xecho "$data" | jq -r 'keys | .[]' | osel)"
- prompt 'Category name'
+ prompt "$(_ 'Category name')"
xecho "$data" \
| jq --arg o "$c" --arg n "$s" \
'with_entries(if .key == $o then .key = $n else . end)' \
| enchive archive >"$VAULT"
- [ ! -t 2 ] && notify 'Category Edit' "The category ‘$c’ was renamed"
+ [ ! -t 2 ] && notify "$(_ 'Category edited')" "$(_ "The category ‘%s’ was renamed" "$c")"
}
raw()