[PATCH] Support translations in bluez-utils

Michael Terry <[email protected]>
Newsgroups gmane.linux.bluez.devel
Message-ID <1211374622.5826.18.camel@bongo>
Hello!

I am attaching a patch and some files that all together allow gettext
translations for bluez-utils.  I'd appreciate a review/commit.

The particular strings motivating this patch were the service names in
hcid/dbus-service.c.  There may be other good candidates for
translation, but I only marked those few strings.

I noted there was an audio/audio.service file which would also be a
candidate for translation, but I didn't see it being used anywhere?  I
can provide a further patch for that if it's used.

Files:
bluez-utils-po.diff
gi18n.h (add as eglib/glib/gi18n.h - this is a simplified copy from
glib; it goes in the redundant glib subdirectory to match glib's include
layout)
Makevars (add as po/Makevars - this is like a config file for gettext)
POTFILES.in (add as po/POTFILES.in - this lists any files to scan for
marked strings)

Also, you'll need to add a blank LINGUAS file in the po directory in
which to add language codes as they come in.

Finally, you should add a blank ChangeLog file in the po directory for
translators (or whoever cvs commits) to note new/updated translations.

Thank you!
-mt

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
gi18n.h (text/x-chdr, 1.2 KB)
/* GLIB - Library of useful routines for C programming
 * Copyright (C) 1995-1997, 2002  Peter Mattis, Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#ifndef __G_I18N_H__
#define __G_I18N_H__

/*#include <glib/gstrfuncs.h>*/
#include <libintl.h>

#define  _(String) gettext (String)
/*#define Q_(String) g_dpgettext (NULL, String, 0)*/
#define N_(String) (String)
/*#define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)*/


#endif  /* __G_I18N_H__ */
Makevars (text/plain, 1.8 KB)
# Makefile variables for PO directory in any package using GNU gettext.

# Usually the message domain is the same as the package name.
DOMAIN = bluez-utils

# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..

# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_

# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
# package.  (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.)  Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright.  The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Marcel Holtmann

# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
#   in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
#   understood.
# - Strings which make invalid assumptions about notation of date, time or
#   money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = [email protected]

# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used.  It is usually empty.
EXTRA_LOCALE_CATEGORIES =
POTFILES.in (text/plain, 21 B)
hcid/dbus-service.c
bluez-utils-po.diff (text/x-patch, 1.8 KB)
Index: Makefile.am
===================================================================
RCS file: /cvsroot/bluez/utils/Makefile.am,v
retrieving revision 1.42
diff -r1.42 Makefile.am
5c5,9
< 		cups test scripts
---
> 		cups test scripts po
> 
> ACLOCAL_AMFLAGS = -I m4
> 
> EXTRA_DIST = config.rpath
Index: bootstrap
===================================================================
RCS file: /cvsroot/bluez/utils/bootstrap,v
retrieving revision 1.7
diff -r1.7 bootstrap
3a4
>     autopoint --force && \
Index: configure.in
===================================================================
RCS file: /cvsroot/bluez/utils/configure.in,v
retrieving revision 1.142
diff -r1.142 configure.in
4c4,5
< AM_INIT_AUTOMAKE(bluez-utils, 3.31)
---
> PACKAGE=bluez-utils
> AM_INIT_AUTOMAKE($PACKAGE, 3.31)
38a40,45
> GETTEXT_PACKAGE=$PACKAGE
> AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define to the Gettext package name])
> AC_SUBST(GETTEXT_PACKAGE)
> AM_GNU_GETTEXT([external])
> AM_GNU_GETTEXT_VERSION([0.17])
> 
62a70
> 	po/Makefile.in
Index: eglib/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/utils/eglib/Makefile.am,v
retrieving revision 1.3
diff -r1.3 Makefile.am
1d0
< 
5a5
> EXTRA_DIST = glib/gi18n.h
Index: hcid/dbus-service.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-service.c,v
retrieving revision 1.156
diff -r1.156 dbus-service.c
44a45
> #include <glib/gi18n.h>
586c587
< 		name = "Input service";
---
> 		name = _("Input service");
588c589
< 		name = "Audio service";
---
> 		name = _("Audio service");
590c591
< 		name = "Network service";
---
> 		name = _("Network service");
592c593
< 		name = "Serial service";
---
> 		name = _("Serial service");
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBINBwe53i2YxNrdi0RAhYUAKCwI+i6cAJHxFyGUkrd+jeMhIkHagCgkJp5
mMB1S7Ne82oVCBd0hsxfixk=
=WAMH
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.