Mercurial > pidgin.yaz
view doc/plugin-i18n.dox @ 13914:3ae8a3935406
[gaim-migrate @ 16414]
First stab at trying to fix the MSN http connect method. It still
doesn't work, and I'm not sure why, but it gets a lot farther in
the signon process now.
For those unfamiliar with the issue, the MSN http connect method
stopped working after all the non-blocking I/O changes. The http
connect method is apparently used by lots of people behind silly
firewalls and stuff, and therefore we really shouldn't release
Gaim 2.0.0 without it working, because people will complain.
The two main problems were
1. The outgoing message queue was removed in favor of buffering all
data to one large buffer. This sounds good in theory... but apparently
each message sent to and from the server has a "SessionID" in the
HTTP header. Every message we send should use the same SessionID as
the last packet we received from the server. So basically you can't
put two messages into the outgoing buffer at the same time because
you don't have the correct SessionID to use for the second message.
You have to wait until you get the reply from the server.
2. There were some strange buffer problems with using the wrong
variable when trying to combine the header+body into one buffer
before sending the message.
I also fixed a small memleak or two, added some comments, and
tried to clean up the code a little.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 03 Jul 2006 20:39:04 +0000 |
parents | 1d8fc7347a91 |
children | 1414e0e01dc5 |
line wrap: on
line source
/** @page plugin-i18n Third Party Plugin Translation Support @section Introduction For a plugin to have translation support there are a few steps that need to followed: - The plugin must be setup to use autotools. It may be possible to add translation support without autotools, but I have no idea how. - In your autogen.sh, bootstrap.sh, or whatever you called it, add the following after your other utility checks: @code (intltoolize --version) < /dev/null > /dev/null 2>&1 || { echo; echo "You must have intltool installed to compile <YOUR PLUGIN NAME>"; echo; exit; } @endcode Then before your call aclocal add: @code intltoolize --force --copy @endcode - Now edit configure.ac, configure.in, or whatever you may have called it and add the following: @code AC_PROG_INTLTOOL GETTEXT_PACKAGE=<YOUR PLUGIN NAME> AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used]) ALL_LINGUAS="" AM_GLIB_GNU_GETTEXT @endcode The position of these macros in the file don't really matter, but if you have issues either play around with it or feel free to ask one of the Gaim developers. Finally add 'po/Makefile.in' to you 'AC_OUTPUT' command. - Now create a directory named 'po'. - 'cd' into the 'po' directory. - Create/edit the file 'POTFILE.in' in your favorite editor. Each line should be the name of a file that could or does have strings marked for translating (we're getting to that step). These file names should be relative to the top directory of your plugin. - 'cd' back to the top directory of your plugin. - Open 'Makefile.am' and add 'po' to your 'SUBDIRS' variable. - While still in the top directory of your plugin execute 'intltool-prepare'. This will setup anything extra that intltool needs. - Fire off an 'autogen.sh' and when it's completed, verify that you have a 'po/POTFILES', notice the lack of a .in. If you do, everything should be set on the autotools side. - Take a break, stretch your legs, smoke a cigarette, whatever, because we're done with the autotools part. - When you're ready, 'cd' into the directory with the source files for your plugin. - Open the file containing the GaimPluginInfo structure. - If you're not already, please make sure that you are including the 'config.h' file for you plugin. Note that 'config.h' could be whatever you told autohead to use with AM_CONFIG_HEADER. Also add the following: @code #include <glib/gi18n-lib.h> @endcode Make sure that this include is after you include of your 'config.h', otherwise you will break your build. - This is where things get a bit goofy. Gaim is going to try and translate our strings using the Gaim gettext package. So we have to convert them before Gaim attempts to. - To do this, we're going to change the entries for name, summary, and description to NULL. - Next, locate your 'init_plugin' function. Your name for this function may vary, but it's the second parameter to 'GAIM_INIT_PLUGIN'. - Now add the following within your 'init_plugin' function: @code #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); #endif /* ENABLE_NLS */ info.name = _("<YOUR PLUGIN NAME>"); info.summary = _("<YOUR PLUGIN SUMMARY>"); info.description = _("<YOUR PLUGIN DESCRIPTION>"); @endcode Note that the _() is intentional, and that it is telling intltool that this string should be translated. There is also N_() which says that a string should only be marked for translation but should not be translated yet. - Go through the rest of your code and mark all the other strings for translation with _(). - When thats done, feel free to commit your work, create your po template (pot file) or whatever. - To create you po template, 'cd' to 'po' and execute: @code intltool-update --pot @endcode - To add new translations to your plugin, all you have to do is add the language code to the 'ALL_LINGUAS' variable in your configure.ac. Take note that this list of languages should be separated by a space. After you have added the language code to 'ALL_LINGUAS', drop the xx.po file into 'po', and re-'autogen.sh'. After a full build you should now be able to use the translation. */