Skip to contentSkip to conversation

Support translations in bluez-utils

PATCH In review Michael Terry 2 participants 3 messages May 21, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support translations in bluez-utils

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

/* 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__ */

# 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 =

hcid/dbus-service.c

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
---

Quoted 5 lines

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

Quoted 1 line
    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)
---

Quoted 2 lines

PACKAGE=bluez-utils
AM_INIT_AUTOMAKE($PACKAGE, 3.31)

38a40,45

Quoted 6 lines

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

Quoted 1 line

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

Quoted 1 line

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

Quoted 1 line

#include <glib/gi18n.h>

586c587
< name = "Input service";
---

Quoted 1 line
		name = _("Input service");

588c589
< name = "Audio service";
---

Quoted 1 line
		name = _("Audio service");

590c591
< name = "Network service";
---

Quoted 1 line
		name = _("Network service");

592c593
< name = "Serial service";
---

Quoted 1 line
		name = _("Serial service");

-------------------------------------------------------------------------
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

maintainer
#1 lore raw

Hi Michael,

Quoted 6 lines

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.

actually this is going away in the near future. The logic to provide a service friendly name will be done in bluez-gnome and the bluez-utils will only export a service identifier.

In addition I also think that translation for system level functionality is useless :)

Regards

Marcel

-------------------------------------------------------------------------
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

#2 lore raw
Quoted 3 lines · Marcel Holtmann

actually this is going away in the near future. The logic to provide a service friendly name will be done in bluez-gnome and the bluez-utils will only export a service identifier.

Aha. Good.

Quoted 2 lines

In addition I also think that translation for system level functionality is useless :)

Well, these strings were being presented to the user, so it's just as useful as any other translation, eh? But if the strings are moving to bluez-gnome, that's just as good.

Thanks,
-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