summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-06 10:20:36 -0700
committerIra Rice <irarice@gmail.com>2009-01-06 10:20:36 -0700
commit2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251 (patch)
treed4bee5fa8cb866618995e666ce1fdf37ca174f3b
parenta570ee66c7cf6ddff7b0c124ad4b633b4651bdb3 (diff)
downloadmana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.gz
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.bz2
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.xz
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.zip
Added support for internationalization
Merged from the mainline client. Originally implemented by Guillaume Melquiond, starting with commit 1828eee6a6d91fd385ad1e69d93044516493aa91. Conflicts: INSTALL configure.ac src/Makefile.am src/gui/buy.cpp src/gui/confirm_dialog.cpp src/gui/inventorywindow.cpp src/gui/login.cpp src/gui/menuwindow.cpp src/gui/minimap.cpp src/gui/ok_dialog.cpp src/gui/popupmenu.cpp src/gui/register.cpp src/gui/sell.cpp src/gui/setup.cpp src/gui/setup_video.cpp Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r--ABOUT-NLS279
-rw-r--r--INSTALL4
-rw-r--r--Makefile.am5
-rw-r--r--config.rpath0
-rwxr-xr-xconfigure.ac14
-rw-r--r--po/LINGUAS1
-rw-r--r--po/Makevars41
-rw-r--r--po/POTFILES.in26
-rw-r--r--po/aethyra.pot486
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am6
-rw-r--r--src/gui/buy.cpp35
-rw-r--r--src/gui/char_select.cpp63
-rw-r--r--src/gui/char_server.cpp8
-rw-r--r--src/gui/confirm_dialog.cpp6
-rw-r--r--src/gui/connection.cpp6
-rw-r--r--src/gui/equipmentwindow.cpp4
-rw-r--r--src/gui/inventorywindow.cpp43
-rw-r--r--src/gui/item_amount.cpp34
-rw-r--r--src/gui/login.cpp21
-rw-r--r--src/gui/menuwindow.cpp38
-rw-r--r--src/gui/minimap.cpp6
-rw-r--r--src/gui/npc_text.cpp6
-rw-r--r--src/gui/npclistdialog.cpp8
-rw-r--r--src/gui/ok_dialog.cpp4
-rw-r--r--src/gui/popupmenu.cpp49
-rw-r--r--src/gui/register.cpp58
-rw-r--r--src/gui/sell.cpp40
-rw-r--r--src/gui/setup.cpp27
-rw-r--r--src/gui/setup_audio.cpp8
-rw-r--r--src/gui/setup_joystick.cpp18
-rw-r--r--src/gui/setup_video.cpp77
-rw-r--r--src/gui/trade.cpp43
-rw-r--r--src/main.cpp14
-rw-r--r--src/net/playerhandler.cpp69
-rw-r--r--src/resources/itemdb.cpp5
-rw-r--r--src/utils/gettext.h44
37 files changed, 1270 insertions, 327 deletions
diff --git a/ABOUT-NLS b/ABOUT-NLS
new file mode 100644
index 00000000..249a4b5b
--- /dev/null
+++ b/ABOUT-NLS
@@ -0,0 +1,279 @@
+Notes on the Free Translation Project
+*************************************
+
+ Free software is going international! The Free Translation Project
+is a way to get maintainers of free software, translators, and users all
+together, so that will gradually become able to speak many languages.
+A few packages already provide translations for their messages.
+
+ If you found this `ABOUT-NLS' file inside a distribution, you may
+assume that the distributed package does use GNU `gettext' internally,
+itself available at your nearest GNU archive site. But you do *not*
+need to install GNU `gettext' prior to configuring, installing or using
+this package with messages translated.
+
+ Installers will find here some useful hints. These notes also
+explain how users should proceed for getting the programs to use the
+available translations. They tell how people wanting to contribute and
+work at translations should contact the appropriate team.
+
+ When reporting bugs in the `intl/' directory or bugs which may be
+related to internationalization, you should tell about the version of
+`gettext' which is used. The information can be found in the
+`intl/VERSION' file, in internationalized packages.
+
+One advise in advance
+=====================
+
+ If you want to exploit the full power of internationalization, you
+should configure it using
+
+ ./configure --with-included-gettext
+
+to force usage of internationalizing routines provided within this
+package, despite the existence of internationalizing capabilities in the
+operating system where this package is being installed. So far, only
+the `gettext' implementation in the GNU C library version 2 provides as
+many features (such as locale alias or message inheritance) as the
+implementation here. It is also not possible to offer this additional
+functionality on top of a `catgets' implementation. Future versions of
+GNU `gettext' will very likely convey even more functionality. So it
+might be a good idea to change to GNU `gettext' as soon as possible.
+
+ So you need not provide this option if you are using GNU libc 2 or
+you have installed a recent copy of the GNU gettext package with the
+included `libintl'.
+
+INSTALL Matters
+===============
+
+ Some packages are "localizable" when properly installed; the
+programs they contain can be made to speak your own native language.
+Most such packages use GNU `gettext'. Other packages have their own
+ways to internationalization, predating GNU `gettext'.
+
+ By default, this package will be installed to allow translation of
+messages. It will automatically detect whether the system provides
+usable `catgets' (if using this is selected by the installer) or
+`gettext' functions. If neither is available, the GNU `gettext' own
+library will be used. This library is wholly contained within this
+package, usually in the `intl/' subdirectory, so prior installation of
+the GNU `gettext' package is *not* required. Installers may use
+special options at configuration time for changing the default
+behaviour. The commands:
+
+ ./configure --with-included-gettext
+ ./configure --with-catgets
+ ./configure --disable-nls
+
+will respectively bypass any pre-existing `catgets' or `gettext' to use
+the internationalizing routines provided within this package, enable
+the use of the `catgets' functions (if found on the locale system), or
+else, *totally* disable translation of messages.
+
+ When you already have GNU `gettext' installed on your system and run
+configure without an option for your new package, `configure' will
+probably detect the previously built and installed `libintl.a' file and
+will decide to use this. This might be not what is desirable. You
+should use the more recent version of the GNU `gettext' library. I.e.
+if the file `intl/VERSION' shows that the library which comes with this
+package is more recent, you should use
+
+ ./configure --with-included-gettext
+
+to prevent auto-detection.
+
+ By default the configuration process will not test for the `catgets'
+function and therefore they will not be used. The reasons are already
+given above: the emulation on top of `catgets' cannot provide all the
+extensions provided by the GNU `gettext' library. If you nevertheless
+want to use the `catgets' functions use
+
+ ./configure --with-catgets
+
+to enable the test for `catgets' (this causes no harm if `catgets' is
+not available on your system). If you really select this option we
+would like to hear about the reasons because we cannot think of any
+good one ourself.
+
+ Internationalized packages have usually many `po/LL.po' files, where
+LL gives an ISO 639 two-letter code identifying the language. Unless
+translations have been forbidden at `configure' time by using the
+`--disable-nls' switch, all available translations are installed
+together with the package. However, the environment variable `LINGUAS'
+may be set, prior to configuration, to limit the installed set.
+`LINGUAS' should then contain a space separated list of two-letter
+codes, stating which languages are allowed.
+
+Using This Package
+==================
+
+ As a user, if your language has been installed for this package, you
+only have to set the `LANG' environment variable to the appropriate
+ISO 639 `LL' two-letter code prior to using the programs in the
+package. For example, let's suppose that you speak German. At the
+shell prompt, merely execute `setenv LANG de' (in `csh'),
+`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
+can be done from your `.login' or `.profile' file, once and for all.
+
+ An operating system might already offer message localization for
+many of its programs, while other programs have been installed locally
+with the full capabilities of GNU `gettext'. Just using `gettext'
+extended syntax for `LANG' would break proper localization of already
+available operating system programs. In this case, users should set
+both `LANGUAGE' and `LANG' variables in their environment, as programs
+using GNU `gettext' give preference to `LANGUAGE'. For example, some
+Swedish users would rather read translations in German than English for
+when Swedish is not available. This is easily accomplished by setting
+`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
+
+Translating Teams
+=================
+
+ For the Free Translation Project to be a success, we need interested
+people who like their own language and write it well, and who are also
+able to synergize with other translators speaking the same language.
+Each translation team has its own mailing list, courtesy of Linux
+International. You may reach your translation team at the address
+`LL@li.org', replacing LL by the two-letter ISO 639 code for your
+language. Language codes are *not* the same as the country codes given
+in ISO 3166. The following translation teams exist, as of August 1998:
+
+ Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
+ Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
+ `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
+ Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
+ `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
+ Swedish `sv', and Turkish `tr'.
+
+For example, you may reach the Chinese translation team by writing to
+`zh@li.org'.
+
+ If you'd like to volunteer to *work* at translating messages, you
+should become a member of the translating team for your own language.
+The subscribing address is *not* the same as the list itself, it has
+`-request' appended. For example, speakers of Swedish can send a
+message to `sv-request@li.org', having this message body:
+
+ subscribe
+
+ Keep in mind that team members are expected to participate
+*actively* in translations, or at solving translational difficulties,
+rather than merely lurking around. If your team does not exist yet and
+you want to start one, or if you are unsure about what to do or how to
+get started, please write to `translation@iro.umontreal.ca' to reach the
+coordinator for all translator teams.
+
+ The English team is special. It works at improving and uniformizing
+the terminology in use. Proven linguistic skill are praised more than
+programming skill, here.
+
+Available Packages
+==================
+
+ Languages are not equally supported in all packages. The following
+matrix shows the current state of internationalization, as of August
+1998. The matrix shows, in regard of each package, for which languages
+PO files have been submitted to translation coordination.
+
+ Ready PO files cs da de el en es fi fr it
+ .----------------------------.
+ bash | [] [] |
+ bison | [] [] |
+ clisp | [] [] [] [] |
+ cpio | [] [] [] |
+ diffutils | [] [] [] |
+ enscript | [] [] [] [] |
+ fileutils | [] [] [] [] |
+ findutils | [] [] [] [] |
+ flex | [] [] |
+ gcal | [] [] |
+ gettext | [] [] [] [] [] |
+ grep | [] [] [] [] |
+ hello | [] [] [] [] [] |
+ id-utils | [] [] |
+ indent | [] [] |
+ libc | [] [] [] |
+ m4 | [] [] |
+ make | [] [] [] |
+ music | [] |
+ ptx | [] [] [] |
+ recode | [] [] [] [] |
+ sed | |
+ sh-utils | [] [] [] |
+ sharutils | [] [] [] [] [] |
+ tar | [] [] [] [] |
+ texinfo | [] [] [] |
+ textutils | [] [] [] [] |
+ wdiff | [] [] [] [] |
+ wget | [] [] [] [] |
+ `----------------------------'
+ cs da de el en es fi fr it
+ 7 4 26 4 1 18 1 26 4
+
+ ja ko nl no pl pt ru sl sv
+ .----------------------------.
+ bash | [] | 3
+ bison | [] | 3
+ clisp | | 4
+ cpio | [] [] [] | 6
+ diffutils | [] [] | 5
+ enscript | [] [] | 6
+ fileutils | [] [] [] [] [] [] [] | 11
+ findutils | [] [] [] [] [] | 9
+ flex | [] [] | 4
+ gcal | [] [] [] | 5
+ gettext | [] [] [] [] [] [] [] | 13
+ grep | [] [] [] [] [] [] [] | 11
+ hello | [] [] [] [] [] [] [] | 12
+ id-utils | [] | 3
+ indent | [] [] [] | 5
+ libc | [] [] [] [] [] | 8
+ m4 | [] [] [] [] | 6
+ make | [] [] [] | 6
+ music | [] | 2
+ ptx | [] [] [] [] [] | 8
+ recode | [] [] [] [] [] | 9
+ sed | | 0
+ sh-utils | [] [] [] [] [] | 8
+ sharutils | [] [] | 7
+ tar | [] [] [] [] [] [] [] | 11
+ texinfo | [] | 4
+ textutils | [] [] [] [] [] | 9
+ wdiff | [] [] [] [] | 8
+ wget | [] | 5
+ `----------------------------'
+ 18 teams ja ko nl no pl pt ru sl sv
+ 29 domains 1 12 21 11 19 7 5 7 17 191
+
+ Some counters in the preceding matrix are higher than the number of
+visible blocks let us expect. This is because a few extra PO files are
+used for implementing regional variants of languages, or language
+dialects.
+
+ For a PO file in the matrix above to be effective, the package to
+which it applies should also have been internationalized and
+distributed as such by its maintainer. There might be an observable
+lag between the mere existence a PO file and its wide availability in a
+distribution.
+
+ If August 1998 seems to be old, you may fetch a more recent copy of
+this `ABOUT-NLS' file on most GNU archive sites.
+
+Using `gettext' in new packages
+===============================
+
+ If you are writing a freely available program and want to
+internationalize it you are welcome to use GNU `gettext' in your
+package. Of course the GNU Public License applies to your sources from
+then if you include `gettext' directly in your distribution on but
+since you are writing free software anyway this is no restriction.
+
+ Once the sources are change appropriately and the setup can handle to
+use of `gettext' the only thing missing are the translations. The Free
+Translation Project is also available for packages which are not
+developed inside the GNU project. Therefore the information given above
+applies also for every other Free Software Project. Contact
+`translation@iro.umontreal.ca' to make the `.pot' files available to
+the translation teams.
+
diff --git a/INSTALL b/INSTALL
index 85fe946f..4359d7a8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,7 +12,7 @@ IRC: irc.freenode.net / #aethyra
1. Requirements
===============
-You are expected to have either checked out Aethyra from CVS or you have downloaded
+You are expected to have either checked out Aethyra from git or you have downloaded
a source release. To get Aethyra to compile, you need a compiler
(GCC) and some libraries. The required libraries are:
@@ -32,6 +32,8 @@ compile:
* GNU automake 1.9 http://www.gnu.org/software/automake/
* GNU autoconf http://www.gnu.org/software/autoconf/
+* GNU gettext http://www.gnu.org/software/gettext/
+* CVS http://www.nongnu.org/cvs/ (needed to run autopoint)
Installing these dependencies is distributions-specific, and we'll leave it to
you to figure this out.
diff --git a/Makefile.am b/Makefile.am
index f399eb3c..ae62a99b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
# Subdirectories to build
-SUBDIRS = data docs src
+SUBDIRS = data docs po src
desktopdir = $(datadir)/applications
@@ -7,3 +7,6 @@ desktop_DATA = aethyra.desktop
# Extra files to include
EXTRA_DIST = $(desktop_DATA)
+
+# Autopoint m4 stuff
+ACLOCAL_AMFLAGS = -I m4
diff --git a/config.rpath b/config.rpath
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/config.rpath
diff --git a/configure.ac b/configure.ac
index 4424d152..e4acb4df 100755
--- a/configure.ac
+++ b/configure.ac
@@ -6,13 +6,9 @@ AC_LANG_CPLUSPLUS
# Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
-AC_PROG_MAKE_SET
# Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-AC_C_CONST
AC_HEADER_TIME
-AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
@@ -22,6 +18,15 @@ AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit floor getcwd gethostbyname memset mkdir select socket])
+# Checks for internationalization support
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.16.1])
+
+# Search for *-config
+AC_PATH_PROG(SDL_CONFIG, sdl-config)
+AC_PATH_PROG(PKG_CONFIG, pkg-config)
+AC_PATH_PROG(CURL_CONFIG, curl-config)
+
# Checks for libraries
AC_CHECK_LIB([pthread], [pthread_create], ,
AC_MSG_ERROR([ *** Unable to find pthread library]))
@@ -113,6 +118,7 @@ data/graphics/images/Makefile
data/help/Makefile
data/icons/Makefile
docs/Makefile
+po/Makefile.in
])
AC_OUTPUT
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 00000000..8bba9bc2
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1 @@
+# Set of available languages.
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 00000000..76e72f50
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = tmw
+
+# 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 = The Mana World Development Team
+
+# 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 =
+
+# 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 =
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 00000000..e66b8f69
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,26 @@
+# List of source files which contain translatable strings.
+
+src/gui/buy.cpp
+src/gui/char_select.cpp
+src/gui/char_server.cpp
+src/gui/confirm_dialog.cpp
+src/gui/connection.cpp
+src/gui/equipmentwindow.cpp
+src/gui/inventorywindow.cpp
+src/gui/item_amount.cpp
+src/gui/login.cpp
+src/gui/menuwindow.cpp
+src/gui/minimap.cpp
+src/gui/npclistdialog.cpp
+src/gui/npc_text.cpp
+src/gui/ok_dialog.cpp
+src/gui/popupmenu.cpp
+src/gui/register.cpp
+src/gui/sell.cpp
+src/gui/setup_audio.cpp
+src/gui/setup.cpp
+src/gui/setup_joystick.cpp
+src/gui/setup_video.cpp
+src/gui/trade.cpp
+src/net/playerhandler.cpp
+src/resources/itemdb.cpp
diff --git a/po/aethyra.pot b/po/aethyra.pot
new file mode 100644
index 00000000..ae49bb32
--- /dev/null
+++ b/po/aethyra.pot
@@ -0,0 +1,486 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR The Mana World Development Team
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: themanaworld-devel@lists.sourceforge.net\n"
+"POT-Creation-Date: 2009-01-06 14:37+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/gui/buy.cpp:41 src/gui/buy.cpp:59
+msgid "Buy"
+msgstr ""
+
+#: src/gui/buy.cpp:56 src/gui/buy.cpp:284 src/gui/sell.cpp:63
+#: src/gui/sell.cpp:304
+#, c-format
+msgid "Price: %d GP / Total: %d GP"
+msgstr ""
+
+#: src/gui/buy.cpp:60 src/gui/sell.cpp:67
+msgid "Quit"
+msgstr ""
+
+#: src/gui/buy.cpp:61 src/gui/buy.cpp:251 src/gui/buy.cpp:269
+#: src/gui/inventorywindow.cpp:150 src/gui/inventorywindow.cpp:160
+#: src/gui/sell.cpp:68 src/gui/sell.cpp:275 src/gui/sell.cpp:289
+#: src/gui/trade.cpp:94 src/gui/trade.cpp:266
+#, c-format
+msgid "Description: %s"
+msgstr ""
+
+#: src/gui/buy.cpp:62 src/gui/buy.cpp:253 src/gui/buy.cpp:270
+#: src/gui/inventorywindow.cpp:149 src/gui/inventorywindow.cpp:158
+#: src/gui/sell.cpp:69 src/gui/sell.cpp:277 src/gui/sell.cpp:290
+#, c-format
+msgid "Effect: %s"
+msgstr ""
+
+#: src/gui/char_select.cpp:61
+msgid "Confirm Character Delete"
+msgstr ""
+
+#: src/gui/char_select.cpp:62
+msgid "Are you sure you want to delete this character?"
+msgstr ""
+
+#: src/gui/char_select.cpp:79
+msgid "Select Character"
+msgstr ""
+
+#: src/gui/char_select.cpp:82 src/gui/item_amount.cpp:50 src/gui/login.cpp:49
+#: src/gui/ok_dialog.cpp:37 src/gui/trade.cpp:62
+msgid "Ok"
+msgstr ""
+
+#: src/gui/char_select.cpp:83 src/gui/char_select.cpp:271
+#: src/gui/char_server.cpp:60 src/gui/connection.cpp:47
+#: src/gui/item_amount.cpp:51 src/gui/login.cpp:50
+#: src/gui/npclistdialog.cpp:45 src/gui/register.cpp:76 src/gui/setup.cpp:58
+#: src/gui/trade.cpp:63
+msgid "Cancel"
+msgstr ""
+
+#: src/gui/char_select.cpp:84
+msgid "New"
+msgstr ""
+
+#: src/gui/char_select.cpp:85
+msgid "Delete"
+msgstr ""
+
+#: src/gui/char_select.cpp:86
+msgid "Previous"
+msgstr ""
+
+#: src/gui/char_select.cpp:87
+msgid "Next"
+msgstr ""
+
+#: src/gui/char_select.cpp:89 src/gui/char_select.cpp:184
+#: src/gui/char_select.cpp:196 src/gui/inventorywindow.cpp:148
+#: src/gui/inventorywindow.cpp:156 src/gui/trade.cpp:92 src/gui/trade.cpp:264
+#, c-format
+msgid "Name: %s"
+msgstr ""
+
+#: src/gui/char_select.cpp:90 src/gui/char_select.cpp:185
+#: src/gui/char_select.cpp:197
+#, c-format
+msgid "Level: %d"
+msgstr ""
+
+#: src/gui/char_select.cpp:91 src/gui/char_select.cpp:186
+#: src/gui/char_select.cpp:198
+#, c-format
+msgid "Job Level: %d"
+msgstr ""
+
+#: src/gui/char_select.cpp:92 src/gui/char_select.cpp:199
+#, c-format
+msgid "Money: %d"
+msgstr ""
+
+#: src/gui/char_select.cpp:187
+#, c-format
+msgid "Gold: %d"
+msgstr ""
+
+#: src/gui/char_select.cpp:256
+msgid "Create Character"
+msgstr ""
+
+#: src/gui/char_select.cpp:263 src/gui/login.cpp:42 src/gui/register.cpp:65
+msgid "Name:"
+msgstr ""
+
+#: src/gui/char_select.cpp:266
+msgid "Hair Color:"
+msgstr ""
+
+#: src/gui/char_select.cpp:269
+msgid "Hair Style:"
+msgstr ""
+
+#: src/gui/char_select.cpp:270
+msgid "Create"
+msgstr ""
+
+#: src/gui/char_server.cpp:52
+msgid "Select Server"
+msgstr ""
+
+#: src/gui/char_server.cpp:59 src/gui/npclistdialog.cpp:44
+#: src/gui/npc_text.cpp:46
+msgid "OK"
+msgstr ""
+
+#: src/gui/confirm_dialog.cpp:35
+msgid "Yes"
+msgstr ""
+
+#: src/gui/confirm_dialog.cpp:36
+msgid "No"
+msgstr ""
+
+#: src/gui/connection.cpp:49
+msgid "Connecting..."
+msgstr ""
+
+#: src/gui/equipmentwindow.cpp:38 src/gui/menuwindow.cpp:62
+msgid "Equipment"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:46 src/gui/menuwindow.cpp:63
+msgid "Inventory"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:56 src/gui/inventorywindow.cpp:232
+msgid "Use"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:57
+msgid "Drop"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:99
+#, c-format
+msgid "Weight: %d / %d"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:104
+#, c-format
+msgid "Slots used: %d / %d"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:225
+msgid "Unequip"
+msgstr ""
+
+#: src/gui/inventorywindow.cpp:228
+msgid "Equip"
+msgstr ""
+
+#: src/gui/item_amount.cpp:75
+msgid "Select amount of items to trade."
+msgstr ""
+
+#: src/gui/item_amount.cpp:79
+msgid "Select amount of items to drop."
+msgstr ""
+
+#: src/gui/login.cpp:40
+msgid "Login"
+msgstr ""
+
+#: src/gui/login.cpp:43 src/gui/register.cpp:66
+msgid "Password:"
+msgstr ""
+
+#: src/gui/login.cpp:44 src/gui/register.cpp:68
+msgid "Server:"
+msgstr ""
+
+#: src/gui/login.cpp:48
+msgid "Remember Username"
+msgstr ""
+
+#: src/gui/login.cpp:51 src/gui/register.cpp:75
+msgid "Register"
+msgstr ""
+
+#: src/gui/menuwindow.cpp:61
+msgid "Status"
+msgstr ""
+
+#: src/gui/menuwindow.cpp:64
+msgid "Skills"
+msgstr ""
+
+#: src/gui/menuwindow.cpp:65
+msgid "Shortcut"
+msgstr ""
+
+#: src/gui/menuwindow.cpp:66
+msgid "Setup"
+msgstr ""
+
+#: src/gui/minimap.cpp:34
+msgid "MiniMap"
+msgstr ""
+
+#: src/gui/npclistdialog.cpp:35 src/gui/npc_text.cpp:35
+msgid "NPC"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:81
+#, c-format
+msgid "@@trade|Trade With %s@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:83
+#, c-format
+msgid "@@attack|Attack %s@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:114
+msgid "@@talk|Talk To NPC@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:124 src/gui/popupmenu.cpp:140
+#: src/gui/popupmenu.cpp:293
+msgid "@@cancel|Cancel@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:136
+#, c-format
+msgid "@@pickup|Pick Up %s@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:283
+msgid "@@use|Unequip@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:285
+msgid "@@use|Equip@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:288
+msgid "@@use|Use@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:290
+msgid "@@drop|Drop@@"
+msgstr ""
+
+#: src/gui/popupmenu.cpp:291
+msgid "@@description|Description@@"
+msgstr ""
+
+#: src/gui/register.cpp:67
+msgid "Confirm:"
+msgstr ""
+
+#: src/gui/register.cpp:73
+msgid "Male"
+msgstr ""
+
+#: src/gui/register.cpp:74
+msgid "Female"
+msgstr ""
+
+#: src/gui/register.cpp:176
+#, c-format
+msgid "The username needs to be at least %d characters long."
+msgstr ""
+
+#: src/gui/register.cpp:184
+#, c-format
+msgid "The username needs to be less than %d characters long."
+msgstr ""
+
+#: src/gui/register.cpp:192
+#, c-format
+msgid "The password needs to be at least %d characters long."
+msgstr ""
+
+#: src/gui/register.cpp:200
+#, c-format
+msgid "The password needs to be less than %d characters long."
+msgstr ""
+
+#: src/gui/register.cpp:207
+msgid "Passwords do not match."
+msgstr ""
+
+#: src/gui/register.cpp:227
+msgid "Error"
+msgstr ""
+
+#: src/gui/sell.cpp:46 src/gui/sell.cpp:66
+msgid "Sell"
+msgstr ""
+
+#: src/gui/setup_audio.cpp:40
+msgid "Sound"
+msgstr ""
+
+#: src/gui/setup_audio.cpp:46
+msgid "Sfx volume"
+msgstr ""
+
+#: src/gui/setup_audio.cpp:47
+msgid "Music volume"
+msgstr ""
+
+#: src/gui/setup.cpp:58
+msgid "Apply"
+msgstr ""
+
+#: src/gui/setup.cpp:58
+msgid "Reset Windows"
+msgstr ""
+
+#: src/gui/setup.cpp:79
+msgid "Video"
+msgstr ""
+
+#: src/gui/setup.cpp:83
+msgid "Audio"
+msgstr ""
+
+#: src/gui/setup.cpp:87
+msgid "Joystick"
+msgstr ""
+
+#: src/gui/setup.cpp:91
+msgid "Keyboard"
+msgstr ""
+
+#: src/gui/setup.cpp:95
+msgid "Players"
+msgstr ""
+
+#: src/gui/setup_joystick.cpp:36 src/gui/setup_joystick.cpp:70
+msgid "Press the button to start calibration"
+msgstr ""
+
+#: src/gui/setup_joystick.cpp:37 src/gui/setup_joystick.cpp:68
+msgid "Calibrate"
+msgstr ""
+
+#: src/gui/setup_joystick.cpp:38
+msgid "Enable joystick"
+msgstr ""
+
+#: src/gui/setup_joystick.cpp:73
+msgid "Stop"
+msgstr ""
+
+#: src/gui/setup_joystick.cpp:74
+msgid "Rotate the stick"
+msgstr ""
+
+#: src/gui/setup_video.cpp:112
+msgid "Full screen"
+msgstr ""
+
+#: src/gui/setup_video.cpp:113
+msgid "OpenGL"
+msgstr ""
+
+#: src/gui/setup_video.cpp:114
+msgid "Custom cursor"
+msgstr ""
+
+#: src/gui/setup_video.cpp:116
+msgid "FPS Limit:"
+msgstr ""
+
+#: src/gui/setup_video.cpp:135
+msgid "Gui opacity"
+msgstr ""
+
+#: src/gui/setup_video.cpp:192
+msgid "Scroll radius"
+msgstr ""
+
+#: src/gui/setup_video.cpp:200
+msgid "Scroll laziness"
+msgstr ""
+
+#: src/gui/setup_video.cpp:208
+msgid "Ambient FX"
+msgstr ""
+
+#: src/gui/setup_video.cpp:215 src/gui/setup_video.cpp:412
+msgid "off"
+msgstr ""
+
+#: src/gui/setup_video.cpp:218 src/gui/setup_video.cpp:234
+#: src/gui/setup_video.cpp:415 src/gui/setup_video.cpp:429
+msgid "low"
+msgstr ""
+
+#: src/gui/setup_video.cpp:221 src/gui/setup_video.cpp:240
+#: src/gui/setup_video.cpp:418 src/gui/setup_video.cpp:435
+msgid "high"
+msgstr ""
+
+#: src/gui/setup_video.cpp:227
+msgid "Particle Detail"
+msgstr ""
+
+#: src/gui/setup_video.cpp:237 src/gui/setup_video.cpp:432
+msgid "medium"
+msgstr ""
+
+#: src/gui/setup_video.cpp:243 src/gui/setup_video.cpp:438
+msgid "max"
+msgstr ""
+
+#: src/gui/setup_video.cpp:309
+msgid "Switching to full screen"
+msgstr ""
+
+#: src/gui/setup_video.cpp:310
+msgid "Restart needed for changes to take effect."
+msgstr ""
+
+#: src/gui/setup_video.cpp:322
+msgid "Changing OpenGL"
+msgstr ""
+
+#: src/gui/setup_video.cpp:323
+msgid "Applying change to OpenGL requires restart."
+msgstr ""
+
+#: src/gui/trade.cpp:61
+msgid "Add"
+msgstr ""
+
+#: src/gui/trade.cpp:64
+msgid "Trade"
+msgstr ""
+
+#: src/gui/trade.cpp:80 src/gui/trade.cpp:156 src/gui/trade.cpp:204
+#, c-format
+msgid "You get %d GP."
+msgstr ""
+
+#: src/gui/trade.cpp:81
+msgid "You give:"
+msgstr ""
+
+#: src/resources/itemdb.cpp:99
+msgid "Unnamed"
+msgstr ""
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6411d19f..7f0560b5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -267,6 +267,7 @@ SET(SRCS
utils/base64.h
utils/dtor.h
utils/fastsqrt.h
+ utils/gettext.h
utils/strprintf.cpp
utils/strprintf.h
utils/tostring.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 9426171d..d59198d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -233,6 +233,7 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \
utils/base64.h \
utils/dtor.h \
utils/fastsqrt.h \
+ utils/gettext.h \
utils/strprintf.cpp \
utils/strprintf.h \
utils/tostring.h \
@@ -333,8 +334,9 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \
# set the include path found by configure
INCLUDES = \
- $(all_includes) \
- -DAETHYRA_DATADIR=\""$(pkgdatadir)/"\"
+ $(all_includes) \
+ -DAETHYRA_DATADIR=\""$(pkgdatadir)/"\" \
+ -DLOCALEDIR=\""$(localedir)/"\"
# the library search path.
aethyra_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0`
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 597a7cad..a3424ab6 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -33,10 +33,11 @@
#include "../net/messageout.h"
#include "../net/protocol.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
BuyDialog::BuyDialog(Network *network):
- Window("Buy"), mNetwork(network),
+ Window(_("Buy")), mNetwork(network),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
setWindowName("Buy");
@@ -51,13 +52,13 @@ BuyDialog::BuyDialog(Network *network):
mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label("Price : 0 GP / 0 GP");
+ mMoneyLabel = new gcn::Label(strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
- mBuyButton = new Button("Buy", "buy", this);
- mQuitButton = new Button("Quit", "quit", this);
- mItemDescLabel = new gcn::Label("Description:");
- mItemEffectLabel = new gcn::Label("Effect:");
+ mBuyButton = new Button(_("Buy"), "buy", this);
+ mQuitButton = new Button(_("Quit"), "quit", this);
+ mItemDescLabel = new gcn::Label(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel = new gcn::Label(strprintf(_("Effect: %s"), ""));
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
@@ -156,6 +157,9 @@ void BuyDialog::action(const gcn::ActionEvent &event)
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
+ // TODO: Actually we'd have a bug elsewhere if this check for the number
+ // of items to be bought ever fails, Bertram removed the assertions, is
+ // there a better way to ensure this fails in an _obvious_ way in C++?
else if (event.getId() == "buy" && mAmountItems > 0 &&
mAmountItems <= mMaxItems)
{
@@ -242,8 +246,10 @@ BuyDialog::updateButtonsAndLabels()
{
const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
- mItemDescLabel->setCaption("Description: " + info.getDescription());
- mItemEffectLabel->setCaption("Effect: " + info.getEffect());
+ mItemDescLabel->setCaption
+ (strprintf(_("Description: %s"), info.getDescription().c_str()));
+ mItemEffectLabel->setCaption
+ (strprintf(_("Effect: %s"), info.getEffect().c_str()));
int itemPrice = mShopItems->at(selectedItem)->getPrice();
@@ -259,8 +265,8 @@ BuyDialog::updateButtonsAndLabels()
}
else
{
- mItemDescLabel->setCaption("Description:");
- mItemEffectLabel->setCaption("Effect:");
+ mItemDescLabel->setCaption(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel->setCaption(strprintf(_("Effect: %s"), ""));
mMaxItems = 0;
mAmountItems = 0;
}
@@ -272,8 +278,7 @@ BuyDialog::updateButtonsAndLabels()
mSlider->setEnabled(mMaxItems > 1);
// Update quantity and money labels
- mQuantityLabel->setCaption(
- toString(mAmountItems) + " / " + toString(mMaxItems));
- mMoneyLabel->setCaption("Price: " + toString(price) + " GP / "
- + toString(mMoney - price) + " GP" );
+ mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mMoneyLabel->setCaption
+ (strprintf(_("Price: %d GP / Total: %d GP"), price, mMoney - price));
}
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 6a52a745..c89dadcd 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -37,7 +37,8 @@
#include "../net/charserverhandler.h"
#include "../net/messageout.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/trim.h"
// Defined in main.cpp, used here for setting the char create dialog
@@ -56,8 +57,8 @@ class CharDeleteConfirm : public ConfirmDialog
};
CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m):
- ConfirmDialog("Confirm", "Are you sure you want to delete this character?",
- m),
+ ConfirmDialog(_("Confirm Character Delete"),
+ _("Are you sure you want to delete this character?"), m),
master(m)
{
}
@@ -74,21 +75,23 @@ void CharDeleteConfirm::action(const gcn::ActionEvent &event)
CharSelectDialog::CharSelectDialog(Network *network,
LockedArray<LocalPlayer*> *charInfo,
Gender gender):
- Window("Select Character"), mNetwork(network),
+ Window(_("Select Character")), mNetwork(network),
mCharInfo(charInfo), mGender(gender), mCharSelected(false)
{
- mSelectButton = new Button("Ok", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mNewCharButton = new Button("New", "new", this);
- mDelCharButton = new Button("Delete", "delete", this);
- mPreviousButton = new Button("Previous", "previous", this);
- mNextButton = new Button("Next", "next", this);
-
- mNameLabel = new gcn::Label("Name");
- mLevelLabel = new gcn::Label("Level");
- mJobLevelLabel = new gcn::Label("Job Level");
- mMoneyLabel = new gcn::Label("Money");
- mPlayerBox = new PlayerBox();
+ mSelectButton = new Button(_("Ok"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mNewCharButton = new Button(_("New"), "new", this);
+ mDelCharButton = new Button(_("Delete"), "delete", this);
+ mPreviousButton = new Button(_("Previous"), "previous", this);
+ mNextButton = new Button(_("Next"), "next", this);
+
+ mNameLabel = new gcn::Label(strprintf(_("Name: %s"), ""));
+ mLevelLabel = new gcn::Label(strprintf(_("Level: %d"), 0));
+ mJobLevelLabel = new gcn::Label(strprintf(_("Job Level: %d"), 0));
+ mMoneyLabel = new gcn::Label(strprintf(_("Money: %d"), 0));
+
+ // Control that shows the Player
+ mPlayerBox = new PlayerBox;
int w = 195;
int h = 220;
@@ -177,10 +180,10 @@ void CharSelectDialog::updatePlayerInfo()
if (pi)
{
- mNameLabel->setCaption(pi->getName());
- mLevelLabel->setCaption("Lvl: " + toString(pi->mLevel));
- mJobLevelLabel->setCaption("Job Lvl: " + toString(pi->mJobLevel));
- mMoneyLabel->setCaption("Gold: " + toString(pi->mGp));
+ mNameLabel->setCaption(strprintf(_("Name: %s"), pi->getName().c_str()));
+ mLevelLabel->setCaption(strprintf(_("Level: %d"), pi->mLevel));
+ mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), pi->mJobLevel));
+ mMoneyLabel->setCaption(strprintf(_("Gold: %d"), pi->mGp));
if (!mCharSelected)
{
mNewCharButton->setEnabled(false);
@@ -189,10 +192,10 @@ void CharSelectDialog::updatePlayerInfo()
}
}
else {
- mNameLabel->setCaption("Name");
- mLevelLabel->setCaption("Level");
- mJobLevelLabel->setCaption("Job Level");
- mMoneyLabel->setCaption("Money");
+ mNameLabel->setCaption(strprintf(_("Name: %s"), ""));
+ mLevelLabel->setCaption(strprintf(_("Level: %d"), 0));
+ mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), 0));
+ mMoneyLabel->setCaption(strprintf(_("Money: %d"), 0));
mNewCharButton->setEnabled(true);
mDelCharButton->setEnabled(false);
mSelectButton->setEnabled(false);
@@ -249,7 +252,7 @@ bool CharSelectDialog::selectByName(const std::string &name)
CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
Gender gender):
- Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
+ Window(_("Create Character"), true, parent), mNetwork(network), mSlot(slot)
{
mPlayer = new Player(0, 0, NULL);
mPlayer->setGender(gender);
@@ -259,15 +262,15 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
mPlayer->setHairStyle(rand() % mPlayer->getNumOfHairstyles(), rand() % numberOfHairColors);
mNameField = new TextField("");
- mNameLabel = new gcn::Label("Name:");
+ mNameLabel = new gcn::Label(_("Name:"));
mNextHairColorButton = new Button(">", "nextcolor", this);
mPrevHairColorButton = new Button("<", "prevcolor", this);
- mHairColorLabel = new gcn::Label("Hair Color:");
+ mHairColorLabel = new gcn::Label(_("Hair Color:"));
mNextHairStyleButton = new Button(">", "nextstyle", this);
mPrevHairStyleButton = new Button("<", "prevstyle", this);
- mHairStyleLabel = new gcn::Label("Hair Style:");
- mCreateButton = new Button("Create", "create", this);
- mCancelButton = new Button("Cancel", "cancel", this);
+ mHairStyleLabel = new gcn::Label(_("Hair Style:"));
+ mCreateButton = new Button(_("Create"), "create", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
mPlayerBox = new PlayerBox(mPlayer);
mNameField->setActionEventId("create");
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 054aff84..ff401332 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -30,6 +30,8 @@
#include "../net/network.h" // TODO this is just for iptostring, move that?
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
extern SERVER_INFO **server_info;
@@ -46,15 +48,15 @@ class ServerListModel : public gcn::ListModel {
};
ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState):
- Window("Select Server"),
+ Window(_("Select Server")),
mLoginData(loginData),
mNextState(nextState)
{
mServerListModel = new ServerListModel();
mServerList = new ListBox(mServerListModel);
ScrollArea *mScrollArea = new ScrollArea(mServerList);
- mOkButton = new Button("OK", "ok", this);
- Button *mCancelButton = new Button("Cancel", "cancel", this);
+ mOkButton = new Button(_("OK"), "ok", this);
+ Button *mCancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(200, 100);
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index 732f5769..72ce3e16 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -23,6 +23,8 @@
#include "confirm_dialog.h"
+#include "../utils/gettext.h"
+
ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
@@ -32,8 +34,8 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
mTextBox->setOpaque(false);
mTextArea = new ScrollArea(mTextBox);
- gcn::Button *yesButton = new Button("Yes", "yes", this);
- gcn::Button *noButton = new Button("No", "no", this);
+ gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
+ gcn::Button *noButton = new Button(_("No"), "no", this);
mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 1204b203..174d98e7 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -29,6 +29,8 @@
#include "../main.h"
+#include "../utils/gettext.h"
+
namespace {
struct ConnectionActionListener : public gcn::ActionListener
{
@@ -41,9 +43,9 @@ ConnectionDialog::ConnectionDialog():
{
setContentSize(200, 100);
- Button *cancelButton = new Button("Cancel", "cancelButton", &listener);
+ Button *cancelButton = new Button(_("Cancel"), "cancelButton", &listener);
mProgressBar = new ProgressBar(0.0, 200 - 10, 20, 128, 128, 128);
- gcn::Label *label = new gcn::Label("Connecting...");
+ gcn::Label *label = new gcn::Label(_("Connecting..."));
cancelButton->setPosition(5, 100 - 5 - cancelButton->getHeight());
mProgressBar->setPosition(5, cancelButton->getY() - 25);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index f1cbb0da..47ca61df 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -33,10 +33,12 @@
#include "../resources/iteminfo.h"
#include "../resources/resourcemanager.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
EquipmentWindow::EquipmentWindow(Equipment *equipment):
- Window("Equipment"), mEquipment(equipment)
+ Window(_("Equipment")),
+ mEquipment(equipment)
{
setWindowName("Equipment");
setCloseButton(true);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 621a85d3..8c5edec4 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -37,10 +37,12 @@
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
InventoryWindow::InventoryWindow():
- Window("Inventory")
+ Window(_("Inventory"))
{
setWindowName("Inventory");
setResizable(true);
@@ -49,8 +51,8 @@ InventoryWindow::InventoryWindow():
// If you adjust these defaults, don't forget to adjust the trade window's.
setDefaultSize(115, 25, 322, 200);
- mUseButton = new Button("Use", "use", this);
- mDropButton = new Button("Drop", "drop", this);
+ mUseButton = new Button(_("Use"), "use", this);
+ mDropButton = new Button(_("Drop"), "drop", this);
mItems = new ItemContainer(player_node->getInventory(), 2);
mItems->addSelectionListener(this);
@@ -61,14 +63,14 @@ InventoryWindow::InventoryWindow():
mTotalWeight = toString(player_node->mTotalWeight);
mMaxWeight = toString(player_node->mMaxWeight);
- mItemName = "Name:";
+ mItemName = _("Name:");
mItemNameLabel = new TextBox();
- mItemDescription = "Description:";
+ mItemDescription = _("Description:");
mItemDescriptionLabel = new TextBox();
- mItemEffect = "Effect:";
+ mItemEffect = _("Effect:");
mItemEffectLabel = new TextBox();
- mWeight = "Weight: " + mTotalWeight + " g / " +
- mMaxWeight + " g Slots: " +
+ mWeight = _("Weight: ") + mTotalWeight + " g / " +
+ mMaxWeight + _(" g Slots: ") +
toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
"/" + toString(player_node->getInventory()->getInventorySize());
mWeightLabel = new TextBox();
@@ -105,8 +107,8 @@ void InventoryWindow::logic()
mMaxWeight = toString(player_node->mMaxWeight);
// Adjust widgets
- mWeight = "Weight: " + mTotalWeight + " g / " +
- mMaxWeight + " g Slots: " +
+ mWeight = _("Weight: ") + mTotalWeight + " g / " +
+ mMaxWeight + _(" g Slots: ") +
toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
"/" + toString(player_node->getInventory()->getInventorySize());
@@ -153,21 +155,21 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event)
// Update name, effect and description
if (!item)
{
- mItemName = "Name:";
+ mItemName = _("Name:");
mItemNameLabel->setTextWrapped(mItemName);
- mItemEffect = "Effect:";
+ mItemEffect = _("Effect:");
mItemEffectLabel->setTextWrapped(mItemEffect);
- mItemDescription = "Description:";
+ mItemDescription = _("Description:");
mItemDescriptionLabel->setTextWrapped(mItemDescription);
}
else
{
const ItemInfo& itemInfo = item->getInfo();
- mItemName = "Name: " + itemInfo.getName();
+ mItemName = _("Name: ") + itemInfo.getName();
mItemNameLabel->setTextWrapped(mItemName);
- mItemEffect = "Effect: " + itemInfo.getEffect();
+ mItemEffect = _("Effect: ") + itemInfo.getEffect();
mItemEffectLabel->setTextWrapped(mItemEffect);
- mItemDescription = "Description: " + itemInfo.getDescription();
+ mItemDescription = _("Description: ") + itemInfo.getDescription();
mItemDescriptionLabel->setTextWrapped(mItemDescription);
}
@@ -182,7 +184,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
Item *item = mItems->getSelectedItem();
- if (!item) return;
+ if (!item)
+ return;
/* Convert relative to the window coordinates to absolute screen
* coordinates.
@@ -249,14 +252,14 @@ void InventoryWindow::updateButtons()
if (selectedItem && selectedItem->isEquipment())
{
if (selectedItem->isEquipped()) {
- mUseButton->setCaption("Unequip");
+ mUseButton->setCaption(_("Unequip"));
}
else {
- mUseButton->setCaption("Equip");
+ mUseButton->setCaption(_("Equip"));
}
}
else {
- mUseButton->setCaption("Use");
+ mUseButton->setCaption(_("Use"));
}
mUseButton->setEnabled(selectedItem != 0);
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index 4ce8ac6c..191c7b8b 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -28,31 +28,33 @@
#include "../item.h"
#include "../localplayer.h"
+#include "../utils/gettext.h"
+
ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
- Window("Select amount of items to drop.", true, parent),
+ Window("", true, parent),
mItem(item)
{
- // New labels
+ // Integer field
mItemAmountTextBox = new IntTextBox(1);
-
- // New buttons
- Button *minusButton = new Button("-", "Minus", this);
- Button *plusButton = new Button("+", "Plus", this);
- Button *okButton = new Button("Okay", "Drop", this);
- Button *cancelButton = new Button("Cancel", "Cancel", this);
- mItemAmountSlide = new Slider(1.0, mItem->getQuantity());
-
mItemAmountTextBox->setRange(1, mItem->getQuantity());
- mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10));
- // Set button events Id
+ // Slider
+ mItemAmountSlide = new Slider(1.0, mItem->getQuantity());
mItemAmountSlide->setActionEventId("Slide");
+ mItemAmountSlide->addActionListener(this);
+
+ // Buttons
+ Button *minusButton = new Button("-", "Minus", this);
+ Button *plusButton = new Button("+", "Plus", this);
+ Button *okButton = new Button(_("Ok"), "Drop", this);
+ Button *cancelButton = new Button(_("Cancel"), "Cancel", this);
- // Set position
+ // Set positions
mItemAmountTextBox->setPosition(35, 10);
mItemAmountTextBox->setSize(24, 16);
plusButton->setPosition(60, 5);
minusButton->setPosition(10, 5);
+ mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10));
mItemAmountSlide->setPosition(10, 35);
okButton->setPosition(10, 50);
cancelButton->setPosition(60, 50);
@@ -65,17 +67,15 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
add(okButton);
add(cancelButton);
- mItemAmountSlide->addActionListener(this);
-
resetAmount();
switch (usage) {
case AMOUNT_TRADE_ADD:
- setCaption("Select amount of items to trade.");
+ setCaption(_("Select amount of items to trade."));
okButton->setActionEventId("AddTrade");
break;
case AMOUNT_ITEM_DROP:
- setCaption("Select amount of items to drop.");
+ setCaption(_("Select amount of items to drop."));
okButton->setActionEventId("Drop");
break;
default:
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index fa47af32..8fd77f44 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -35,6 +35,7 @@
#include "../logindata.h"
#include "../configuration.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
static const int MAX_SERVER_LIST_SIZE = 5;
@@ -43,13 +44,13 @@ static const int LOGIN_DIALOG_HEIGHT = 140;
static const int FIELD_WIDTH = LOGIN_DIALOG_WIDTH - 70;
LoginDialog::LoginDialog(LoginData *loginData):
- Window("Login"), mLoginData(loginData)
+ Window(_("Login")), mLoginData(loginData)
{
- gcn::Label *userLabel = new gcn::Label("Name:");
- gcn::Label *passLabel = new gcn::Label("Password:");
- gcn::Label *serverLabel = new gcn::Label("Server:");
- gcn::Label *portLabel = new gcn::Label("Port:");
- gcn::Label *dropdownLabel = new gcn::Label("Recent:");
+ gcn::Label *userLabel = new gcn::Label(_("Name:"));
+ gcn::Label *passLabel = new gcn::Label(_("Password:"));
+ gcn::Label *serverLabel = new gcn::Label(_("Server:"));
+ gcn::Label *portLabel = new gcn::Label(_("Port:"));
+ gcn::Label *dropdownLabel = new gcn::Label(_("Recent:"));
std::vector<std::string> dfltServer;
dfltServer.push_back("www.aethyra.org");
dfltServer.push_back("www.aethyra.org");
@@ -69,10 +70,10 @@ LoginDialog::LoginDialog(LoginData *loginData):
mServerScrollArea,
mServerListBox);
- mKeepCheck = new CheckBox("Keep", mLoginData->remember);
- mOkButton = new Button("OK", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mRegisterButton = new Button("Register", "register", this);
+ mKeepCheck = new CheckBox(_("Keep"), mLoginData->remember);
+ mOkButton = new Button(_("OK"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mRegisterButton = new Button(_("Register"), "register", this);
setContentSize(LOGIN_DIALOG_WIDTH, LOGIN_DIALOG_HEIGHT);
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index 56bc48fd..99eaca34 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -27,6 +27,8 @@
#include "menuwindow.h"
#include "windowcontainer.h"
+#include "../utils/gettext.h"
+
extern Window *chatWindow;
extern Window *equipmentWindow;
extern Window *inventoryWindow;
@@ -55,23 +57,23 @@ MenuWindow::MenuWindow():
setTitleBarHeight(0);
// Buttons
- const char *buttonNames[] =
+ static const char *buttonNames[] =
{
- "Chat",
- "Status",
- "Equipment",
- "Inventory",
- "Skills",
- "Shortcut",
- "Emote",
- "Setup",
+ _("Chat"),
+ _("Status"),
+ _("Equipment"),
+ _("Inventory"),
+ _("Skills"),
+ _("Shortcut"),
+ _("Emote"),
+ _("Setup"),
0
};
int x = 0, h = 0;
for (const char **curBtn = buttonNames; *curBtn; curBtn++)
{
- gcn::Button *btn = new Button(*curBtn, *curBtn, &listener);
+ gcn::Button *btn = new Button(gettext(*curBtn), *curBtn, &listener);
btn->setPosition(x, 0);
add(btn);
x += btn->getWidth() + 3;
@@ -92,35 +94,35 @@ void MenuWindowListener::action(const gcn::ActionEvent &event)
{
Window *window = NULL;
- if (event.getId() == "Chat")
+ if (event.getId() == _("Chat"))
{
window = chatWindow;
}
- else if (event.getId() == "Status")
+ else if (event.getId() == _("Status"))
{
window = statusWindow;
}
- else if (event.getId() == "Equipment")
+ else if (event.getId() == _("Equipment"))
{
window = equipmentWindow;
}
- else if (event.getId() == "Inventory")
+ else if (event.getId() == _("Inventory"))
{
window = inventoryWindow;
}
- else if (event.getId() == "Skills")
+ else if (event.getId() == _("Skills"))
{
window = skillDialog;
}
- else if (event.getId() == "Shortcut")
+ else if (event.getId() == _("Shortcut"))
{
window = itemShortcutWindow;
}
- else if (event.getId() == "Emote")
+ else if (event.getId() == _("Emote"))
{
window = smileyWindow;
}
- else if (event.getId() == "Setup")
+ else if (event.getId() == _("Setup"))
{
window = setupWindow;
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index fddd5199..8519b985 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -28,13 +28,15 @@
#include "../resources/image.h"
+#include "../utils/gettext.h"
+
Minimap::Minimap():
- Window("Map"),
+ Window(_("Map")),
mMapImage(NULL),
mProportion(0.5)
{
setCloseButton(true);
- setWindowName("MiniMap");
+ setWindowName(_("MiniMap"));
}
Minimap::~Minimap()
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index b53de828..0570d7a9 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -26,8 +26,10 @@
#include "../npc.h"
+#include "../utils/gettext.h"
+
NpcTextDialog::NpcTextDialog():
- Window("NPC")
+ Window(_("NPC"))
{
setResizable(true);
@@ -38,7 +40,7 @@ NpcTextDialog::NpcTextDialog():
mTextBox->setEditable(false);
scrollArea = new ScrollArea(mTextBox);
- okButton = new Button("OK", "ok", this);
+ okButton = new Button(_("OK"), "ok", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index c17cd4aa..34b5ab41 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -26,8 +26,10 @@
#include "../npc.h"
+#include "../utils/gettext.h"
+
NpcListDialog::NpcListDialog():
- Window("NPC")
+ Window(_("NPC"))
{
setResizable(true);
@@ -36,8 +38,8 @@ NpcListDialog::NpcListDialog():
mItemList = new ListBox(this);
scrollArea = new ScrollArea(mItemList);
- okButton = new Button("OK", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
+ okButton = new Button(_("OK"), "ok", this);
+ cancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index 421c873e..ad7b879c 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -23,6 +23,8 @@
#include <guichan/font.hpp>
+#include "../utils/gettext.h"
+
OkDialog::OkDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
@@ -32,7 +34,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
mTextBox->setOpaque(false);
mTextArea = new ScrollArea(mTextBox);
- okButton = new Button("Ok", "ok", this);
+ okButton = new Button(_("Ok"), "ok", this);
mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index c0feb68d..2b2eb625 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -43,6 +43,9 @@
#include "../resources/itemdb.h"
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
extern std::string tradePartnerName;
PopupMenu::PopupMenu():
@@ -75,35 +78,35 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// Players can be traded with. Later also attack, follow and
// add as buddy will be options in this menu.
const std::string &name = mBeing->getName();
- mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
- mBrowserBox->addRow("@@attack|Attack " + name + "@@");
+ mBrowserBox->addRow(_("@@trade|Trade With ") + name + "@@");
+ mBrowserBox->addRow(_("@@attack|Attack ") + name + "@@");
mBrowserBox->addRow("##3---");
switch (player_relations.getRelation(name)) {
case PlayerRelation::NEUTRAL:
- mBrowserBox->addRow("@@friend|Befriend " + name + "@@");
+ mBrowserBox->addRow(_("@@friend|Befriend ") + name + "@@");
case PlayerRelation::FRIEND:
- mBrowserBox->addRow("@@disregard|Disregard " + name + "@@");
- mBrowserBox->addRow("@@ignore|Ignore " + name + "@@");
+ mBrowserBox->addRow(_("@@disregard|Disregard ") + name + "@@");
+ mBrowserBox->addRow(_("@@ignore|Ignore ") + name + "@@");
break;
case PlayerRelation::DISREGARDED:
- mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
- mBrowserBox->addRow("@@ignore|Completely ignore " + name + "@@");
+ mBrowserBox->addRow(_("@@unignore|Un-Ignore ") + name + "@@");
+ mBrowserBox->addRow(_("@@ignore|Completely ignore ") + name + "@@");
break;
case PlayerRelation::IGNORED:
- mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
+ mBrowserBox->addRow(_("@@unignore|Un-Ignore ") + name + "@@");
break;
}
- //mBrowserBox->addRow("@@follow|Follow " + name + "@@");
- //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
+ //mBrowserBox->addRow(_("@@follow|Follow ") + name + "@@");
+ //mBrowserBox->addRow(_("@@buddy|Add ") + name + " to Buddy List@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@party-invite|Invite " + name +
+ mBrowserBox->addRow(_("@@party-invite|Invite ") + name +
" to party@@");
}
break;
@@ -111,7 +114,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
case Being::NPC:
// NPCs can be talked to (single option, candidate for removal
// unless more options would be added)
- mBrowserBox->addRow("@@talk|Talk To NPC@@");
+ mBrowserBox->addRow(_("@@talk|Talk To NPC@@"));
break;
default:
@@ -121,7 +124,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
//browserBox->addRow("@@look|Look To@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
@@ -133,11 +136,11 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
// Floor item can be picked up (single option, candidate for removal)
std::string name = ItemDB::get(mFloorItem->getItemId()).getName();
- mBrowserBox->addRow("@@pickup|Pick Up " + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@pickup|Pick Up %s@@"), name.c_str()));
//browserBox->addRow("@@look|Look To@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
@@ -285,18 +288,18 @@ void PopupMenu::showPopup(int x, int y, Item *item)
if (item->isEquipment())
{
- if (item->isEquipped())
- mBrowserBox->addRow("@@use|Unequip@@");
- else
- mBrowserBox->addRow("@@use|Equip@@");
+ if (item->isEquipped())
+ mBrowserBox->addRow(_("@@use|Unequip@@"));
+ else
+ mBrowserBox->addRow(_("@@use|Equip@@"));
}
else
- mBrowserBox->addRow("@@use|Use@@");
+ mBrowserBox->addRow(_("@@use|Use@@"));
- mBrowserBox->addRow("@@drop|Drop@@");
- mBrowserBox->addRow("@@description|Description@@");
+ mBrowserBox->addRow(_("@@drop|Drop@@"));
+ mBrowserBox->addRow(_("@@description|Description@@"));
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index ec6a9756..5d687425 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -40,6 +40,9 @@
#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
void
WrongDataNoticeListener::setTarget(gcn::TextField *textField)
{
@@ -56,25 +59,24 @@ WrongDataNoticeListener::action(const gcn::ActionEvent &event)
}
RegisterDialog::RegisterDialog(LoginData *loginData):
- Window("Register"),
+ Window(_("Register")),
mWrongDataNoticeListener(new WrongDataNoticeListener()),
mLoginData(loginData)
{
- gcn::Label *userLabel = new gcn::Label("Name:");
- gcn::Label *passwordLabel = new gcn::Label("Password:");
- gcn::Label *confirmLabel = new gcn::Label("Confirm:");
- gcn::Label *serverLabel = new gcn::Label("Server:");
- gcn::Label *portLabel = new gcn::Label("Port:");
-
+ gcn::Label *userLabel = new gcn::Label(_("Name:"));
+ gcn::Label *passwordLabel = new gcn::Label(_("Password:"));
+ gcn::Label *confirmLabel = new gcn::Label(_("Confirm:"));
+ gcn::Label *serverLabel = new gcn::Label(_("Server:"));
+ gcn::Label *portLabel = new gcn::Label(_("Port:"));
mUserField = new TextField(loginData->username);
mPasswordField = new PasswordField(loginData->password);
mConfirmField = new PasswordField();
mServerField = new TextField(loginData->hostname);
mPortField = new TextField(toString(loginData->port));
- mMaleButton = new RadioButton("Male", "sex", true);
- mFemaleButton = new RadioButton("Female", "sex", false);
- mRegisterButton = new Button("Register", "register", this);
- mCancelButton = new Button("Cancel", "cancel", this);
+ mMaleButton = new RadioButton(_("Male"), "sex", true);
+ mFemaleButton = new RadioButton(_("Female"), "sex", false);
+ mRegisterButton = new Button(_("Register"), "register", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
const int WIDTH = 220;
const int HEIGHT = 170;
@@ -181,47 +183,47 @@ RegisterDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "register" && canSubmit())
{
const std::string user = mUserField->getText();
- logger->log("RegisterDialog::register Username is %s", user.c_str());
+ logger->log(_("RegisterDialog::register Username is %s"), user.c_str());
- std::stringstream errorMsg;
+ std::string errorMsg;
int error = 0;
if (user.length() < LEN_MIN_USERNAME)
{
// Name too short
- errorMsg << "The username needs to be at least "
- << LEN_MIN_USERNAME
- << " characters long.";
+ errorMsg = strprintf
+ (_("The username needs to be at least %d characters long."),
+ LEN_MIN_USERNAME);
error = 1;
}
else if (user.length() > LEN_MAX_USERNAME - 1 )
{
// Name too long
- errorMsg << "The username needs to be less than "
- << LEN_MAX_USERNAME
- << " characters long.";
+ errorMsg = strprintf
+ (_("The username needs to be less than %d characters long."),
+ LEN_MAX_USERNAME);
error = 1;
}
else if (mPasswordField->getText().length() < LEN_MIN_PASSWORD)
{
// Pass too short
- errorMsg << "The password needs to be at least "
- << LEN_MIN_PASSWORD
- << " characters long.";
+ errorMsg = strprintf
+ (_("The password needs to be at least %d characters long."),
+ LEN_MIN_PASSWORD);
error = 2;
}
else if (mPasswordField->getText().length() > LEN_MAX_PASSWORD - 1 )
{
// Pass too long
- errorMsg << "The password needs to be less than "
- << LEN_MAX_PASSWORD
- << " characters long.";
+ errorMsg = strprintf
+ (_("The password needs to be less than %d characters long."),
+ LEN_MAX_PASSWORD);
error = 2;
}
else if (mPasswordField->getText() != mConfirmField->getText())
{
// Password does not match with the confirmation one
- errorMsg << "Passwords do not match.";
+ errorMsg = _("Passwords do not match.");
error = 2;
}
@@ -240,8 +242,8 @@ RegisterDialog::action(const gcn::ActionEvent &event)
mWrongDataNoticeListener->setTarget(this->mPasswordField);
}
- OkDialog *mWrongRegisterNotice = new OkDialog("Error",
- errorMsg.str());
+ OkDialog *mWrongRegisterNotice =
+ new OkDialog(_("Error"), errorMsg);
mWrongRegisterNotice->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 63af1aaa..567fa59c 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -38,10 +38,12 @@
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
SellDialog::SellDialog(Network *network):
- Window("Sell"),
+ Window(_("Sell")),
mNetwork(network),
mMaxItems(0), mAmountItems(0)
{
@@ -57,13 +59,14 @@ SellDialog::SellDialog(Network *network):
mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label("Money: 0 GP / Total: 0 GP");
+ mMoneyLabel = new gcn::Label(
+ strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
- mSellButton = new Button("Sell", "sell", this);
- mQuitButton = new Button("Quit", "quit", this);
- mItemDescLabel = new gcn::Label("Description:");
- mItemEffectLabel = new gcn::Label("Effect:");
+ mSellButton = new Button(_("Sell"), "sell", this);
+ mQuitButton = new Button(_("Quit"), "quit", this);
+ mItemDescLabel = new gcn::Label(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel = new gcn::Label(strprintf(_("Effect: %s"), ""));
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
@@ -260,14 +263,19 @@ void SellDialog::setMoney(int amount)
mShopItemList->setPlayersMoney(amount);
}
-void
-SellDialog::updateButtonsAndLabels()
+void SellDialog::updateButtonsAndLabels()
{
int selectedItem = mShopItemList->getSelected();
int income = 0;
if (selectedItem > -1)
{
+ const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
+ mItemDescLabel->setCaption
+ (strprintf(_("Description: %s"), info.getDescription().c_str()));
+ mItemEffectLabel->setCaption
+ (strprintf(_("Effect: %s"), info.getEffect().c_str()));
+
mMaxItems = mShopItems->at(selectedItem)->getQuantity();
if (mAmountItems > mMaxItems)
{
@@ -275,17 +283,13 @@ SellDialog::updateButtonsAndLabels()
}
income = mAmountItems * mShopItems->at(selectedItem)->getPrice();
-
- const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
- mItemDescLabel->setCaption("Description: " + info.getDescription());
- mItemEffectLabel->setCaption("Effect: " + info.getEffect());
}
else
{
+ mItemDescLabel->setCaption(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel->setCaption(strprintf(_("Effect: %s"), ""));
mMaxItems = 0;
mAmountItems = 0;
- mItemDescLabel->setCaption("Description:");
- mItemEffectLabel->setCaption("Effect:");
}
// Update Buttons and slider
@@ -295,8 +299,8 @@ SellDialog::updateButtonsAndLabels()
mSlider->setEnabled(mMaxItems > 1);
// Update the quantity and money labels
- mQuantityLabel->setCaption(
- toString(mAmountItems) + " / " + toString(mMaxItems));
- mMoneyLabel->setCaption("Money: " + toString(income) + " GP / Total: "
- + toString(mPlayerMoney + income) + " GP");
+ mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mMoneyLabel->setCaption
+ (strprintf(_("Price: %d GP / Total: %d GP"),
+ income, mPlayerMoney + income));
}
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index a61d3bb2..73023eba 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -33,6 +33,7 @@
#include "tabbedcontainer.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
extern Window *chatWindow;
extern Window *equipmentWindow;
@@ -52,19 +53,19 @@ Setup::Setup():
int height = 310;
setContentSize(width, height);
- const char *buttonNames[] = {
- "Apply", "Cancel", "Reset Windows", 0
+ static const char *buttonNames[] = {
+ N_("Apply"), N_("Cancel"), N_("Reset Windows"), 0
};
int x = width;
for (const char **curBtn = buttonNames; *curBtn; ++curBtn)
{
- Button *btn = new Button(*curBtn, *curBtn, this);
+ Button *btn = new Button(gettext(*curBtn), *curBtn, this);
x -= btn->getWidth() + 5;
btn->setPosition(x, height - btn->getHeight() - 5);
add(btn);
// Disable this button when the windows aren't created yet
- if (!strcmp(*curBtn, "Reset Windows"))
+ if (!strcmp(*curBtn, _("Reset Windows")))
btn->setEnabled(statusWindow != NULL);
}
@@ -75,27 +76,27 @@ Setup::Setup():
SetupTab *tab;
tab = new Setup_Video();
- panel->addTab(tab, "Video");
+ panel->addTab(tab, _("Video"));
mTabs.push_back(tab);
tab = new Setup_Audio();
- panel->addTab(tab, "Audio");
+ panel->addTab(tab, _("Audio"));
mTabs.push_back(tab);
tab = new Setup_Joystick();
- panel->addTab(tab, "Joystick");
+ panel->addTab(tab, _("Joystick"));
mTabs.push_back(tab);
tab = new Setup_Keyboard();
- panel->addTab(tab, "Keyboard");
+ panel->addTab(tab, _("Keyboard"));
mTabs.push_back(tab);
tab = new Setup_Colours();
- panel->addTab(tab, "Colours");
+ panel->addTab(tab, _("Colours"));
mTabs.push_back(tab);
tab = new Setup_Players();
- panel->addTab(tab, "Players");
+ panel->addTab(tab, _("Players"));
mTabs.push_back(tab);
add(panel);
@@ -110,17 +111,17 @@ Setup::~Setup()
void Setup::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "Apply")
+ if (event.getId() == _("Apply"))
{
setVisible(false);
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply));
}
- else if (event.getId() == "Cancel")
+ else if (event.getId() == _("Cancel"))
{
setVisible(false);
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel));
}
- else if (event.getId() == "Reset Windows")
+ else if (event.getId() == _("Reset Windows"))
{
// Bail out if this action happens to be activated before the windows
// are created (though it should be disabled then)
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 70b34a31..bb824f33 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -30,18 +30,20 @@
#include "../log.h"
#include "../sound.h"
+#include "../utils/gettext.h"
+
Setup_Audio::Setup_Audio():
mMusicVolume((int)config.getValue("musicVolume", 60)),
mSfxVolume((int)config.getValue("sfxVolume", 100)),
mSoundEnabled(config.getValue("sound", 0)),
- mSoundCheckBox(new CheckBox("Sound", mSoundEnabled)),
+ mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)),
mSfxSlider(new Slider(0, 128)),
mMusicSlider(new Slider(0, 128))
{
setOpaque(false);
- gcn::Label *sfxLabel = new gcn::Label("Sfx volume");
- gcn::Label *musicLabel = new gcn::Label("Music volume");
+ gcn::Label *sfxLabel = new gcn::Label(_("Sfx volume"));
+ gcn::Label *musicLabel = new gcn::Label(_("Music volume"));
mSfxSlider->setActionEventId("sfx");
mMusicSlider->setActionEventId("music");
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 723d0597..b55ccb7e 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -28,12 +28,14 @@
#include "../configuration.h"
#include "../joystick.h"
+#include "../utils/gettext.h"
+
extern Joystick *joystick;
Setup_Joystick::Setup_Joystick():
- mCalibrateLabel(new gcn::Label("Press the button to start calibration")),
- mCalibrateButton(new Button("Calibrate", "calibrate", this)),
- mJoystickEnabled(new CheckBox("Enable joystick"))
+ mCalibrateLabel(new gcn::Label(_("Press the button to start calibration"))),
+ mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
+ mJoystickEnabled(new CheckBox(_("Enable joystick")))
{
setOpaque(false);
mJoystickEnabled->setPosition(10, 10);
@@ -63,13 +65,13 @@ void Setup_Joystick::action(const gcn::ActionEvent &event)
else
{
if (joystick->isCalibrating()) {
- mCalibrateButton->setCaption("Calibrate");
- mCalibrateLabel->setCaption(
- "Press the button to start calibration");
+ mCalibrateButton->setCaption(_("Calibrate"));
+ mCalibrateLabel->setCaption
+ (_("Press the button to start calibration"));
joystick->finishCalibration();
} else {
- mCalibrateButton->setCaption("Stop");
- mCalibrateLabel->setCaption("Rotate the stick");
+ mCalibrateButton->setCaption(_("Stop"));
+ mCalibrateLabel->setCaption(_("Rotate the stick"));
joystick->startCalibration();
}
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 2e620095..f53a9716 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -42,6 +42,7 @@
#include "../main.h"
#include "../particle.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
extern Graphics *graphics;
@@ -109,13 +110,13 @@ Setup_Video::Setup_Video():
mFps((int) config.getValue("fpslimit", 0)),
mModeListModel(new ModeListModel),
mModeList(new ListBox(mModeListModel)),
- mFsCheckBox(new CheckBox("Full screen", mFullScreenEnabled)),
- mOpenGLCheckBox(new CheckBox("OpenGL", mOpenGLEnabled)),
- mCustomCursorCheckBox(new CheckBox("Custom cursor", mCustomCursorEnabled)),
- mParticleEffectsCheckBox(new CheckBox("Particle effects", mParticleEffectsEnabled)),
- mSpeechBubbleCheckBox(new CheckBox("Speech bubbles", mSpeechBubbleEnabled)),
+ mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
+ mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)),
+ mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)),
+ mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)),
+ mSpeechBubbleCheckBox(new CheckBox(_("Speech bubbles"), mSpeechBubbleEnabled)),
mAlphaSlider(new Slider(0.2, 1.0)),
- mFpsCheckBox(new CheckBox("FPS Limit: ")),
+ mFpsCheckBox(new CheckBox(_("FPS Limit:"))),
mFpsSlider(new Slider(10, 200)),
mFpsField(new TextField),
mOriginalScrollLaziness((int) config.getValue("ScrollLaziness", 16)),
@@ -134,7 +135,7 @@ Setup_Video::Setup_Video():
setOpaque(false);
ScrollArea *scrollArea = new ScrollArea(mModeList);
- gcn::Label *alphaLabel = new gcn::Label("Gui opacity");
+ gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity"));
mModeList->setEnabled(true);
#ifndef USE_OPENGL
@@ -199,7 +200,7 @@ Setup_Video::Setup_Video():
mParticleDetailField->addKeyListener(this);
mScrollRadiusSlider->setDimension(gcn::Rectangle(10, 140, 75, 10));
- gcn::Label *scrollRadiusLabel = new gcn::Label("Scroll radius");
+ gcn::Label *scrollRadiusLabel = new gcn::Label(_("Scroll radius"));
scrollRadiusLabel->setPosition(90, 140);
mScrollRadiusField->setPosition(mFpsField->getX(), 140);
mScrollRadiusField->setWidth(30);
@@ -207,7 +208,7 @@ Setup_Video::Setup_Video():
mScrollRadiusSlider->setValue(mOriginalScrollRadius);
mScrollLazinessSlider->setDimension(gcn::Rectangle(10, 160, 75, 10));
- gcn::Label *scrollLazinessLabel = new gcn::Label("Scroll laziness");
+ gcn::Label *scrollLazinessLabel = new gcn::Label(_("Scroll laziness"));
scrollLazinessLabel->setPosition(90, 160);
mScrollLazinessField->setPosition(mFpsField->getX(), 160);
mScrollLazinessField->setWidth(30);
@@ -215,42 +216,42 @@ Setup_Video::Setup_Video():
mScrollLazinessSlider->setValue(mOriginalScrollLaziness);
mOverlayDetailSlider->setDimension(gcn::Rectangle(10, 180, 75, 10));
- gcn::Label *overlayDetailLabel = new gcn::Label("Ambient FX");
+ gcn::Label *overlayDetailLabel = new gcn::Label(_("Ambient FX"));
overlayDetailLabel->setPosition(90, 180);
mOverlayDetailField->setPosition(180, 180);
mOverlayDetailField->setWidth(30);
switch (mOverlayDetail)
{
case 0:
- mOverlayDetailField->setCaption("off");
+ mOverlayDetailField->setCaption(_("off"));
break;
case 1:
- mOverlayDetailField->setCaption("low");
+ mOverlayDetailField->setCaption(_("low"));
break;
case 2:
- mOverlayDetailField->setCaption("high");
+ mOverlayDetailField->setCaption(_("high"));
break;
}
mOverlayDetailSlider->setValue(mOverlayDetail);
mParticleDetailSlider->setDimension(gcn::Rectangle(10, 200, 75, 10));
- gcn::Label *particleDetailLabel = new gcn::Label("Particle Detail");
+ gcn::Label *particleDetailLabel = new gcn::Label(_("Particle Detail"));
particleDetailLabel->setPosition(90, 200);
mParticleDetailField->setPosition(180, 200);
mParticleDetailField->setWidth(60);
switch (mParticleDetail)
{
case 0:
- mParticleDetailField->setCaption("low");
+ mParticleDetailField->setCaption(_("low"));
break;
case 1:
- mParticleDetailField->setCaption("medium");
+ mParticleDetailField->setCaption(_("medium"));
break;
case 2:
- mParticleDetailField->setCaption("high");
+ mParticleDetailField->setCaption(_("high"));
break;
case 3:
- mParticleDetailField->setCaption("max");
+ mParticleDetailField->setCaption(_("max"));
break;
}
mParticleDetailSlider->setValue(mParticleDetail);
@@ -309,17 +310,17 @@ void Setup_Video::apply()
if (!graphics->setFullscreen(fullscreen))
{
std::stringstream error;
- error << "Failed to switch to " <<
- (fullscreen ? "windowed" : "fullscreen") <<
- "mode and restoration of old mode also failed!" <<
+ error << _("Failed to switch to ") <<
+ (fullscreen ? _("windowed") : _("fullscreen")) <<
+ _("mode and restoration of old mode also failed!") <<
std::endl;
logger->error(error.str());
}
}
#ifdef WIN32
} else {
- new OkDialog("Switching to full screen",
- "Restart needed for changes to take effect.");
+ new OkDialog(_("Switching to full screen"),
+ _("Restart needed for changes to take effect."));
}
#endif
config.setValue("screen", fullscreen ? 1 : 0);
@@ -331,8 +332,8 @@ void Setup_Video::apply()
config.setValue("opengl", mOpenGLCheckBox->isSelected() ? 1 : 0);
// OpenGL can currently only be changed by restarting, notify user.
- new OkDialog("Changing OpenGL",
- "Applying change to OpenGL requires restart.");
+ new OkDialog(_("Changing OpenGL"),
+ _("Applying change to OpenGL requires restart."));
}
// FPS change
@@ -405,8 +406,8 @@ void Setup_Video::action(const gcn::ActionEvent &event)
// Try to set the desired video mode
if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel))
{
- std::cerr << "Couldn't set "
- << width << "x" << height << "x" << bpp << " video mode: "
+ std::cerr << _("Couldn't set ")
+ << width << "x" << height << "x" << bpp << _(" video mode: ")
<< SDL_GetError() << std::endl;
exit(1);
}
@@ -417,8 +418,8 @@ void Setup_Video::action(const gcn::ActionEvent &event)
graphics->updateScreen();
// TODO: Find out why the drawing area doesn't resize without a restart.
- new OkDialog("Screen resolution changed",
- "Restart your client for the change to take effect.");
+ new OkDialog(_("Screen resolution changed"),
+ _("Restart your client for the change to take effect."));
config.setValue("screenwidth", width);
config.setValue("screenheight", height);
@@ -436,8 +437,8 @@ void Setup_Video::action(const gcn::ActionEvent &event)
{
config.setValue("particleeffects",
mParticleEffectsCheckBox->isSelected() ? 1 : 0);
- new OkDialog("Particle effect settings changed",
- "Restart your client or change maps for the change to take effect.");
+ new OkDialog(_("Particle effect settings changed"),
+ _("Restart your client or change maps for the change to take effect."));
}
else if (event.getId() == "speechbubble")
{
@@ -467,13 +468,13 @@ void Setup_Video::action(const gcn::ActionEvent &event)
switch (val)
{
case 0:
- mOverlayDetailField->setCaption("off");
+ mOverlayDetailField->setCaption(_("off"));
break;
case 1:
- mOverlayDetailField->setCaption("low");
+ mOverlayDetailField->setCaption(_("low"));
break;
case 2:
- mOverlayDetailField->setCaption("high");
+ mOverlayDetailField->setCaption(_("high"));
break;
}
config.setValue("OverlayDetail", val);
@@ -484,16 +485,16 @@ void Setup_Video::action(const gcn::ActionEvent &event)
switch (val)
{
case 0:
- mParticleDetailField->setCaption("low");
+ mParticleDetailField->setCaption(_("low"));
break;
case 1:
- mParticleDetailField->setCaption("medium");
+ mParticleDetailField->setCaption(_("medium"));
break;
case 2:
- mParticleDetailField->setCaption("high");
+ mParticleDetailField->setCaption(_("high"));
break;
case 3:
- mParticleDetailField->setCaption("max");
+ mParticleDetailField->setCaption(_("max"));
break;
}
config.setValue("particleEmitterSkip", 3 - val);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index bae8daa6..4546cd9e 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -41,6 +41,8 @@
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
TradeWindow::TradeWindow(Network *network):
@@ -56,10 +58,10 @@ TradeWindow::TradeWindow(Network *network):
setMinWidth(342);
setMinHeight(209);
- mAddButton = new Button("Add", "add", this);
- mOkButton = new Button("Ok", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mTradeButton = new Button("Trade", "trade", this);
+ mAddButton = new Button(_("Add"), "add", this);
+ mOkButton = new Button(_("Ok"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mTradeButton = new Button(_("Trade"), "trade", this);
mMyItemContainer = new ItemContainer(mMyInventory.get(), 2);
mMyItemContainer->addSelectionListener(this);
@@ -75,8 +77,8 @@ TradeWindow::TradeWindow(Network *network):
mPartnerScroll = new ScrollArea(mPartnerItemContainer);
mPartnerScroll->setPosition(8, 64);
- mMoneyLabel = new gcn::Label("You get: 0 GP");
- mMoneyLabel2 = new gcn::Label("You give:");
+ mMoneyLabel = new gcn::Label(strprintf(_("You get %d GP."), 0));
+ mMoneyLabel2 = new gcn::Label(_("You give:"));
mMoneyField = new TextField;
mMoneyField->setWidth(50);
@@ -87,8 +89,9 @@ TradeWindow::TradeWindow(Network *network):
mTradeButton->setEnabled(false);
- mItemNameLabel = new gcn::Label("Name:");
- mItemDescriptionLabel = new gcn::Label("Description:");
+ mItemNameLabel = new gcn::Label(strprintf(_("Name: %s"), ""));
+ mItemDescriptionLabel = new gcn::Label(
+ strprintf(_("Description: %s"), ""));
add(mMyScroll);
add(mPartnerScroll);
@@ -150,7 +153,7 @@ void TradeWindow::widgetResized(const gcn::Event &event)
void TradeWindow::addMoney(int amount)
{
- mMoneyLabel->setCaption("You get: " + toString(amount) + " GP");
+ mMoneyLabel->setCaption(strprintf(_("You get %d GP."), amount));
mMoneyLabel->adjustSize();
}
@@ -198,7 +201,7 @@ void TradeWindow::reset()
mOkButton->setEnabled(true);
mOkOther = false;
mOkMe = false;
- mMoneyLabel->setCaption("You get: 0 GP");
+ mMoneyLabel->setCaption(strprintf(_("You get %d GP."), 0));
mMoneyField->setEnabled(true);
mMoneyField->setText("");
}
@@ -257,21 +260,11 @@ void TradeWindow::valueChanged(const gcn::SelectionEvent &event)
}
// Update name and description
- if (!item)
- {
- mItemNameLabel->setCaption("Name:");
- mItemDescriptionLabel->setCaption("Description:");
- }
- else
- {
- std::string SomeText;
- SomeText = "Name: " + item->getInfo().getName();
- mItemNameLabel->setCaption(SomeText);
- mItemNameLabel->adjustSize();
- SomeText = "Description: " + item->getInfo().getDescription();
- mItemDescriptionLabel->setCaption(SomeText);
- mItemDescriptionLabel->adjustSize();
- }
+ ItemInfo const *info = item ? &item->getInfo() : NULL;
+ mItemNameLabel->setCaption(strprintf(_("Name: %s"),
+ info ? info->getName().c_str() : ""));
+ mItemDescriptionLabel->setCaption(strprintf(_("Description: %s"),
+ info ? info->getDescription().c_str() : ""));
}
void TradeWindow::action(const gcn::ActionEvent &event)
diff --git a/src/main.cpp b/src/main.cpp
index 7de3823f..55d295dd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -80,6 +80,7 @@
#include "resources/resourcemanager.h"
#include "utils/dtor.h"
+#include "utils/gettext.h"
#include "utils/tostring.h"
#ifdef __APPLE__
@@ -284,7 +285,7 @@ void init_engine(const Options &options)
// Add the user's homedir to PhysicsFS search path
resman->addToSearchPath(homeDir, false);
- // Add the main data directory to our PhysicsFS search path
+ // Add the main data directories to our PhysicsFS search path
if (!options.dataPath.empty()) {
resman->addToSearchPath(options.dataPath, true);
}
@@ -679,6 +680,7 @@ void mapLogin(Network *network, LoginData *loginData)
} // namespace
+extern "C" char const *_nl_locale_name_default(void);
/** Main */
int main(int argc, char *argv[])
@@ -699,6 +701,16 @@ int main(int argc, char *argv[])
printVersion();
return 0;
}
+
+#if ENABLE_NLS
+#ifdef WIN32
+ putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str());
+#endif
+ setlocale(LC_MESSAGES, "");
+ bindtextdomain("aethyra", LOCALEDIR);
+ textdomain("aethyra");
+#endif
+
// Initialize libxml2 and check for potential ABI mismatches between
// compiled version and the shared library actually used.
xmlInitParser();
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index a4a2dcc9..83b26743 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -39,6 +39,7 @@
#include "../gui/viewport.h"
#include "../utils/tostring.h"
+#include "../utils/gettext.h"
// TODO Move somewhere else
OkDialog *weightNotice = NULL;
@@ -189,10 +190,10 @@ void PlayerHandler::handleMessage(MessageIn *msg)
player_node->mTotalWeight <
player_node->mMaxWeight / 2)
{
- weightNotice = new OkDialog("Message",
- "You are carrying more then half "
- "your weight. You are unable to "
- "regain health.");
+ weightNotice = new OkDialog(_("Message"),
+ _("You are carrying more then half "
+ "your weight. You are unable to "
+ "regain health."));
weightNotice->addActionListener(
&weightListener);
}
@@ -214,37 +215,37 @@ void PlayerHandler::handleMessage(MessageIn *msg)
{
static char const *const deadMsg[] =
{
- "You are dead.",
- "We regret to inform you that your character was killed in battle.",
- "You are not that alive anymore.",
- "The cold hands of the grim reaper are grabbing for your soul.",
- "Game Over!",
- "Insert coin to continue",
- "No, kids. Your character did not really die. It... err... went to a better place.",
- "Your plan of breaking your enemies weapon by bashing it with your throat failed.",
- "I guess this did not run too well.",
- "Do you want your possessions identified?", // Nethack reference
- "Sadly, no trace of you was ever found...", // Secret of Mana reference
- "Annihilated.", // Final Fantasy VI reference
- "Looks like you got your head handed to you.", //Earthbound reference
- "You screwed up again, dump your body down the tubes and get you another one.", // Leisure Suit Larry 1 Reference
- "You're not dead yet. You're just resting.", // Monty Python reference from a couple of skits
- "You are no more.", // Monty Python reference from the dead parrot sketch starting now
- "You have ceased to be.",
- "You've expired and gone to meet your maker.",
- "You're a stiff.",
- "Bereft of life, you rest in peace.",
- "If you weren't so animated, you'd be pushing up the daisies.",
- "Your metabolic processes are now history.",
- "You're off the twig.",
- "You've kicked the bucket.",
- "You've shuffled off your mortal coil, run down the curtain and joined the bleedin' choir invisibile.",
- "You are an ex-player.",
- "You're pining for the fjords." // Monty Python reference from the dead parrot sketch
+ _("You are dead."),
+ _("We regret to inform you that your character was killed in battle."),
+ _("You are not that alive anymore."),
+ _("The cold hands of the grim reaper are grabbing for your soul."),
+ _("Game Over!"),
+ _("Insert coin to continue"),
+ _("No, kids. Your character did not really die. It... err... went to a better place."),
+ _("Your plan of breaking your enemies weapon by bashing it with your throat failed."),
+ _("I guess this did not run too well."),
+ _("Do you want your possessions identified?"), // Nethack reference
+ _("Sadly, no trace of you was ever found..."), // Secret of Mana reference
+ _("Annihilated."), // Final Fantasy VI reference
+ _("Looks like you got your head handed to you."), //Earthbound reference
+ _("You screwed up again, dump your body down the tubes and get you another one."), // Leisure Suit Larry 1 Reference
+ _("You're not dead yet. You're just resting."), // Monty Python reference from a couple of skits
+ _("You are no more."), // Monty Python reference from the dead parrot sketch starting now
+ _("You have ceased to be."),
+ _("You've expired and gone to meet your maker."),
+ _("You're a stiff."),
+ _("Bereft of life, you rest in peace."),
+ _("If you weren't so animated, you'd be pushing up the daisies."),
+ _("Your metabolic processes are now history."),
+ _("You're off the twig."),
+ _("You've kicked the bucket."),
+ _("You've shuffled off your mortal coil, run down the curtain and joined the bleedin' choir invisibile."),
+ _("You are an ex-player."),
+ _("You're pining for the fjords.") // Monty Python reference from the dead parrot sketch
};
std::string message(deadMsg[rand()%27]);
- deathNotice = new OkDialog("Message", message);
+ deathNotice = new OkDialog(_("Message"), message);
deathNotice->addActionListener(&deathListener);
player_node->setAction(Being::DEAD);
}
@@ -386,11 +387,11 @@ void PlayerHandler::handleMessage(MessageIn *msg)
switch (type) {
case 0:
- chatWindow->chatLog("Equip arrows first",
+ chatWindow->chatLog(_("Equip arrows first"),
BY_SERVER);
break;
default:
- logger->log("0x013b: Unhandled message %i", type);
+ logger->log(_("0x013b: Unhandled message %i"), type);
break;
}
}
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index bca2b030..027b9e16 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -30,6 +30,7 @@
#include "../log.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
#include "../utils/xml.h"
namespace
@@ -93,9 +94,9 @@ void ItemDB::load()
if (id)
{
- ItemInfo *itemInfo = new ItemInfo();
+ ItemInfo *itemInfo = new ItemInfo;
itemInfo->setImageName(image);
- itemInfo->setName((name == "") ? "Unnamed" : name);
+ itemInfo->setName(name.empty() ? _("Unnamed") : name);
itemInfo->setDescription(description);
itemInfo->setEffect(effect);
itemInfo->setType(type);
diff --git a/src/utils/gettext.h b/src/utils/gettext.h
new file mode 100644
index 00000000..0cd9114b
--- /dev/null
+++ b/src/utils/gettext.h
@@ -0,0 +1,44 @@
+/*
+ * The Mana World
+ * Copyright 2007 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _TMW_UTILS_GETTEXT_H
+#define _TMW_UTILS_GETTEXT_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if ENABLE_NLS
+
+#include <libintl.h>
+
+#define _(s) ((char const *)gettext(s))
+#define N_(s) ((char const *)s)
+
+#else
+
+#define gettext(s) ((char const *)s)
+#define _(s) ((char const *)s)
+#define N_(s) ((char const *)s)
+
+#endif
+
+#endif