mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 12:27:52 +00:00
Make I18N optional
This commit is contained in:
parent
a1f4984a4e
commit
9d7a914515
@ -48,7 +48,10 @@ mark_as_advanced(RELEASE)
|
|||||||
|
|
||||||
option(MAINTAINER_MODE "Enable maintainer mode (builds docs)" false)
|
option(MAINTAINER_MODE "Enable maintainer mode (builds docs)" false)
|
||||||
|
|
||||||
set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale" CACHE STRING "Directory containing the locales")
|
option(BUILD_I18N "Enable if you want internationalization support" true)
|
||||||
|
if(BUILD_I18N)
|
||||||
|
set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale" CACHE STRING "Directory containing the locales")
|
||||||
|
endif(BUILD_I18N)
|
||||||
|
|
||||||
# Some standard options
|
# Some standard options
|
||||||
set(SYSTEM_CONFIG_FILE "/etc/conky/conky.conf" CACHE STRING "Default system-wide Conky configuration file")
|
set(SYSTEM_CONFIG_FILE "/etc/conky/conky.conf" CACHE STRING "Default system-wide Conky configuration file")
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@
|
#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@
|
||||||
#define HTTPPORT @HTTPPORT@
|
#define HTTPPORT @HTTPPORT@
|
||||||
|
|
||||||
|
#cmakedefine BUILD_I18N 1
|
||||||
|
|
||||||
#cmakedefine HAVE_SYS_STATFS_H 1
|
#cmakedefine HAVE_SYS_STATFS_H 1
|
||||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||||
#cmakedefine HAVE_SYS_INOTIFY_H 1
|
#cmakedefine HAVE_SYS_INOTIFY_H 1
|
||||||
|
@ -80,8 +80,6 @@
|
|||||||
#ifdef BUILD_CURL
|
#ifdef BUILD_CURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
#define _(string) gettext(string)
|
|
||||||
#define _nop(string) string
|
|
||||||
|
|
||||||
/* local headers */
|
/* local headers */
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
@ -298,8 +296,11 @@ static void print_version(void)
|
|||||||
<< " * Imlib2\n"
|
<< " * Imlib2\n"
|
||||||
#endif /* BUILD_LUA_IMLIB2 */
|
#endif /* BUILD_LUA_IMLIB2 */
|
||||||
#endif /* BUILD_LUA */
|
#endif /* BUILD_LUA */
|
||||||
|
#ifdef BUILD_I18N
|
||||||
|
<< " * Internationalization support\n"
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
<< " * Debugging extensions\n"
|
<< " * Debugging extensions\n"
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -4399,9 +4400,11 @@ bool isutf8(const char* envvar) {
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
#ifdef BUILD_I18N
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(PACKAGE_NAME, LOCALE_DIR);
|
bindtextdomain(PACKAGE_NAME, LOCALE_DIR);
|
||||||
textdomain(PACKAGE_NAME);
|
textdomain(PACKAGE_NAME);
|
||||||
|
#endif
|
||||||
argc_copy = argc;
|
argc_copy = argc;
|
||||||
argv_copy = argv;
|
argv_copy = argv;
|
||||||
g_signal_pending = 0;
|
g_signal_pending = 0;
|
||||||
|
38
src/i18n.h
Normal file
38
src/i18n.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||||
|
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||||
|
*
|
||||||
|
* Conky, a system monitor, based on torsmo
|
||||||
|
*
|
||||||
|
* Please see COPYING for details
|
||||||
|
*
|
||||||
|
* Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
|
||||||
|
* (see AUTHORS)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This program 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef I18N_H_
|
||||||
|
#define I18N_H_
|
||||||
|
|
||||||
|
#define _nop(string) string
|
||||||
|
|
||||||
|
#ifdef BUILD_I18N
|
||||||
|
#include <libintl.h>
|
||||||
|
#define _(string) gettext(string)
|
||||||
|
#else
|
||||||
|
#define _(string) string
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*I18N_H_*/
|
@ -31,7 +31,7 @@
|
|||||||
#define _LOGGING_H
|
#define _LOGGING_H
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <libintl.h>
|
#include "i18n.h"
|
||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
|
|
||||||
void clean_up(void *memtofree1, void* memtofree2);
|
void clean_up(void *memtofree1, void* memtofree2);
|
||||||
@ -39,12 +39,12 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2);
|
|||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void gettextize_format(const char *format, Args&&... args)
|
void gettextize_format(const char *format, Args&&... args)
|
||||||
{ fprintf(stderr, gettext(format), args...); }
|
{ fprintf(stderr, _(format), args...); }
|
||||||
|
|
||||||
// explicit specialization for no arguments to avoid the
|
// explicit specialization for no arguments to avoid the
|
||||||
// "format not a string literal and no format arguments" warning
|
// "format not a string literal and no format arguments" warning
|
||||||
inline void gettextize_format(const char *format)
|
inline void gettextize_format(const char *format)
|
||||||
{ fputs(gettext(format), stderr); }
|
{ fputs(_(format), stderr); }
|
||||||
|
|
||||||
#define NORM_ERR(...) do { \
|
#define NORM_ERR(...) do { \
|
||||||
fprintf(stderr, PACKAGE_NAME": "); \
|
fprintf(stderr, PACKAGE_NAME": "); \
|
||||||
|
Loading…
Reference in New Issue
Block a user