summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/kde4-functions.eclass')
-rw-r--r--eclass/kde4-functions.eclass31
1 files changed, 30 insertions, 1 deletions
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
index 89092e6b8190..39fc3d08a0c9 100644
--- a/eclass/kde4-functions.eclass
+++ b/eclass/kde4-functions.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.4 2008/03/13 17:57:51 ingmar Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.5 2008/04/04 22:15:24 zlin Exp $
# @ECLASS: kde4-functions.eclass
# @MAINTAINER:
@@ -401,6 +401,35 @@ comment_all_add_subdirectory() {
die "${LINENO}: Initial sed died"
}
+# @ECLASS-VARIABLE: KDE_LINGUAS
+# @DESCRIPTION:
+# This is a whitespace-separated list of translations that this ebuild supports.
+# These translations automatically get added to IUSE. Therefore ebuilds must set
+# this variable before inheriting any eclasses. To only enable selected
+# translations ebuilds must call enable_selected_linguas(). kde4-base.eclass does
+# this for you.
+#
+# Example: KDE_LINGUAS="en_GB de nl"
+for _lingua in ${KDE_LINGUAS}; do
+ IUSE="${IUSE} linguas_${_lingua}"
+done
+
+# @FUNCTION: enable_selected_linguas
+# @DESCRIPTION:
+# Enable translations based on LINGUAS settings and what translations are
+# supported (see KDE_LINGUAS). By default translations are found in "${S}"/po
+# but this default can be overridden by defining KDE_LINGUAS_DIR.
+enable_selected_linguas() {
+ local lingua
+ comment_all_add_subdirectory "${KDE_LINGUAS_DIR:-${S}/po}"
+ for lingua in ${KDE_LINGUAS}; do
+ if use linguas_${lingua}; then
+ sed -e "/add_subdirectory(\s*${lingua}\s*)\s*$/ s/^#DONOTCOMPILE //" \
+ -i "${KDE_LINGUAS_DIR:-${S}/po}"/CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
+ fi
+ done
+}
+
# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
# @DESCRIPTION:
# A list of USE flags that x11-libs/qt:4 needs to be built with.