mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-19 19:46:35 +02:00
Add localization system (gettext)
This commit is contained in:
@ -24,6 +24,12 @@ ifneq ($(DESK_NOTIFY), disabled)
|
||||
-include $(CHECKS_DIR)/desktop_notifications.mk
|
||||
endif
|
||||
|
||||
# Check if we want build localization support
|
||||
LOCALIZATION = $(shell if [ -z "$(DISABLE_LOCALIZATION)" ] || [ "$(DISABLE_LOCALIZATION)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
|
||||
ifneq ($(LOCALIZATION), enabled)
|
||||
CFLAGS += -DNO_GETTEXT
|
||||
endif
|
||||
|
||||
# Check if we can build Toxic
|
||||
CHECK_LIBS = $(shell pkg-config --exists $(LIBS) || echo -n "error")
|
||||
ifneq ($(CHECK_LIBS), error)
|
||||
|
@ -13,6 +13,7 @@ DOC_DIR = $(BASE_DIR)/doc
|
||||
SRC_DIR = $(BASE_DIR)/src
|
||||
SND_DIR = $(BASE_DIR)/sounds
|
||||
MISC_DIR = $(BASE_DIR)/misc
|
||||
TRANSLATIONS_DIR = $(BASE_DIR)/translations
|
||||
|
||||
# Project files
|
||||
MANFILES = toxic.1 toxic.conf.5
|
||||
@ -22,9 +23,13 @@ SNDFILES = ToxicContactOnline.wav ToxicContactOffline.wav ToxicError.wav
|
||||
SNDFILES += ToxicRecvMessage.wav ToxicOutgoingCall.wav ToxicIncomingCall.wav
|
||||
SNDFILES += ToxicTransferComplete.wav ToxicTransferStart.wav
|
||||
|
||||
# Available languages (sorted alphabetically)
|
||||
LANGS = en it
|
||||
|
||||
# Install directories
|
||||
PREFIX = /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
DATADIR = $(PREFIX)/share/toxic
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
APPDIR = $(PREFIX)/share/applications
|
||||
LOCALEDIR = ${PREFIX}/share/locale
|
||||
|
@ -8,3 +8,9 @@ LIBS := $(filter-out ncursesw, $(LIBS))
|
||||
# OS X ships a usable, recent version of ncurses, but calls it ncurses not ncursesw.
|
||||
LDFLAGS += -lncurses -lalut -ltoxav -ltoxcore -ltoxdns -lresolv -lconfig -ltoxencryptsave -g
|
||||
CFLAGS += -I/usr/local/opt/freealut/include/AL -I/usr/local/opt/glib/include/glib-2.0 -g
|
||||
|
||||
# Check if we want build localization support
|
||||
LOCALIZATION = $(shell if [ -z "$(DISABLE_LOCALIZATION)" ] || [ "$(DISABLE_LOCALIZATION)" = "0" ] ; then echo enabled ; else echo disabled ; fi)
|
||||
ifneq ($(LOCALIZATION), disabled)
|
||||
LDFLAGS += -lintl
|
||||
endif
|
||||
|
@ -14,6 +14,7 @@ help:
|
||||
@echo " DISABLE_AV: Set to \"1\" to force building without audio call support"
|
||||
@echo " DISABLE_SOUND_NOTIFY: Set to \"1\" to force building without sound notification support"
|
||||
@echo " DISABLE_DESKTOP_NOTIFY: Set to \"1\" to force building without desktop notifications support"
|
||||
@echo " DISABLE_LOCALIZATION: Set to \"1\" to force building without localization support"
|
||||
@echo " USER_CFLAGS: Add custom flags to default CFLAGS"
|
||||
@echo " USER_LDFLAGS: Add custom flags to default LDFLAGS"
|
||||
@echo " PREFIX: Specify a prefix directory for binaries, data files,... (default is \"$(abspath $(PREFIX))\")"
|
||||
|
@ -8,6 +8,17 @@ install: $(BUILD_DIR)/toxic
|
||||
@mkdir -p $(abspath $(DESTDIR)/$(APPDIR))
|
||||
@install -m 0644 $(MISC_DIR)/$(DESKFILE) $(abspath $(DESTDIR)/$(APPDIR)/$(DESKFILE))
|
||||
|
||||
@if [ -z "$(DISABLE_LOCALIZATION)" -o "$(DISABLE_LOCALIZATION)" = "0" ]; then \
|
||||
echo "Installing translations" ; \
|
||||
for i in $(LANGS) ; do \
|
||||
if [ ! -e $(TRANSLATIONS_DIR)/$$i.mo ]; then \
|
||||
continue ; \
|
||||
fi ; \
|
||||
mkdir -p $(abspath $(DESTDIR)/$(LOCALEDIR)/$$i/LC_MESSAGES) ; \
|
||||
install -m 0644 $(TRANSLATIONS_DIR)/$$i.mo $(abspath $(DESTDIR)/$(LOCALEDIR)/$$i/LC_MESSAGES/toxic.mo) ; \
|
||||
done ; \
|
||||
fi
|
||||
|
||||
@echo "Installing data files"
|
||||
@mkdir -p $(abspath $(DESTDIR)/$(DATADIR))
|
||||
@for f in $(DATAFILES) ; do \
|
||||
|
Reference in New Issue
Block a user