-
Notifications
You must be signed in to change notification settings - Fork 88
/
Makefile.gettext
38 lines (27 loc) · 1.06 KB
/
Makefile.gettext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# make translations with gettext
#
PYTHON_FILES:=$(shell find keepnote -name '*.py')
SRC_FILES=$(PYTHON_FILES) keepnote/rc/keepnote.glade.h
INTLTOOL_EXTRACT:=$(shell which intltool || echo /usr/share/intltool-debian/intltool-extract)
LOCALE_DIR=keepnote/rc/locale
#=============================================================================
# rules
# make messages file, extracts all strings in _()
extract:
xgettext --from-code=utf-8 -k_ -kN_ \
-o gettext/messages.pot $(SRC_FILES)
# make a new translation
new:
msginit -l $(LANG) -o gettext/$(LANG).po --input gettext/messages.pot
# update language file with new strings
update:
msgmerge -N -U gettext/$(LANG).po gettext/messages.pot
# make translations for application
make:
mkdir -p $(LOCALE_DIR)/$(LANG)/LC_MESSAGES/
msgfmt gettext/$(LANG).po -o $(LOCALE_DIR)/$(LANG)/LC_MESSAGES/keepnote.mo
#=============================================================================
# depends
keepnote/rc/keepnote.glade.h: keepnote/rc/keepnote.glade
$(INTLTOOL_EXTRACT) --type=gettext/glade keepnote/rc/keepnote.glade