annotate doc/plugin-i18n.dox @ 23787:92e71f6e10d4

Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp. It's now possible to initiate an audio session, sometimes. It's somewhat buggy. Some other issues also need to be resolved: * Properly get rid of the compile warnings * Rename the serv_ functions with proper namespacing. * Possibly rename the purple_media_ functions that don't deal with a PurpleMedia (e.g. purple_media_audio_init_src) to something different, e.g. purple_media_util_, or even purple_gst_util etc.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 22 Mar 2008 04:45:46 +0000
parents 901cbc91db27
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /** @page plugin-i18n Third Party Plugin Translation Support
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 @section Introduction
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
4 For the purpose of this document we're going to assume that your plugin:
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
5
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
6 - Is set up to use autotools. It may be possible to add translation support
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
7 without autotools, but we have no idea how. We may not want to know, either ;)
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
8 - Has an autogen.sh. You may have also called this bootstrap.sh or similar.
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
9 - Resides in a source tree that has @c configure.ac and @c Makefile.am in the
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
10 top-level directory as well as a @c src directory in which the plugin's source
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
11 is located. A @c Makefile.am should also exist in the @c src directory.
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
12
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 For a plugin to have translation support there are a few steps that need to
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 followed:
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
16 - In your autogen.sh, add the following after your other utility checks:
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 echo;
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 echo "You must have intltool installed to compile <YOUR PLUGIN NAME>";
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 echo;
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 exit;
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 }
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 @endcode
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
25 Then before your call to aclocal add:
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 intltoolize --force --copy
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 @endcode
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
29 - Now edit configure.ac and add the following:
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 AC_PROG_INTLTOOL
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 GETTEXT_PACKAGE=<YOUR PLUGIN NAME>
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 AC_SUBST(GETTEXT_PACKAGE)
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 ALL_LINGUAS=""
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 AM_GLIB_GNU_GETTEXT
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 @endcode
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 The position of these macros in the file don't really matter, but if you
16196
1414e0e01dc5 More renaming.
Richard Laager <rlaager@wiktel.com>
parents: 13402
diff changeset
41 have issues either play around with it or feel free to ask one of the Pidgin
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 developers. Finally add 'po/Makefile.in' to you 'AC_OUTPUT' command.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 - Now create a directory named 'po'.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 - 'cd' into the 'po' directory.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 - Create/edit the file 'POTFILE.in' in your favorite editor. Each line
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 should be the name of a file that could or does have strings marked for
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 translating (we're getting to that step). These file names should be
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
48 relative to the top directory of your plugin's source tree.
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
49 - 'cd' back to the top directory of your plugin's source tree.
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 - Open 'Makefile.am' and add 'po' to your 'SUBDIRS' variable.
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
51 - While still in the top directory of your plugin's source tree, execute
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 'intltool-prepare'. This will setup anything extra that intltool needs.
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
53 - Fire off 'autogen.sh' and when it's completed, verify that you have a
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
54 'po/POTFILES' (notice the lack of a .in). If you do, everything should be
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 set on the autotools side.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 - Take a break, stretch your legs, smoke a cigarette, whatever, because
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 we're done with the autotools part.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 - When you're ready, 'cd' into the directory with the source files for your
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 plugin.
16196
1414e0e01dc5 More renaming.
Richard Laager <rlaager@wiktel.com>
parents: 13402
diff changeset
60 - Open the file containing the PurplePluginInfo structure.
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 - If you're not already, please make sure that you are including the
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 'config.h' file for you plugin. Note that 'config.h' could be whatever
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 you told autohead to use with AM_CONFIG_HEADER. Also add the following:
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 #include <glib/gi18n-lib.h>
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 @endcode
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 Make sure that this include is after you include of your 'config.h',
21711
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
68 otherwise you will break your build. Also note that if you wish to
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
69 maintain compatibility with older versions of GLib, you will need to
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
70 include additional preprocessor directives, which we won't cover here.
901cbc91db27 Some tweaks to grim's plugin translation documentation.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16196
diff changeset
71 - This is where things get a bit goofy. libpurple is going to try to
16196
1414e0e01dc5 More renaming.
Richard Laager <rlaager@wiktel.com>
parents: 13402
diff changeset
72 translate our strings using the libpurple gettext package. So we have to
1414e0e01dc5 More renaming.
Richard Laager <rlaager@wiktel.com>
parents: 13402
diff changeset
73 convert them before libpurple attempts to.
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 - To do this, we're going to change the entries for name, summary, and
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 description to NULL.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 - Next, locate your 'init_plugin' function. Your name for this function
16196
1414e0e01dc5 More renaming.
Richard Laager <rlaager@wiktel.com>
parents: 13402
diff changeset
77 may vary, but it's the second parameter to 'PURPLE_INIT_PLUGIN'.
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 - Now add the following within your 'init_plugin' function:
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 #ifdef ENABLE_NLS
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 #endif /* ENABLE_NLS */
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 info.name = _("<YOUR PLUGIN NAME>");
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 info.summary = _("<YOUR PLUGIN SUMMARY>");
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 info.description = _("<YOUR PLUGIN DESCRIPTION>");
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 @endcode
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 Note that the _() is intentional, and that it is telling intltool that
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 this string should be translated. There is also N_() which says that a
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 string should only be marked for translation but should not be translated
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 yet.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 - Go through the rest of your code and mark all the other strings for
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 translation with _().
13402
1d8fc7347a91 [gaim-migrate @ 15777]
Richard Laager <rlaager@wiktel.com>
parents: 13400
diff changeset
95 - When thats done, feel free to commit your work, create your po template
13400
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 (pot file) or whatever.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 - To create you po template, 'cd' to 'po' and execute:
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 @code
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 intltool-update --pot
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 @endcode
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 - To add new translations to your plugin, all you have to do is add the
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 language code to the 'ALL_LINGUAS' variable in your configure.ac. Take
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 note that this list of languages should be separated by a space. After
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 you have added the language code to 'ALL_LINGUAS', drop the xx.po file
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 into 'po', and re-'autogen.sh'. After a full build you should now be
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 able to use the translation.
6a8a595e17b1 [gaim-migrate @ 15775]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 */