build 1.75 KB
Newer Older
1
#!/bin/bash
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
2 3 4 5 6 7 8 9 10 11 12 13
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2015 Christopher Bratusek		#
#							#
#########################################################

generate_pot () {

Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
14
	echo -e "\t${WHITE}+ ${MAGENTA} translation templates"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
15
	echo -e "\t${WHITE}  *${YELLOW} bs-ng.pot"
16
	intltool-extract --type=gettext/glade ui/bashstyle.ui >/dev/null
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
17
	xgettext -L python --keyword=_ --keyword=N_ --output=i18n/bs-ng.pot \
18
		ui/*.py ui/bashstyle.ui.h >/dev/null
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
19

Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
20
	echo -e "\t${WHITE}  *${YELLOW} nx-rc.pot"
21
	xgettext -o i18n/nx-rc.pot -L shell rc/nx-rc rc/settings/*-rc 2>/dev/null
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
22 23 24 25 26 27

}

update_po () {

	if [[ ! -f i18n/bs-ng.pot || ! -f i18n/nx-rc.pot ]]; then
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
28
		echo -e "\n${RED}You need to run './make pot' first!\n"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
29 30
		exit 1
	else
31
		echo -e "\t${WHITE}+ ${MAGENTA} gui translations"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
32
		for lang in ${APP_LANGUAGES}; do
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
33 34 35
			echo -e "\t${WHITE}  *${SMOOTHBLUE} ${lang}"
			msgmerge -q -o i18n/${lang}/bs-ng.po \
				i18n/${lang}/bs-ng.po i18n/bs-ng.pot >/dev/null
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
36 37
		done

38
		echo -e "\t${WHITE}+ ${MAGENTA} nx-rc translations"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
39
		for lang in ${APP_LANGUAGES}; do
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
40 41 42
			echo -e "\t${WHITE}  *${SMOOTHBLUE} ${lang}"
			msgmerge -q -o i18n/${lang}/nx-rc.po \
				i18n/${lang}/nx-rc.po i18n/nx-rc.pot >/dev/null
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
43 44 45 46 47 48 49
		done
	fi

}

generate_mo () {

50
	echo -e "\t${WHITE}+ ${MAGENTA} gui translations"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
51
	for lang in ${APP_LANGUAGES}; do
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
52 53 54
		echo -e "\t${WHITE}  *${SMOOTHBLUE} ${lang}"
		msgfmt --output-file=i18n/${lang}/bs-ng.mo \
			i18n/${lang}/bs-ng.po
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
55 56
	done

57
	echo -e "\t${WHITE}+ ${MAGENTA} nx-rc translations"
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
58
	for lang in ${APP_LANGUAGES}; do
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
59 60 61
		echo -e "\t${WHITE}  *${SMOOTHBLUE} ${lang}"
		msgfmt --output-file=i18n/${lang}/nx-rc.mo \
			i18n/${lang}/nx-rc.po
Christopher Roy Bratusek's avatar
Christopher Roy Bratusek committed
62 63 64
	done

}