Thanks for feedback! You tested on windows - which version?
AGS wrote:External dependencies/platform differences make it hard to get gtk+ examples to compile/run. I can always get your gtk+ examples to compile but almost never without having to change some part of the example. Things that 'just work' on Linux sometimes don't 'just work' on Windows. Don't know why not (your code takes into account platform differences).
I guess it's just the way things are (as long as I can get programs to compile I don't mind a little bit of editing here-and-there).
Get it running anyway is important. Then we can learn.
I also had trouble with this example: I tested on LINUX and published the code. Then I tested on win XP SP2 and had lots of trouble. While libgthread was loading on LINUX I had to add #INCLIB "gthread" for win32 in to the glib.bi file. I also had to fix a bug in the original gthread.h headers: g_thread_create() is declared as a function there. But it should be a macro wrapper for g_thread_create_full().
AGS wrote:Apparently g_thread_init and g_thread_create are deprecated. g_thread_init and g_thread_create were not in the gtk binaries (at least not in version 2.24).
Since GLib-2.32 g_thread_create() is replaced by g_thread_new(). And g_thread_init() is only needed if you have more than one thread, so in this example it should be called. But the deprecated function should still work. And GTK+-2.24 should go with GLib-2.30, so both functions should be available anyway. Did you use the latest header update (2012-05-24)?
AGS wrote:I had to remove the *__ (no doubt __ is used by gettext) for the code would not compile with those *__ in it.
Yes, it's declared in libintl.bi and it's for I18N. It's a shortcut:
There's a libintl.bi version from sir_mud that doesn't include this abbreviation (and has another downside - cant remember which ATM, maybe interaction with locale.bi ?!?).
Here's the code I use (.../freebasic/inc/libintl.bi):
Code: Select all
' This is file libintl.bi
' (FreeBasic binding for libintl version 0.18)
'
' (C) 2011-2012 Thomas[ dot ]Freiherr[ at ]gmx[ dot ]net
' translated with help of h_2_bi.bas
' (http://www.freebasic-portal.de/downloads/ressourcencompiler/h2bi-bas-134.html)
'
' Licence:
' This library binding 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 binding 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, refer to:
' http://www.gnu.org/licenses/lgpl.html
'
'
' Original license text:
'
'/* Message catalogs for internationalization.
'Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc.
'This file is part of the GNU C Library.
'This file is derived from the file libgettext.h in the GNU gettext package.
'The GNU C 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.1 of the License, or (at your option) any later version.
'The GNU C 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 the GNU C Library; if not, write to the Free
'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
'02111-1307 USA. */
#IFDEF __FB_WIN32__
#PRAGMA push(msbitfields)
#INCLIB "iconv"
#INCLIB "intl"
#ENDIF
#INCLUDE ONCE "crt/locale.bi"
EXTERN "C" ' (h_2_bi -P_oCD option)
' 001 start from: libintl.h2bi ==> libintl.h
#IFNDEF _LIBINTL_H
#DEFINE _LIBINTL_H 1
' file not found: features.h
#DEFINE __USE_GNU_GETTEXT 1
#DEFINE __GNU_GETTEXT_SUPPORTED_REVISION(major) IIF((major)= 0 , 1 , -1)
DECLARE FUNCTION gettext(BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION dgettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION __dgettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION dcgettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION __dcgettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION ngettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS ULONG) AS ZSTRING PTR
DECLARE FUNCTION dngettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS ULONG) AS ZSTRING PTR
DECLARE FUNCTION dcngettext(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS ULONG, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION textdomain(BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION bindtextdomain(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION bind_textdomain_codeset(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
#IF DEFINED (__OPTIMIZE__) AND NOT DEFINED (__cplusplus)
#DEFINE __need_NULL
#INCLUDE ONCE "crt/stddef.bi" '__HEADERS__: stddef.h
#DEFINE gettext(msgid) dgettext (NULL, msgid)
#DEFINE dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
#DEFINE ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
#DEFINE dngettext(domainname, msgid1, msgid2, n) dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
#ENDIF ' DEFINED __OPTIM...
#ENDIF ' _LIBINTL_H
END EXTERN ' (h_2_bi -P_oCD option)
#IFDEF __FB_WIN32__
#PRAGMA pop(msbitfields)
#ENDIF
#DEFINE __(_T_) gettext(_T_)
' Translated at 11-01-28 11:16:38, by h_2_bi (version 0.2.0.1,
' released under GPLv3 by Thomas[ dot ]Freiherr[ at ]gmx[ dot ]net)
' Protocol: libintl.bi
' Parameters:
' Process time [s]: 0.006257920642383397
' Bytes translated: 2184
' Maximum deep: 1
' SUB/FUNCTION names: 11
' mangled TYPE names: 0
' files done: 0
' files missed: 1
' features.h
' __FOLDERS__ : 0
' __MACROS__ : 5
' 1: #define BEGIN_DECLS
' 1: #define END_DECLS
' 11: #define THROW
' 33: #define const const
' 8: #define attribute_format_arg (x)
' __HEADERS__ : 0
' __TYPES__ : 0
' __POST_REPS__ : 0
When you get my original code running you can add in to your project folder a file .../project/locale/en/LC_MESSAGES/wwt.mo with the translations (created by PoEdit or a similar tool) and you'll have an english version of the example. Or replace the 'en' subfolder by 'nl' for a dutch version (and addapt the .mo file).