make strings in main.cc translatable
This commit is contained in:
parent
b79c74fc07
commit
0eff3cc415
2 changed files with 32 additions and 27 deletions
|
@ -19,6 +19,7 @@
|
||||||
#ifndef _LIBGETTEXT_H
|
#ifndef _LIBGETTEXT_H
|
||||||
#define _LIBGETTEXT_H 1
|
#define _LIBGETTEXT_H 1
|
||||||
|
|
||||||
|
|
||||||
/* NLS can be disabled through the configure --disable-nls option. */
|
/* NLS can be disabled through the configure --disable-nls option. */
|
||||||
#if ENABLE_NLS
|
#if ENABLE_NLS
|
||||||
|
|
||||||
|
|
58
src/main.cc
58
src/main.cc
|
@ -28,6 +28,9 @@ extern "C" {
|
||||||
#endif // HAVE_SYS_PARAM_H
|
#endif // HAVE_SYS_PARAM_H
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#define _(str) gettext(str)
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -36,50 +39,50 @@ using std::string;
|
||||||
|
|
||||||
static void showHelp(int exitval) {
|
static void showHelp(int exitval) {
|
||||||
// print program usage and command line options
|
// print program usage and command line options
|
||||||
printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
|
printf(_("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"),
|
||||||
" -display <string>\t\tuse display connection.\n"
|
|
||||||
" -rc <string>\t\t\tuse alternate resource file.\n"
|
|
||||||
" -menu <string>\t\tuse alternate menu file.\n"
|
|
||||||
" -version\t\t\tdisplay version and exit.\n"
|
|
||||||
" -help\t\t\t\tdisplay this help text and exit.\n\n",
|
|
||||||
OPENBOX_VERSION);
|
OPENBOX_VERSION);
|
||||||
|
printf(_(" -display <string> use display connection.\n\
|
||||||
|
-rc <string> use alternate resource file.\n\
|
||||||
|
-menu <string> use alternate menu file.\n\
|
||||||
|
-version display version and exit.\n\
|
||||||
|
-help display this help text and exit.\n\n"));
|
||||||
|
|
||||||
// some people have requested that we print out compile options
|
// some people have requested that we print out compile options
|
||||||
// as well
|
// as well
|
||||||
printf("Compile time options:\n"
|
printf(_("Compile time options:\n\
|
||||||
" Debugging:\t\t\t%s\n"
|
Debugging:\t\t\t%s\n\
|
||||||
" Shape:\t\t\t%s\n"
|
Shape:\t\t\t%s\n\
|
||||||
" Xft:\t\t\t\t%s\n"
|
Xft:\t\t\t\t%s\n\
|
||||||
" Xinerama:\t\t\t%s\n"
|
Xinerama:\t\t\t%s\n\
|
||||||
" 8bpp Ordered Dithering:\t%s\n\n",
|
8bpp Ordered Dithering:\t%s\n\n"),
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
"yes",
|
_("yes"),
|
||||||
#else // !DEBUG
|
#else // !DEBUG
|
||||||
"no",
|
_("no"),
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
"yes",
|
_("yes"),
|
||||||
#else // !SHAPE
|
#else // !SHAPE
|
||||||
"no",
|
_("no"),
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
"yes",
|
_("yes"),
|
||||||
#else // !XFT
|
#else // !XFT
|
||||||
"no",
|
_("no"),
|
||||||
#endif // XFT
|
#endif // XFT
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
"yes",
|
_("yes"),
|
||||||
#else // !XINERAMA
|
#else // !XINERAMA
|
||||||
"no",
|
_("no"),
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
|
|
||||||
#ifdef ORDEREDPSEUDO
|
#ifdef ORDEREDPSEUDO
|
||||||
"yes"
|
_("yes")
|
||||||
#else // !ORDEREDPSEUDO
|
#else // !ORDEREDPSEUDO
|
||||||
"no"
|
_("no")
|
||||||
#endif // ORDEREDPSEUDO
|
#endif // ORDEREDPSEUDO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -96,7 +99,7 @@ int main(int argc, char **argv) {
|
||||||
// look for alternative rc file to use
|
// look for alternative rc file to use
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr, "error: '-rc' requires and argument\n");
|
fprintf(stderr, _("error: '-rc' requires and argument\n"));
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +109,7 @@ int main(int argc, char **argv) {
|
||||||
// look for alternative menu file to use
|
// look for alternative menu file to use
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr, "error: '-menu' requires and argument\n");
|
fprintf(stderr, _("error: '-menu' requires and argument\n"));
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +120,7 @@ int main(int argc, char **argv) {
|
||||||
// set by the environment variable DISPLAY
|
// set by the environment variable DISPLAY
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr, "error: '-display' requires an argument\n");
|
fprintf(stderr, _("error: '-display' requires an argument\n"));
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -128,13 +131,14 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (putenv(const_cast<char*>(dtmp.c_str()))) {
|
if (putenv(const_cast<char*>(dtmp.c_str()))) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"warning: couldn't set environment variable 'DISPLAY'\n");
|
_("warning: couldn't set environment variable 'DISPLAY'\n"));
|
||||||
perror("putenv()");
|
perror("putenv()");
|
||||||
}
|
}
|
||||||
} else if (! strcmp(argv[i], "-version")) {
|
} else if (! strcmp(argv[i], "-version")) {
|
||||||
// print current version string
|
// print current version string
|
||||||
printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n",
|
printf(_("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"),
|
||||||
OPENBOX_VERSION);
|
OPENBOX_VERSION);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
::exit(0);
|
::exit(0);
|
||||||
} else if (! strcmp(argv[i], "-help")) {
|
} else if (! strcmp(argv[i], "-help")) {
|
||||||
|
|
Loading…
Reference in a new issue