aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/git-permalink.in42
-rw-r--r--src/locale/HELP.en.txt6
-rw-r--r--src/locale/HELP.eo.txt6
-rw-r--r--src/locale/HELP.fr.txt6
-rw-r--r--src/locale/HELP.pt.txt6
-rw-r--r--src/locale/MISSING_FILE.en.txt1
-rw-r--r--src/locale/MISSING_FILE.eo.txt1
-rw-r--r--src/locale/MISSING_FILE.fr.txt1
-rw-r--r--src/locale/MISSING_FILE.pt.txt1
-rw-r--r--src/locale/OPEN.en.txt1
-rw-r--r--src/locale/OPEN.eo.txt1
-rw-r--r--src/locale/OPEN.fr.txt1
-rw-r--r--src/locale/OPEN.pt.txt1
-rw-r--r--src/locale/UNSUPPORTED_ORIGIN.en.txt4
-rw-r--r--src/locale/UNSUPPORTED_ORIGIN.eo.txt4
-rw-r--r--src/locale/UNSUPPORTED_ORIGIN.fr.txt4
-rw-r--r--src/locale/UNSUPPORTED_ORIGIN.pt.txt4
-rw-r--r--src/locale/USAGE.en.txt1
-rw-r--r--src/locale/USAGE.eo.txt1
-rw-r--r--src/locale/USAGE.fr.txt1
-rw-r--r--src/locale/USAGE.pt.txt1
-rw-r--r--src/locale/en.sh36
-rw-r--r--src/locale/eo.sh36
-rw-r--r--src/locale/fr.sh36
-rw-r--r--src/locale/load-messages.sh.in (renamed from src/load-locale-messages.sh.in)6
-rw-r--r--src/locale/pt.sh36
26 files changed, 95 insertions, 149 deletions
diff --git a/src/git-permalink.in b/src/git-permalink.in
index 94697a3..a8e6477 100755
--- a/src/git-permalink.in
+++ b/src/git-permalink.in
@@ -1,10 +1,17 @@
#!/bin/sh
set -eu
+MSGS=''
+add_msg() {
+ MSGS="$MSGS $1"
+}
+
+
MSG_USAGE="$(cat <<-'EOF'
Usage: git permalink [-phV] FILE [LINENO]
EOF
)"
+add_msg USAGE
MSG_HELP="$(cat <<-'EOF'
Options:
@@ -15,11 +22,13 @@ MSG_HELP="$(cat <<-'EOF'
See "man git-permalink" for more information.
EOF
)"
+add_msg HELP
MSG_MISSING_FILE="$(cat <<-'EOF'
Missing FILE argument.
EOF
)"
+add_msg MISSING_FILE
MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
Unsupported origin: %s.
@@ -28,22 +37,49 @@ MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
"man git-permalink" for instructions).
EOF
)"
+add_msg UNSUPPORTED_ORIGIN
MSG_OPEN="$(cat <<-'EOF'
Opening %s
EOF
)"
+add_msg OPEN
#
# End translatable strings
#
-if [ -r '@LIBEXECDIR@/@NAME@/load-locale-messages.sh' ]; then
- . '@LIBEXECDIR@/@NAME@/load-locale-messages.sh'
+
+dump_translatable_strings() {
+ for msg in $MSGS; do
+ eval "echo \"\$MSG_$msg\"" > src/locale/"$msg".en.txt
+ done
+
+ cat <<-'EOF'
+ #!/bin/sh
+ # shellcheck disable=2034
+ set -eu
+
+ EOF
+ for msg in $MSGS; do
+ printf 'MSG_%s="$(cat @LOCALEDIR@/@LANG@/LC_MESSAGES/@NAME@/%s.@LANG@.txt)"\n' \
+ "$msg" "$msg"
+ done
+}
+
+if [ -n "${GIT_PERMALINK_DUMP_TRANSLATABLE_STRINGS:-}" ]; then
+ dump_translatable_strings
+ exit
+fi
+
+
+if [ -r '@LIBEXECDIR@/@NAME@/load-messages.sh' ]; then
+ . '@LIBEXECDIR@/@NAME@/load-messages.sh'
fi
+
#
# Documentation functions
#
@@ -61,6 +97,7 @@ version() {
}
+
#
# Core functions
#
@@ -190,6 +227,7 @@ guess_permalink() {
}
+
#
# Main
#
diff --git a/src/locale/HELP.en.txt b/src/locale/HELP.en.txt
new file mode 100644
index 0000000..bfa3b69
--- /dev/null
+++ b/src/locale/HELP.en.txt
@@ -0,0 +1,6 @@
+Options:
+ -p only print the link, don't try to open it
+ -h, --help show this help message
+ -V, --version print the version number
+
+See "man git-permalink" for more information.
diff --git a/src/locale/HELP.eo.txt b/src/locale/HELP.eo.txt
new file mode 100644
index 0000000..bfa3b69
--- /dev/null
+++ b/src/locale/HELP.eo.txt
@@ -0,0 +1,6 @@
+Options:
+ -p only print the link, don't try to open it
+ -h, --help show this help message
+ -V, --version print the version number
+
+See "man git-permalink" for more information.
diff --git a/src/locale/HELP.fr.txt b/src/locale/HELP.fr.txt
new file mode 100644
index 0000000..bfa3b69
--- /dev/null
+++ b/src/locale/HELP.fr.txt
@@ -0,0 +1,6 @@
+Options:
+ -p only print the link, don't try to open it
+ -h, --help show this help message
+ -V, --version print the version number
+
+See "man git-permalink" for more information.
diff --git a/src/locale/HELP.pt.txt b/src/locale/HELP.pt.txt
new file mode 100644
index 0000000..bfa3b69
--- /dev/null
+++ b/src/locale/HELP.pt.txt
@@ -0,0 +1,6 @@
+Options:
+ -p only print the link, don't try to open it
+ -h, --help show this help message
+ -V, --version print the version number
+
+See "man git-permalink" for more information.
diff --git a/src/locale/MISSING_FILE.en.txt b/src/locale/MISSING_FILE.en.txt
new file mode 100644
index 0000000..0d4ca1c
--- /dev/null
+++ b/src/locale/MISSING_FILE.en.txt
@@ -0,0 +1 @@
+Missing FILE argument.
diff --git a/src/locale/MISSING_FILE.eo.txt b/src/locale/MISSING_FILE.eo.txt
new file mode 100644
index 0000000..0d4ca1c
--- /dev/null
+++ b/src/locale/MISSING_FILE.eo.txt
@@ -0,0 +1 @@
+Missing FILE argument.
diff --git a/src/locale/MISSING_FILE.fr.txt b/src/locale/MISSING_FILE.fr.txt
new file mode 100644
index 0000000..0d4ca1c
--- /dev/null
+++ b/src/locale/MISSING_FILE.fr.txt
@@ -0,0 +1 @@
+Missing FILE argument.
diff --git a/src/locale/MISSING_FILE.pt.txt b/src/locale/MISSING_FILE.pt.txt
new file mode 100644
index 0000000..0d4ca1c
--- /dev/null
+++ b/src/locale/MISSING_FILE.pt.txt
@@ -0,0 +1 @@
+Missing FILE argument.
diff --git a/src/locale/OPEN.en.txt b/src/locale/OPEN.en.txt
new file mode 100644
index 0000000..68ea78b
--- /dev/null
+++ b/src/locale/OPEN.en.txt
@@ -0,0 +1 @@
+Opening %s
diff --git a/src/locale/OPEN.eo.txt b/src/locale/OPEN.eo.txt
new file mode 100644
index 0000000..68ea78b
--- /dev/null
+++ b/src/locale/OPEN.eo.txt
@@ -0,0 +1 @@
+Opening %s
diff --git a/src/locale/OPEN.fr.txt b/src/locale/OPEN.fr.txt
new file mode 100644
index 0000000..68ea78b
--- /dev/null
+++ b/src/locale/OPEN.fr.txt
@@ -0,0 +1 @@
+Opening %s
diff --git a/src/locale/OPEN.pt.txt b/src/locale/OPEN.pt.txt
new file mode 100644
index 0000000..68ea78b
--- /dev/null
+++ b/src/locale/OPEN.pt.txt
@@ -0,0 +1 @@
+Opening %s
diff --git a/src/locale/UNSUPPORTED_ORIGIN.en.txt b/src/locale/UNSUPPORTED_ORIGIN.en.txt
new file mode 100644
index 0000000..4075e2c
--- /dev/null
+++ b/src/locale/UNSUPPORTED_ORIGIN.en.txt
@@ -0,0 +1,4 @@
+Unsupported origin: %s.
+
+Add a template override to use git-permalink (see
+"man git-permalink" for instructions).
diff --git a/src/locale/UNSUPPORTED_ORIGIN.eo.txt b/src/locale/UNSUPPORTED_ORIGIN.eo.txt
new file mode 100644
index 0000000..693d26c
--- /dev/null
+++ b/src/locale/UNSUPPORTED_ORIGIN.eo.txt
@@ -0,0 +1,4 @@
+Unsupported origin: %s.
+
+Add a template override to use git-permalink (see "man git-permalink" for
+instructions).
diff --git a/src/locale/UNSUPPORTED_ORIGIN.fr.txt b/src/locale/UNSUPPORTED_ORIGIN.fr.txt
new file mode 100644
index 0000000..693d26c
--- /dev/null
+++ b/src/locale/UNSUPPORTED_ORIGIN.fr.txt
@@ -0,0 +1,4 @@
+Unsupported origin: %s.
+
+Add a template override to use git-permalink (see "man git-permalink" for
+instructions).
diff --git a/src/locale/UNSUPPORTED_ORIGIN.pt.txt b/src/locale/UNSUPPORTED_ORIGIN.pt.txt
new file mode 100644
index 0000000..693d26c
--- /dev/null
+++ b/src/locale/UNSUPPORTED_ORIGIN.pt.txt
@@ -0,0 +1,4 @@
+Unsupported origin: %s.
+
+Add a template override to use git-permalink (see "man git-permalink" for
+instructions).
diff --git a/src/locale/USAGE.en.txt b/src/locale/USAGE.en.txt
new file mode 100644
index 0000000..ce54a39
--- /dev/null
+++ b/src/locale/USAGE.en.txt
@@ -0,0 +1 @@
+Usage: git permalink [-phV] FILE [LINENO]
diff --git a/src/locale/USAGE.eo.txt b/src/locale/USAGE.eo.txt
new file mode 100644
index 0000000..052a466
--- /dev/null
+++ b/src/locale/USAGE.eo.txt
@@ -0,0 +1 @@
+Usage: git permalink [-phV] FILE [LINENO]
diff --git a/src/locale/USAGE.fr.txt b/src/locale/USAGE.fr.txt
new file mode 100644
index 0000000..052a466
--- /dev/null
+++ b/src/locale/USAGE.fr.txt
@@ -0,0 +1 @@
+Usage: git permalink [-phV] FILE [LINENO]
diff --git a/src/locale/USAGE.pt.txt b/src/locale/USAGE.pt.txt
new file mode 100644
index 0000000..052a466
--- /dev/null
+++ b/src/locale/USAGE.pt.txt
@@ -0,0 +1 @@
+Usage: git permalink [-phV] FILE [LINENO]
diff --git a/src/locale/en.sh b/src/locale/en.sh
deleted file mode 100644
index 64dbe48..0000000
--- a/src/locale/en.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# shellcheck disable=2034
-set -eu
-
-MSG_USAGE="$(cat <<-'EOF'
- Usage: git permalink [-phV] FILE [LINENO]
-EOF
-)"
-
-MSG_HELP="$(cat <<-'EOF'
- Options:
- -p only print the link, don't try to open it
- -h, --help show this help message
- -V, --version print the version number
-
- See "man git-permalink" for more information.
-EOF
-)"
-
-MSG_MISSING_FILE="$(cat <<-'EOF'
- Missing FILE argument.
-EOF
-)"
-
-MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
- Unsupported origin: %s.
-
- Add a template override to use git-permalink (see
- "man git-permalink" for instructions).
-EOF
-)"
-
-MSG_OPEN="$(cat <<-'EOF'
- Opening %s
-EOF
-)"
diff --git a/src/locale/eo.sh b/src/locale/eo.sh
deleted file mode 100644
index e6c7ca1..0000000
--- a/src/locale/eo.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# shellcheck disable=2034
-set -eu
-
-MSG_USAGE="$(cat <<-'EOF'
- Uzmaniero: git permalink [-phV] DOSIERO [LINIONO]
-EOF
-)"
-
-MSG_HELP="$(cat <<-'EOF'
- Ebloj:
- -p nur presas la ligon, ne provas malgermi ĝin
- -h, --help montras ĉi tiun helpmesaĝon
- -V, --version presas la versian numeron
-
- Vidu "man git-permalink" por pliaj informoj.
-EOF
-)"
-
-MSG_MISSING_FILE="$(cat <<-'EOF'
- La argumento DOSIERO mankas.
-EOF
-)"
-
-MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
- Origo ne estas subtenata: %s.
-
- Aldonu anstataŭan ŝablonon por uzi git-permalink (vidu
- "man git-permalink" por instrukcioj).
-EOF
-)"
-
-MSG_OPEN="$(cat <<-'EOF'
- Malfermado de %s
-EOF
-)"
diff --git a/src/locale/fr.sh b/src/locale/fr.sh
deleted file mode 100644
index 11bb792..0000000
--- a/src/locale/fr.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# shellcheck disable=2034
-set -eu
-
-MSG_USAGE="$(cat <<-'EOF'
- Usage: git permalink [-phV] FICHIER [LINENO]
-EOF
-)"
-
-MSG_HELP="$(cat <<-'EOF'
- Options:
- -p seulement imprimez le lien, n'essayez pas de l'ouvrir
- -h, --help afficher ce message d'aide
- -V, --version imprime le numeró de version
-
- Voir "man git-permalink" pour plus d'informations.
-EOF
-)"
-
-MSG_MISSING_FILE="$(cat <<-'EOF'
- L'argument FICHIER manque.
-EOF
-)"
-
-MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
- Origine n'est pas supporté: %s.
-
- Ajouter un modèle de remplacement pour utilisér git-permalink (regarde
- "man git-permalink" pour les instructions).
-EOF
-)"
-
-MSG_OPEN="$(cat <<-'EOF'
- Ouverture de %s
-EOF
-)"
diff --git a/src/load-locale-messages.sh.in b/src/locale/load-messages.sh.in
index e21c784..6a3ffef 100644
--- a/src/load-locale-messages.sh.in
+++ b/src/locale/load-messages.sh.in
@@ -6,14 +6,14 @@ get_lang() {
# optional
locale 2>/dev/null |
grep ^LC_MESSAGES |
- cut -d. -f1 |
- cut -d\" -f2 |
+ cut -d. -f1 |
+ cut -d\" -f2 |
cut -d= -f2
}
locpath() {
lang="$1"
- printf '@LOCALEDIR@/%s/LC_MESSAGES/@NAME@.sh' "$lang"
+ printf '@LOCALEDIR@/%s/LC_MESSAGES/@NAME@/%s.sh' "$lang" "$lang"
}
ll_CC="$(get_lang)"
diff --git a/src/locale/pt.sh b/src/locale/pt.sh
deleted file mode 100644
index df89a55..0000000
--- a/src/locale/pt.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# shellcheck disable=2034
-set -eu
-
-MSG_USAGE="$(cat <<-'EOF'
- Uso: git permalink [-phV] ARQUIVO [NOLINHA]
-EOF
-)"
-
-MSG_HELP="$(cat <<-'EOF'
- Opções:
- -p somente imprime o link, não tenta abrí-lo
- -h, --help mostra esta mensagem de ajuda
- -V, --version imprime o número da versão
-
- Veja "man git-permalink" para mais informações.
-EOF
-)"
-
-MSG_MISSING_FILE="$(cat <<-'EOF'
- Faltando argumento ARQUIVO.
-EOF
-)"
-
-MSG_UNSUPPORTED_ORIGIN="$(cat <<-'EOF'
- Origem sem suporte: %s.
-
- Adiciona um modelo de substituição para usar no git-permalink (veja
- "man git-permalink." para mais instruções).
-EOF
-)"
-
-MSG_OPEN="$(cat <<-'EOF'
- Abrindo %s
-EOF
-)"