From 334b6dc66881872107611feddddeb779ea7d7e96 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Thu, 7 Jun 2012 01:03:25 +0200 Subject: Fixed FindSourceFiles to find leaf nodes. --- doc/user/gettext.in | 51 +++++++++++++------------- doc/user/gettext.xml | 50 +++++++++++++------------- doc/user/main.in | 2 +- doc/user/main.xml | 6 ++++ doc/user/troubleshoot.xml | 4 +-- src/CHANGES.txt | 3 ++ src/engine/SCons/Environment.py | 15 +++++++- src/engine/SCons/Tool/gettext.xml | 4 +-- src/engine/SCons/Tool/xgettext.py | 18 +++++----- test/FindSourceFiles.py | 76 +++++++++++++++++++++++++++++++++++++++ 10 files changed, 165 insertions(+), 64 deletions(-) create mode 100644 test/FindSourceFiles.py diff --git a/doc/user/gettext.in b/doc/user/gettext.in index 22545d3..3370ea9 100644 --- a/doc/user/gettext.in +++ b/doc/user/gettext.in @@ -25,18 +25,18 @@ The &t-link-gettext; toolset supports internationalization and localization - of SCons-based projects. The tools provided within &t-link-gettext; by - automatize generation and updates of translation files. You can manage - translations and translation templates simillary as it was done with - autotools. + of SCons-based projects. Builders provided by &t-link-gettext; automatize + generation and updates of translation files. You can manage translations and + translation templates similarly as it was done with autotools.
Prerequisites - Setup your operating system, so you can use several languages. In following - examples we use locales en_US, de_DE, - and pl_PL. + To follow examples provided in this chapter setup your operating system to + support two or more languages. In following examples we use locales + en_US, de_DE, and + pl_PL. @@ -46,7 +46,7 @@ - To edit translation files, you may install poedit editor.
@@ -54,7 +54,7 @@
Simple project - Let's start with some simple project, the "Hello world" program + Let's start with very simple project, the "Hello world" program for example @@ -68,8 +68,8 @@ - Prepare simple SConstruct script to compile the - program. + Prepare SConstruct script to compile the program + as usual. # SConstruct @@ -83,10 +83,11 @@ Now we'll convert the project to multi-lingual one. I assume, that you already have GNU gettext - utilities installed. If not, install it from repository, or - download from + utilities installed. If not, install them from your preffered + package repository, or download from http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, - you should have following three locales installed on your system + you should have following three locales installed on your system en_US, de_DE and pl_PL. On debian, for example, you may enable certain locales through dpkg-reconfigure locales. @@ -116,7 +117,7 @@ url="http://www.gnu.org/software/gettext/manual/gettext.html#Sources"> http://www.gnu.org/software/gettext/manual/gettext.html#Sources. The gettext("...") in above source has two purposes. - First is is recognized by the xgettext(1) program, which + First, it marks messages for xgettext(1) program, which we will use to extract from the sources the messages for localization. Second, it calls the gettext library internals to translate the message at runtime. @@ -159,7 +160,7 @@ Generate translation files with scons po-update. You should see the output from SCons simillar to this: - ptomulik@:$ scons po-update + user@host:$ scons po-update scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -180,7 +181,7 @@ If everything is right, you shall see following new files. - ptomulik@:$ ls *.po* + user@host:$ ls *.po* de.po en.po messages.pot pl.po @@ -206,7 +207,7 @@ Now compile the project by executing scons command. The output should be similar to this: - ptomulik@:$ scons + user@host:$ scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -227,15 +228,15 @@ Your program should be now ready. You may try it as follows (linux): - ptomulik@:$ LANG=en_US.UTF-8 ./hello + user@host:$ LANG=en_US.UTF-8 ./hello Welcome to beautiful world - ptomulik@:$ LANG=de_DE.UTF-8 ./hello + user@host:$ LANG=de_DE.UTF-8 ./hello Hallo Welt - ptomulik@:$ LANG=pl_PL.UTF-8 ./hello + user@host:$ LANG=pl_PL.UTF-8 ./hello Witaj swiecie @@ -245,7 +246,7 @@ swiecie\n". Run scons to see how scons reacts to this - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -280,7 +281,7 @@ msgmerge(1) program is used by SCons to update PO file. The output from compilation is like: - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -306,7 +307,7 @@ - The last example demonstrates what happens, if we change the source code + The next example demonstrates what happens, if we change the source code in such way, that the internationalized messages do not change. The answer is, that none of translation files (POT, PO) is touched (i.e. no content changes, no @@ -332,7 +333,7 @@ Compile project. You'll see on your screen - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... diff --git a/doc/user/gettext.xml b/doc/user/gettext.xml index 9fc0076..f5806a4 100644 --- a/doc/user/gettext.xml +++ b/doc/user/gettext.xml @@ -25,18 +25,18 @@ The &t-link-gettext; toolset supports internationalization and localization - of SCons-based projects. The tools provided within &t-link-gettext; by - automatize generation and updates of translation files. You can manage - translations and translation templates simillary as it was done with - autotools. + of SCons-based projects. Builders provided by &t-link-gettext; automatize + generation and updates of translation files. You can manage translations and + translation templates similarly as it was done with autotools.
Prerequisites - Setup your operating system, so you can use several languages. In following - examples we use locales en_US, de_DE, - and pl_PL. + To follow examples provided in this chapter setup your operating system to + support two or more languages. In following examples we use locales + en_US, de_DE, and + pl_PL. @@ -45,14 +45,14 @@ - To edit translation files, you may install poedit editor. + To edit translation files you may wish to install poedit editor.
Simple project - Let's start with some simple project, the "Hello world" program + Let's start with very simple project, the "Hello world" program for example /* hello.c */ @@ -64,8 +64,8 @@ } - Prepare simple SConstruct script to compile the - program. + Prepare SConstruct script to compile the program + as usual. # SConstruct env = Environment() @@ -76,10 +76,10 @@ Now we'll convert the project to multi-lingual one. I assume, that you already have GNU gettext - utilities installed. If not, install it from repository, or - download from + utilities installed. If not, install them from your preffered + package repository, or download from http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, - you should have following three locales installed on your system + you should have following three locales installed on your system en_US, de_DE and pl_PL. On debian, for example, you may enable certain locales through dpkg-reconfigure locales. @@ -106,7 +106,7 @@ be found at http://www.gnu.org/software/gettext/manual/gettext.html#Sources. The gettext("...") in above source has two purposes. - First is is recognized by the xgettext(1) program, which + First, it marks messages for xgettext(1) program, which we will use to extract from the sources the messages for localization. Second, it calls the gettext library internals to translate the message at runtime. @@ -147,7 +147,7 @@ Generate translation files with scons po-update. You should see the output from SCons simillar to this: - ptomulik@:$ scons po-update + user@host:$ scons po-update scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -168,7 +168,7 @@ If everything is right, you shall see following new files. - ptomulik@:$ ls *.po* + user@host:$ ls *.po* de.po en.po messages.pot pl.po @@ -194,7 +194,7 @@ Now compile the project by executing scons command. The output should be similar to this: - ptomulik@:$ scons + user@host:$ scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -215,15 +215,15 @@ Your program should be now ready. You may try it as follows (linux): - ptomulik@:$ LANG=en_US.UTF-8 ./hello + user@host:$ LANG=en_US.UTF-8 ./hello Welcome to beautiful world - ptomulik@:$ LANG=de_DE.UTF-8 ./hello + user@host:$ LANG=de_DE.UTF-8 ./hello Hallo Welt - ptomulik@:$ LANG=pl_PL.UTF-8 ./hello + user@host:$ LANG=pl_PL.UTF-8 ./hello Witaj swiecie @@ -233,7 +233,7 @@ swiecie\n". Run scons to see how scons reacts to this - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -266,7 +266,7 @@ msgmerge(1) program is used by SCons to update PO file. The output from compilation is like: - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -292,7 +292,7 @@ - The last example demonstrates what happens, if we change the source code + The next example demonstrates what happens, if we change the source code in such way, that the internationalized messages do not change. The answer is, that none of translation files (POT, PO) is touched (i.e. no content changes, no @@ -316,7 +316,7 @@ Compile project. You'll see on your screen - ptomulik@:$scons + user@host:$scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... diff --git a/doc/user/main.in b/doc/user/main.in index 0f8e305..61b544f 100644 --- a/doc/user/main.in +++ b/doc/user/main.in @@ -255,7 +255,7 @@ - Internaionalization and Localization with Gettext + Internationalization and localization with gettext &gettext; diff --git a/doc/user/main.xml b/doc/user/main.xml index 4b0807d..61b544f 100644 --- a/doc/user/main.xml +++ b/doc/user/main.xml @@ -65,6 +65,7 @@ + @@ -253,6 +254,11 @@ &variants; + + Internationalization and localization with gettext + &gettext; + +