Skip to content

Commit

Permalink
Commit #7: 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 1d3bf00 commit 0f1279c
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 108 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
==========


## 0.2.4 (2021-05-27)

Changes:

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


## 0.2.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
13 changes: 13 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ NEWS
====


## 0.2.4

Changes:

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


## 0.2.0

* The extension now checks for the database of hidden files' read/write access


## 0.1.0

**Nautilus Hide** has been published.
Expand Down
39 changes: 14 additions & 25 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,35 @@ 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 Hide**. This
package comes with only a bunch of strings to translate, whose most important
ones are:
Let's say you want to create a Dutch translation of **Nautilus Hide** (`nl`).
This package comes with only a bunch of strings to translate, whose most
important ones are:

1. “Hide file(s)”
2. “Hide the selected file(s)”
3. “Unhide file(s)”
4. “Unhide the selected file(s)”

Other translatable strings are only debug messages sent to the error stream and
can be left untraslated.
Other translatable strings are only debug messages and can be left untraslated.

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-hide/po
intltool-update -p --gettext-package=nautilus-hide
msginit -l nl
rm nautilus-hide.pot
./bootstrap
make -C po nautilus-hide.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 `po/nl.po` file and translate the 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-hide/po
intltool-update -p --gettext-package=nautilus-hide
mv nl.po nl.po.bak && msgmerge nl.po.bak nautilus-hide.pot > nl.po
rm nautilus-hide.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 Hide],
[0.2.3],
[0.2.4],
[madmurphy333@gmail.com],
[nautilus-hide],
[https://gitlab.gnome.org/madmurphy/nautilus-hide])
Expand All @@ -32,6 +32,8 @@ AM_SILENT_RULES([yes])

AC_PROG_CC

AC_PROG_GREP

PKG_CHECK_MODULES([NAUTILUS_HIDE], [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_HIDE_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-hide",
"version": "0.2.3",
"version": "0.2.4",
"description": "A simple Nautilus extension that adds \"Hide\" and \"Unhide\" to Nautilus right-click menu",
"homepage": "https://gitlab.gnome.org/madmurphy/nautilus-hide",
"author": "madmurphy333@gmail.com",
Expand All @@ -14,8 +14,8 @@
"libnautilus-extension": "*",
},
"devDependencies": {
"pkgconf": "*",
"intltool": "*"
"gettext": "*",
"pkgconf": "*"
},
"src": [
"src/nautilus-hide.c"
Expand Down
Loading

0 comments on commit 0f1279c

Please sign in to comment.