Skip to content

Commit

Permalink
Commit #8: internationalization does not depend on intltool anymore, …
Browse files Browse the repository at this point in the history
…but only on GNU gettext
  • Loading branch information
madmurphy committed May 27, 2021
1 parent 0d22591 commit b3ecc35
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 109 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ Change Log
==========


## 1.0.4 (2021-05-27)

Changes:

* Internationalization does not depend on **XDG intltool** anymore, but only on
**GNU gettext**


## 1.0.3 (2021-05-24)

Changes:
Expand Down
42 changes: 15 additions & 27 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

ACLOCAL_AMFLAGS = -I m4

AM_DISTCHECK_CONFIGURE_FLAGS = --without-nautilus-libdir

SUBDIRS = \
src

Expand All @@ -13,31 +15,14 @@ dist_doc_DATA = \
NEWS \
README

INTLTOOL_FILES = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in

EXTRA_DIST = \
ChangeLog.md \
INSTALL \
NEWS \
README.md \
bootstrap \
package.json \
.editorconfig \
$(INTLTOOL_FILES)

DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
po/.intltool-merge-cache


# Shell expansion is supported here
_distclean_dirs_ = \
'po/backups'
.editorconfig


if NLS_ENABLED
Expand All @@ -53,9 +38,14 @@ EXTRA_DIST += \
endif !NLS_ENABLED


# Remove doc directory on uninstall
# Shell expansion is supported here
_distclean_dirs_ = \
'po/backups'


# Remove `$(docdir)` directory on uninstall
uninstall-local:
-rm -r '$(DESTDIR)$(docdir)'
-rm -r '$(DESTDIR)$(docdir)';


distclean-local:
Expand All @@ -65,13 +55,11 @@ distclean-local:
# Update translations
.PHONY: i18n-update
i18n-update:
(cd 'po' && intltool-update -p --gettext-package='$(PACKAGE_TARNAME)' \
&& mkdir -p 'backups' && grep -o '^\s*\w\S\+' 'LINGUAS' | while read \
coin; do mv "$${coin}.po" "$${coin}.po.bak" && msgmerge \
"$${coin}.po.bak" '$(PACKAGE_TARNAME).pot' > "$${coin}.po" && mv \
"$${coin}.po.bak" 'backups' && sed -i \
's/"Project-Id-Version:\s*\([0-9]\+\(\.[0-9]\+\(\.[0-9]\)\?\)\?\)\?\+\\n"/"Project-Id-Version: @PACKAGE_VERSION@\\n"/' \
"$${coin}.po"; done; rm '$(PACKAGE_TARNAME).pot')
$(MKDIR_P) 'po/backups' && $(GREP) -o '^\s*\w\S\+' 'po/LINGUAS' | \
while read _i_; do cp "po/$${_i_}.po" "po/backups/$${_i_}.po.bak" && \
$(MAKE) -C 'po' "$${_i_}.po" && sed -i \
's/"Project-Id-Version:.*$$/"Project-Id-Version: @PACKAGE_VERSION@\\n"/' \
"po/$${_i_}.po"; done;


# EOF
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ NEWS
====


## 1.0.4

* Internationalization does not depend on **XDG intltool** anymore, but only on
**GNU gettext**


## 1.0.1

Changes:
Expand Down
34 changes: 12 additions & 22 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Get involved
The package needs help with internationalization. If a translation into your
language is missing and you wish to get involved, here is what to do.

Let's say you want to create a Dutch translation of **Nautilus Launch**. This
package comes with only eight strings to translate:
Let's say you want to create a Dutch translation of **Nautilus Launch** (`nl`).
This package comes with only eight strings to translate:

1. “Error retrieving file's path”
2. “Launcher has become invalid”
Expand All @@ -31,34 +31,24 @@ package comes with only eight strings to translate:
7. “Launch”
8. “Launch the selected application”

First thing to do is to make sure that `gettext` and `intltool` are installed
on your system. Then clone this repository and launch the following four
commands:
First thing to do is to make sure that **GNU Autotools** and **GNU gettext**
are installed on your system. Then clone this repository and launch the
following commands:

``` sh
cd nautilus-launch/po
intltool-update -p --gettext-package=nautilus-launch
msginit -l nl
rm nautilus-launch.pot
./bootstrap
make -C po nautilus-launch.pot
(cd po && msginit -l nl)
./bootstrap --clean
```

Now edit the `po/LINGUAS` file and add a new line containing the abbreviated
name of the new language (`nl`).

Finally, open the file `po/nl.po` and translate the eight strings above. All
you have to do now is to commit your changes.
Finally, open the file `po/nl.po` and translate the two strings above. All you
have to do now is to commit your changes.

If you want to update an existing Dutch translation to the most recent changes
in the extension source code, launch

``` sh
cd nautilus-launch/po
intltool-update -p --gettext-package=nautilus-launch
mv nl.po nl.po.bak && msgmerge nl.po.bak nautilus-launch.pot > nl.po
rm nautilus-launch.pot nl.po.bak
```

For any issue, [drop me a message][1].
For any issue, [drop a message][1].


NExtGen
Expand Down
41 changes: 32 additions & 9 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#!/bin/bash
# Run this to generate all the initial makefiles, etc.

Expand Down Expand Up @@ -41,7 +42,13 @@ if test "${CLEANONLY}" -ne 0; then
echo 'Cleaning package...'
test -f 'Makefile' && make maintainer-clean
rm -Rf autom4te.cache m4 build-aux no-dist `find . -type d -name .deps`
rm -f aclocal.m4 compile config.* configure configure~ depcomp install-sh libtool ltmain.sh missing intltool-* `find . -name Makefile.in`
rm -f *'~' 'ABOUT-NLS' 'aclocal.m4' 'compile' 'config'.* 'configure' \
'depcomp' 'install-sh' 'intltool-*' 'libtool' 'ltmain.sh' \
'missing' `find . -name Makefile.in` 'po/boldquot.sed' \
'po/en@boldquot.header' 'po/en@quot.header' \
'po/insert-header.sin' 'po/'*'~' 'po/Makefile.in.in' \
'po/Makevars.template' 'po/quot.sed' 'po/remove-potcdate.sin' \
'po/Rules-quot'
echo 'Done'
exit 0
fi
Expand All @@ -64,7 +71,8 @@ test -f "${srcdir}/configure.ac" || {
autoconf --version < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `autoconf` installed. Download the appropriate package'
echo 'for your distribution, or get the source tarball at ftp://ftp.gnu.org/pub/gnu/'
echo 'for your distribution, or get the source tarball at'
echo 'https://www.gnu.org/software/autoconf/'
echo
DIE=1
} >&2
Expand All @@ -73,7 +81,7 @@ if grep "^IT_PROG_INTLTOOL" "${srcdir}/configure.ac" >/dev/null; then
intltoolize --version < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `intltool` installed. You can get it from'
echo 'ftp://ftp.gnome.org/pub/GNOME/'
echo 'https://freedesktop.org/wiki/Software/intltool/'
echo
DIE=1
} >&2
Expand All @@ -82,8 +90,8 @@ fi
if grep "^AM_PROG_XML_I18N_TOOLS" "${srcdir}/configure.ac" >/dev/null; then
xml-i18n-toolize --version < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `xml-i18n-toolize` installed. You can get it from'
echo 'ftp://ftp.gnome.org/pub/GNOME/'
echo '**Error**: You must have `xml-i18n-tools` installed. You can get it from'
echo 'https://download.gnome.org/sources/xml-i18n-tools/'
echo
DIE=1
} >&2
Expand All @@ -110,7 +118,18 @@ if grep "^LT_INIT" "${srcdir}/configure.ac" >/dev/null; then
("${LIBTOOL}" --version) < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `libtool` installed. You can get it from'
echo 'ftp://ftp.gnu.org/pub/gnu/'
echo 'https://www.gnu.org/software/libtool/'
echo
DIE=1
} >&2
fi

if grep "^AM_GNU_GETTEXT" "${srcdir}/configure.ac" >/dev/null; then
grep "sed.*POTFILES" "${srcdir}/configure.ac" > /dev/null || \
gettextize --version < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `gettext` installed. You can get it from'
echo 'https://www.gnu.org/software/gettext/'
echo
DIE=1
} >&2
Expand All @@ -121,7 +140,7 @@ if grep "^AM_GLIB_GNU_GETTEXT" "${srcdir}/configure.ac" >/dev/null; then
glib-gettextize --version < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `glib` installed. You can get it from'
echo 'ftp://ftp.gtk.org/pub/gtk'
echo 'https://download.gnome.org/sources/glib/'
echo
DIE=1
} >&2
Expand All @@ -130,7 +149,7 @@ fi
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: You must have `automake` installed. You can get it from'
echo 'ftp://ftp.gnu.org/pub/gnu/'
echo 'https://www.gnu.org/software/automake/'
echo
DIE=1
NO_AUTOMAKE=yes
Expand All @@ -141,7 +160,7 @@ fi
test -n "${NO_AUTOMAKE}" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo '**Error**: Missing `aclocal`. The version of `automake` installed doesn'\''t appear'
echo 'recent enough. You can get automake from ftp://ftp.gnu.org/pub/gnu/'
echo 'recent enough. You can get automake from https://www.gnu.org/software/automake/'
echo
DIE=1
} >&2
Expand Down Expand Up @@ -193,6 +212,10 @@ for coin in `find "${srcdir}" -path "${srcdir}/CVS" -prune -o -name configure.ac
aclocalinclude="${ACLOCAL_FLAGS}"
[[ -d 'm4' ]] || mkdir 'm4'

if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
echo 'Running autopoint...'
autopoint --force
fi
if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
echo "Creating ${dr}/aclocal.m4..."
test -r "${dr}/aclocal.m4" || touch "${dr}/aclocal.m4"
Expand Down
44 changes: 29 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
dnl Process this file with autoconf to produce a configure script.


dnl ***************************************************************************
dnl **************************************************************************
dnl A U T O C O N F E N V I R O N M E N T
dnl ***************************************************************************
dnl **************************************************************************


AC_PREREQ([2.69])

AC_INIT([Nautilus Launch],
[1.0.3],
[1.0.4],
[madmurphy333@gmail.com],
[nautilus-launch],
[https://gitlab.gnome.org/madmurphy/nautilus-launch])
Expand All @@ -32,6 +32,8 @@ AM_SILENT_RULES([yes])

AC_PROG_CC

AC_PROG_GREP

PKG_CHECK_MODULES([NAUTILUS_LAUNCH], [glib-2.0 libnautilus-extension])

AC_CHECK_PROG([HAVE_PKGCONFIG], [pkg-config], [yes], [no])
Expand All @@ -40,33 +42,45 @@ AS_IF([test "x${HAVE_PKGCONFIG}" = xno],
[AC_MSG_ERROR([you need to have pkgconfig installed!])])


dnl ***************************************************************************
dnl **************************************************************************
dnl I N T E R N A T I O N A L I Z A T I O N
dnl ***************************************************************************
dnl **************************************************************************

AM_GNU_GETTEXT([external])

IT_PROG_INTLTOOL([0.35.0])
AM_GNU_GETTEXT_VERSION([0.21])

AM_CONDITIONAL([NLS_ENABLED], [test "x${USE_NLS}" != xno])

AM_COND_IF([NLS_ENABLED], [
AC_SUBST([GETTEXT_PACKAGE], AC_PACKAGE_TARNAME)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
["${GETTEXT_PACKAGE}"], [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
AM_GLIB_DEFINE_LOCALEDIR([NAUTILUS_LAUNCH_LOCALEDIR])
])


dnl ***************************************************************************
dnl **************************************************************************
dnl F I N A L I Z A T I O N
dnl ***************************************************************************

dnl **************************************************************************

AC_ARG_WITH([nautilus-libdir],
[AS_HELP_STRING([--without-nautilus-libdir],
[ignore the <libdir> variable used by libnautilus-extension and
and use the current <libdir> instead @<:@default=no@:>@])],
[:],
[AS_VAR_SET([with_nautilus_libdir], ['yes'])])

AS_IF([test "x${with_nautilus_libdir}" = xno],
[AS_VAR_SET([NAUTILUS_EXTENSION_DIR], m4_normalize(["$(
"${PKG_CONFIG}" --define-variable='libdir=${libdir}'
--variable=extensiondir libnautilus-extension
)"]))],
[AS_VAR_SET([NAUTILUS_EXTENSION_DIR], m4_normalize(["$(
"${PKG_CONFIG}" --variable=extensiondir libnautilus-extension
)"]))])

AC_SUBST([NAUTILUS_EXTENSION_DIR])

AC_SUBST([NAUTILUS_EXTENSION_DIR], m4_normalize(["$(
"${PKG_CONFIG}" --define-variable='libdir=${libdir}'
--variable=extensiondir libnautilus-extension
)"]))

LT_INIT([disable-static])

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nautilus Launch",
"version": "1.0.3",
"version": "1.0.4",
"description": "A simple Nautilus extension that allows to run executables and launchers via right-click menu",
"homepage": "https://gitlab.gnome.org/madmurphy/nautilus-launch",
"author": "madmurphy",
Expand All @@ -14,8 +14,8 @@
"libnautilus-extension": "*",
},
"devDependencies": {
"pkgconf": "*",
"intltool": "*"
"gettext": "*",
"pkgconf": "*"
},
"src": [
"src/nautilus-launch.c"
Expand Down
Loading

0 comments on commit b3ecc35

Please sign in to comment.