From: "Egry Gábor" <gaboregry@t-online.hu>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Roman Zippel <zippel@linux-m68k.org>,
Massimo Maiurana <maiurana@inwind.it>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
KernelFR <kernelfr@traduc.org>,
Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Subject: [PATCH 1/19] Kconfig I18N: sublocale
Date: Wed, 13 Jul 2005 19:04:52 +0200 [thread overview]
Message-ID: <1121274292.2975.9.camel@spirit> (raw)
In-Reply-To: <1121273456.2975.3.camel@spirit>
The external store of .mo files are unfrendly and binary .mo
files are ungly in the source code. This patch creates a temporary
locale directory on build time in <kernel_source>/.locale/
directory instead of /usr/share/locale/ and compiles the
necessary source language files from the <kernel_source>/po/ directory.
Without installed gettext package the configuration interfaces remain
in english.
This patch contains too a hook for additional patches. If one or more
po/*-po directories exist (ex. po/grsecurity-po/) then the content of
them will merged into the temporary locale directory. In this way the
configuration interface of external patches will be localisable.
Signed-off-by: Egry Gabor <gaboregry@t-online.hu>
---
Makefile | 1
scripts/kconfig/Makefile | 7 +++
scripts/kconfig/lkc.h | 2
scripts/kconfig/set_locale.sh | 93 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 102 insertions(+), 1 deletion(-)
diff -puN Makefile~kconfig-i18n-01-sublocale Makefile
--- linux-2.6.13-rc3-i18n-kconfig/Makefile~kconfig-i18n-01-sublocale 2005-07-13 18:32:15.000000000 +0200
+++ linux-2.6.13-rc3-i18n-kconfig-gabaman/Makefile 2005-07-13 18:32:15.000000000 +0200
@@ -948,6 +948,7 @@ endef
# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)
+CLEAN_DIRS += .locale
CLEAN_FILES += vmlinux System.map \
.tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
diff -puN scripts/kconfig/lkc.h~kconfig-i18n-01-sublocale scripts/kconfig/lkc.h
--- linux-2.6.13-rc3-i18n-kconfig/scripts/kconfig/lkc.h~kconfig-i18n-01-sublocale 2005-07-13 18:32:15.000000000 +0200
+++ linux-2.6.13-rc3-i18n-kconfig-gabaman/scripts/kconfig/lkc.h 2005-07-13 18:32:15.000000000 +0200
@@ -26,7 +26,7 @@ extern "C" {
#define SRCTREE "srctree"
#define PACKAGE "linux"
-#define LOCALEDIR "/usr/share/locale"
+#define LOCALEDIR ".locale"
#define _(text) gettext(text)
#define N_(text) (text)
diff -puN scripts/kconfig/Makefile~kconfig-i18n-01-sublocale scripts/kconfig/Makefile
--- linux-2.6.13-rc3-i18n-kconfig/scripts/kconfig/Makefile~kconfig-i18n-01-sublocale 2005-07-13 18:32:15.000000000 +0200
+++ linux-2.6.13-rc3-i18n-kconfig-gabaman/scripts/kconfig/Makefile 2005-07-13 18:36:54.000000000 +0200
@@ -5,22 +5,28 @@
.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
xconfig: $(obj)/qconf
+ $(Q)sh $(obj)/set_locale.sh
$< arch/$(ARCH)/Kconfig
gconfig: $(obj)/gconf
+ $(Q)sh $(obj)/set_locale.sh
$< arch/$(ARCH)/Kconfig
menuconfig: $(obj)/mconf
$(Q)$(MAKE) $(build)=scripts/lxdialog
+ $(Q)sh $(obj)/set_locale.sh
$< arch/$(ARCH)/Kconfig
config: $(obj)/conf
+ $(Q)sh $(obj)/set_locale.sh
$< arch/$(ARCH)/Kconfig
oldconfig: $(obj)/conf
+ $(Q)sh $(obj)/set_locale.sh
$< -o arch/$(ARCH)/Kconfig
silentoldconfig: $(obj)/conf
+ $(Q)sh $(obj)/set_locale.sh
$< -s arch/$(ARCH)/Kconfig
update-po-config: $(obj)/kxgettext
@@ -214,3 +220,4 @@ lex.%.c: %.l
flex -P$(notdir $*) -o$@ $<
endif
+
diff -puN /dev/null scripts/kconfig/set_locale.sh
--- /dev/null 2005-07-13 15:43:03.451152136 +0200
+++ linux-2.6.13-rc3-i18n-kconfig-gabaman/scripts/kconfig/set_locale.sh 2005-07-13 18:32:15.000000000 +0200
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+#
+# This script detects language and compiles the language binary files
+#
+
+# Check the po/ directory
+if [ ! -d po/ ]
+then
+ exit 0
+fi
+
+# Set language code
+if test "x$LANG" == "x"
+then
+ if test "x$LC_ALL" == "x"
+ then
+ exit 0
+ else
+ MYLC=$LC_ALL
+ fi
+else
+ MYLC=$LANG
+fi
+
+# If don't need the translation
+if test "x$MYLC" == "xC"
+then
+ exit 0
+fi
+
+MYLCTEST=$(echo $MYLC|cut -b 1-5)
+
+# Find Kconfig's .po
+POFILES=$(find po/ -maxdepth 1 -type f -name ${MYLCTEST}.po)
+if test "x$POFILES" != "x"
+then
+ MYLC=$MYLCTEST
+else
+ MYLCTEST=$(echo $MYLC|cut -b 1-2)
+ POFILES=$(find po/ -maxdepth 1 -type f -name ${MYLCTEST}.po)
+ if test "x$POFILES" != "x"
+ then
+ MYLC=$MYLCTEST
+ else
+ #echo "Your language ($MYLC) is not supported."
+ exit 0
+ fi
+fi
+
+if [ -f .locale/$MYLC/LC_MESSAGES/linux.mo ]
+then
+ exit 0
+fi
+
+echo -n " LOCALE ($MYLC)... "
+
+# Find additional .po files
+# This is a hook for external patches
+for i in $(find po/ -maxdepth 1 -type d -path '*-po')
+do
+ if [ -f $i/$MYLC.po ]
+ then
+ POFILES="$POFILES $i/$MYLC.po"
+ NEED_CAT=1
+ fi
+done
+
+# Trying msgfmt... and no returning error if it doesn't exist
+msgfmt -V &>/dev/null || {
+ echo "msgfmt doesn't exist, please install gettext";
+ exit 0;
+}
+
+# Do translation...
+mkdir -p .locale/$MYLC/LC_MESSAGES/
+if test "x$NEED_CAT" == "x1"
+then
+ # Trying msgcat and no returning error if it doesn't exist
+ msgcat -V &>/dev/null || {
+ echo "msgcat doesn't exist, please install gettext 0.12 or newer";
+ exit 0;
+ }
+ msgcat --output=.locale/$MYLC/LC_MESSAGES/__tmp.po --use-first $POFILES
+ msgfmt .locale/$MYLC/LC_MESSAGES/__tmp.po --output=.locale/$MYLC/LC_MESSAGES/linux.mo
+ rm -f .locale/$MYLC/LC_MESSAGES/__tmp.po
+else
+ msgfmt $POFILES --output=.locale/$MYLC/LC_MESSAGES/linux.mo
+fi
+
+# Done
+echo " done"
+
_
next prev parent reply other threads:[~2005-07-13 17:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-13 16:50 [PATCH 0/19] Kconfig I18N completion Egry Gábor
2005-07-13 17:04 ` Egry Gábor [this message]
2005-07-13 17:07 ` [PATCH 2/19] Kconfig I18N: lxdialog: width fix Egry Gábor
2005-07-13 17:26 ` [PATCH] Kconfig: lxdialog: Enable UTF8 Jan Engelhardt
2005-07-14 0:26 ` Ken Moffat
2005-07-16 9:54 ` Sam Ravnborg
2005-07-16 10:12 ` Ken Moffat
2005-07-16 22:14 ` Ken Moffat
2005-07-13 17:09 ` [PATCH 3/19] Kconfig I18N: lxdialog Egry Gábor
2005-07-13 17:11 ` [PATCH 4/19] Kconfig I18N: lxdialog: multibyte character support Egry Gábor
2005-07-14 0:10 ` Roman Zippel
2005-07-13 17:13 ` [PATCH 5/19] Kconfig I18N: lxdialog: answering Egry Gábor
2005-07-13 17:15 ` [PATCH 6/19] Kconfig I18N: config Egry Gábor
2005-07-13 17:17 ` [PATCH 7/19] Kconfig I18N: gconfig Egry Gábor
2005-07-13 17:18 ` [PATCH 8/19] Kconfig I18N: gconfig: GUI Egry Gábor
2005-07-13 17:20 ` [PATCH 9/19] Kconfig I18N: gconfig: answering Egry Gábor
2005-07-13 17:21 ` [PATCH 10/19] Kconfig I18N: gconfig: missing macros Egry Gábor
2005-07-13 17:23 ` [PATCH 11/19] Kconfig I18N: gconfig: symbol fix Egry Gábor
2005-07-13 17:24 ` [PATCH 12/19] Kconfig I18N: menuconfig Egry Gábor
2005-07-13 17:26 ` [PATCH 13/19] Kconfig I18N: menuconfig: answering Egry Gábor
2005-07-13 17:27 ` [PATCH 14/19] Kconfig I18N: menuconfig: missing macros Egry Gábor
2005-07-13 17:28 ` [PATCH 15/19] Kconfig I18n: xconfig Egry Gábor
2005-07-13 17:30 ` [PATCH 16/19] Kconfig I18n: xconfig: answering Egry Gábor
2005-07-13 17:31 ` [PATCH 17/19] Kconfig I18N: xconfig: symbol fix Egry Gábor
2005-07-13 17:33 ` [PATCH 18/19] Kconfig I18N: LKC: whitespace removing Egry Gábor
2005-07-14 0:12 ` Roman Zippel
2005-07-13 17:35 ` [PATCH 19/19] Kconfig I18N: UI: Hungarian translation Egry Gábor
2005-07-13 17:41 ` [PATCH 0/19] Kconfig I18N completion Linus Torvalds
2005-07-13 18:03 ` Egry Gábor
2005-07-13 20:11 ` Sam Ravnborg
2005-07-13 18:41 ` Egry Gábor
2005-07-13 19:02 ` Linus Torvalds
2005-07-15 17:41 ` Arnaldo Carvalho de Melo
2005-07-13 20:48 ` Sam Ravnborg
2005-07-14 10:03 ` Jan Engelhardt
2005-07-13 20:04 ` Jan Engelhardt
2005-07-13 20:45 ` Sam Ravnborg
2005-07-14 3:42 ` Sam Ravnborg
2005-07-14 0:06 ` Roman Zippel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1121274292.2975.9.camel@spirit \
--to=gaboregry@t-online.hu \
--cc=acme@conectiva.com.br \
--cc=akpm@osdl.org \
--cc=kernelfr@traduc.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maiurana@inwind.it \
--cc=torvalds@osdl.org \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®