From 045bb7d4cfc3e1a4c0c41619248211c7c3b9ca5a Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 6 Jun 2012 22:14:26 +0200 Subject: Added gettext tools --- doc/user/MANIFEST | 1 + doc/user/gettext.in | 351 ++++++++++++++++++++ doc/user/gettext.xml | 335 +++++++++++++++++++ doc/user/main.in | 6 + src/engine/MANIFEST.in | 11 + src/engine/SCons/Tool/GettextCommon.py | 444 ++++++++++++++++++++++++++ src/engine/SCons/Tool/gettext.py | 47 +++ src/engine/SCons/Tool/gettext.xml | 239 ++++++++++++++ src/engine/SCons/Tool/msgfmt.py | 101 ++++++ src/engine/SCons/Tool/msgfmt.xml | 101 ++++++ src/engine/SCons/Tool/msginit.py | 111 +++++++ src/engine/SCons/Tool/msginit.xml | 167 ++++++++++ src/engine/SCons/Tool/msgmerge.py | 97 ++++++ src/engine/SCons/Tool/msgmerge.xml | 157 +++++++++ src/engine/SCons/Tool/xgettext.py | 331 +++++++++++++++++++ src/engine/SCons/Tool/xgettext.xml | 288 +++++++++++++++++ test/GETTEXT/Translate_doc_user_examples1.py | 74 +++++ test/GETTEXT/Translate_doc_user_examples2.py | 86 +++++ test/GETTEXT/Translate_doc_user_examples3.py | 108 +++++++ test/GETTEXT/doc_user_examples1.py | 58 ++++ test/MSGFMT/MOFile_doc_user_examples1.py | 114 +++++++ test/MSGFMT/MOFile_doc_user_examples2.py | 114 +++++++ test/MSGFMT/MOFile_doc_user_examples3.py | 163 ++++++++++ test/MSGFMT/MOFile_doc_user_examples4.py | 115 +++++++ test/MSGINIT/POinit_doc_user_examples1.py | 87 +++++ test/MSGINIT/POinit_doc_user_examples2.py | 87 +++++ test/MSGINIT/POinit_doc_user_examples3.py | 87 +++++ test/MSGINIT/POinit_doc_user_examples4.py | 91 ++++++ test/MSGINIT/POinit_doc_user_examples5.py | 93 ++++++ test/MSGINIT/POinit_doc_user_examples6.py | 93 ++++++ test/MSGMERGE/POUpdate_doc_user_examples1.py | 137 ++++++++ test/MSGMERGE/POUpdate_doc_user_examples2.py | 137 ++++++++ test/MSGMERGE/POUpdate_doc_user_examples3.py | 138 ++++++++ test/MSGMERGE/POUpdate_doc_user_examples4.py | 144 +++++++++ test/MSGMERGE/POUpdate_doc_user_examples5.py | 143 +++++++++ test/MSGMERGE/POUpdate_doc_user_examples6.py | 194 +++++++++++ test/MSGMERGE/POUpdate_doc_user_examples8.py | 74 +++++ test/XGETTEXT/POTUpdate_doc_user_examples1.py | 82 +++++ test/XGETTEXT/POTUpdate_doc_user_examples2.py | 70 ++++ test/XGETTEXT/POTUpdate_doc_user_examples3.py | 67 ++++ test/XGETTEXT/POTUpdate_doc_user_examples4.py | 67 ++++ test/XGETTEXT/POTUpdate_doc_user_examples5.py | 81 +++++ 42 files changed, 5491 insertions(+) create mode 100644 doc/user/gettext.in create mode 100644 doc/user/gettext.xml create mode 100644 src/engine/SCons/Tool/GettextCommon.py create mode 100644 src/engine/SCons/Tool/gettext.py create mode 100644 src/engine/SCons/Tool/gettext.xml create mode 100644 src/engine/SCons/Tool/msgfmt.py create mode 100644 src/engine/SCons/Tool/msgfmt.xml create mode 100644 src/engine/SCons/Tool/msginit.py create mode 100644 src/engine/SCons/Tool/msginit.xml create mode 100644 src/engine/SCons/Tool/msgmerge.py create mode 100644 src/engine/SCons/Tool/msgmerge.xml create mode 100644 src/engine/SCons/Tool/xgettext.py create mode 100644 src/engine/SCons/Tool/xgettext.xml create mode 100644 test/GETTEXT/Translate_doc_user_examples1.py create mode 100644 test/GETTEXT/Translate_doc_user_examples2.py create mode 100644 test/GETTEXT/Translate_doc_user_examples3.py create mode 100644 test/GETTEXT/doc_user_examples1.py create mode 100644 test/MSGFMT/MOFile_doc_user_examples1.py create mode 100644 test/MSGFMT/MOFile_doc_user_examples2.py create mode 100644 test/MSGFMT/MOFile_doc_user_examples3.py create mode 100644 test/MSGFMT/MOFile_doc_user_examples4.py create mode 100644 test/MSGINIT/POinit_doc_user_examples1.py create mode 100644 test/MSGINIT/POinit_doc_user_examples2.py create mode 100644 test/MSGINIT/POinit_doc_user_examples3.py create mode 100644 test/MSGINIT/POinit_doc_user_examples4.py create mode 100644 test/MSGINIT/POinit_doc_user_examples5.py create mode 100644 test/MSGINIT/POinit_doc_user_examples6.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples1.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples2.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples3.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples4.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples5.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples6.py create mode 100644 test/MSGMERGE/POUpdate_doc_user_examples8.py create mode 100644 test/XGETTEXT/POTUpdate_doc_user_examples1.py create mode 100644 test/XGETTEXT/POTUpdate_doc_user_examples2.py create mode 100644 test/XGETTEXT/POTUpdate_doc_user_examples3.py create mode 100644 test/XGETTEXT/POTUpdate_doc_user_examples4.py create mode 100644 test/XGETTEXT/POTUpdate_doc_user_examples5.py diff --git a/doc/user/MANIFEST b/doc/user/MANIFEST index 0994f2b..21c63b0 100644 --- a/doc/user/MANIFEST +++ b/doc/user/MANIFEST @@ -18,6 +18,7 @@ example.xml factories.xml file-removal.xml functions.xml +gettext.xml hierarchy.xml install.xml java.xml diff --git a/doc/user/gettext.in b/doc/user/gettext.in new file mode 100644 index 0000000..63c1d20 --- /dev/null +++ b/doc/user/gettext.in @@ -0,0 +1,351 @@ + + + + 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. + + +
+ Prerequisites + + Setup your operating system, so you can use several languages. In following + examples we use locales en_US, de_DE, + and pl_PL. + + + + Ensure, that you have GNU gettext + utilities installed on your system. + + + + To edit translation files, you may install poedit editor. + +
+ +
+ Simple project + + Let's start with some simple project, the "Hello world" program + for example + + + /* hello.c */ + #include <stdio.h> + int main(int argc, char* argv[]) + { + printf("Hello world\n"); + return 0; + } + + + + Prepare simple SConstruct script to compile the + program. + + + # SConstruct + env = Environment() + hello = Program(["hello.c"]) + + + + + + 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 + http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, + 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. + + + + We first prepare the hello.c program, for + internationalization. Change the previous code so it reads as follows: + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + return 0; + } + + + This way we prepared source code. Detailed recipes for such preparation can + 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 + 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. + + + + Now we shall instruct SCons how to generate and maintain translation files. + For that, we use &b-link-Translate; builder and &b-link-MOFiles; builder. + First one takes a couple of source files, extracts internationalized + messages from them, creates so-called POT file + (translation template), and then creates PO translation + files, one for each requested language. Later, during the development + lifecycle, the builder keeps all these files up-to date. The + &b-link-MOFiles; builder compiles the PO files to binary + form. After all, we install the MO files under directory + called locale. + + + The complete code of + SConstruct script for multi-lingual "Hello world" will + be following: + + + # SConstruct + env = Environment( tools = ['default', 'gettext'] ) + hello = env.Program(["hello.c"]) + env['XGETTEXTFLAGS'] = [ + '--package-name=%s' % 'hello', + '--package-version=%s' % '1.0', + ] + po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) + mo = env.MOFiles(po) + InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) + InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) + InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) + + + + + Generate translation files with scons po-update. + You should see the output from SCons simillar to this: + + ptomulik@:$ scons po-update + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (new file) + msginit --no-translator -l pl -i messages.pot -o pl.po + Created pl.po. + msginit --no-translator -l en -i messages.pot -o en.po + Created en.po. + msginit --no-translator -l de -i messages.pot -o de.po + Created de.po. + scons: done building targets. + + + + + If everything is right, you shall see following new files. + + ptomulik@:$ ls *.po* + de.po en.po messages.pot pl.po + + + + + Open en.po in poedit and provide + english "translation" to message "Hello world\n". Do the + same for de.po (deutsch) and + pl.po (polish). Let the translations be, for example: + + + en: "Welcome to beautiful world!\n" + + + de: "Hallo Welt!\n" + + + pl: "Witaj swiecie!\n" + + + + + Now compile the project by executing scons command. The + output should be similar to this: + + ptomulik@:$ scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o de.mo de.po + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + SCons automatically compiled PO files to binary format + MO, and the InstallAs lines installed + these files under locale folder. + + + Your program should be now ready. You may try it as follows (linux): + + ptomulik@:$ LANG=en_US.UTF-8 ./hello + Welcome to beautiful world + + + ptomulik@:$ LANG=de_DE.UTF-8 ./hello + Hallo Welt + + + ptomulik@:$ LANG=pl_PL.UTF-8 ./hello + Witaj swiecie + + + + To demonstrate further life of translation files, let's change polish + translation (poedit pl.po) to "Witaj drogi + swiecie\n". Run scons to see how scons + reacts to this + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + Now, open hello.c and add another one + printf line with new message. + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + return 0; + } + + + + + Compile project with scons. This time, the + msgmerge(1) program is used by SCons to update + PO file. The output from compilation is like: + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (messages in file were outdated) + msgmerge --update de.po messages.pot + ... done. + msgfmt -c -o de.mo de.po + msgmerge --update en.po messages.pot + ... done. + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgmerge --update pl.po messages.pot + ... done. + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + The last 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 + creation/modification time changed and so on). Let's append another one + instruction to the program (after the last printf), so its code becomes: + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + printf("----------------\n"); + return a; + } + + + Compile project. You'll see on your screen + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Not writting 'messages.pot' (messages in file found to be up-to-date) + gcc -o hello.o -c hello.c + gcc -o hello hello.o + scons: done building targets. + + As you see, the internationalized messages ditn't change, so the + POT and the rest of translation files have not + even been touched. + +
diff --git a/doc/user/gettext.xml b/doc/user/gettext.xml new file mode 100644 index 0000000..9b1b631 --- /dev/null +++ b/doc/user/gettext.xml @@ -0,0 +1,335 @@ + + + + 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. + + +
+ Prerequisites + + Setup your operating system, so you can use several languages. In following + examples we use locales en_US, de_DE, + and pl_PL. + + + + Ensure, that you have GNU gettext + utilities installed on your system. + + + + To edit translation files, you may install poedit editor. + +
+ +
+ Simple project + + Let's start with some simple project, the "Hello world" program + for example + + /* hello.c */ + #include <stdio.h> + int main(int argc, char* argv[]) + { + printf("Hello world\n"); + return 0; + } + + + Prepare simple SConstruct script to compile the + program. + + # SConstruct + env = Environment() + hello = Program(["hello.c"]) + + + + + 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 + http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, + 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. + + + + We first prepare the hello.c program, for + internationalization. Change the previous code so it reads as follows: + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + return 0; + } + + This way we prepared source code. Detailed recipes for such preparation can + 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 + 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. + + + + Now we shall instruct SCons how to generate and maintain translation files. + For that, we use &b-link-Translate; builder and &b-link-MOFiles; builder. + First one takes a couple of source files, extracts internationalized + messages from them, creates so-called POT file + (translation template), and then creates PO translation + files, one for each requested language. Later, during the development + lifecycle, the builder keeps all these files up-to date. The + &b-link-MOFiles; builder compiles the PO files to binary + form. After all, we install the MO files under directory + called locale. + + + The complete code of + SConstruct script for multi-lingual "Hello world" will + be following: + + # SConstruct + env = Environment( tools = ['default', 'gettext'] ) + hello = env.Program(["hello.c"]) + env['XGETTEXTFLAGS'] = [ + '--package-name=%s' % 'hello', + '--package-version=%s' % '1.0', + ] + po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) + mo = env.MOFiles(po) + InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) + InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) + InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) + + + + Generate translation files with scons po-update. + You should see the output from SCons simillar to this: + + ptomulik@:$ scons po-update + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (new file) + msginit --no-translator -l pl -i messages.pot -o pl.po + Created pl.po. + msginit --no-translator -l en -i messages.pot -o en.po + Created en.po. + msginit --no-translator -l de -i messages.pot -o de.po + Created de.po. + scons: done building targets. + + + + + If everything is right, you shall see following new files. + + ptomulik@:$ ls *.po* + de.po en.po messages.pot pl.po + + + + + Open en.po in poedit and provide + english "translation" to message "Hello world\n". Do the + same for de.po (deutsch) and + pl.po (polish). Let the translations be, for example: + + + en: "Welcome to beautiful world!\n" + + + de: "Hallo Welt!\n" + + + pl: "Witaj swiecie!\n" + + + + + Now compile the project by executing scons command. The + output should be similar to this: + + ptomulik@:$ scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o de.mo de.po + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + SCons automatically compiled PO files to binary format + MO, and the InstallAs lines installed + these files under locale folder. + + + Your program should be now ready. You may try it as follows (linux): + + ptomulik@:$ LANG=en_US.UTF-8 ./hello + Welcome to beautiful world + + + ptomulik@:$ LANG=de_DE.UTF-8 ./hello + Hallo Welt + + + ptomulik@:$ LANG=pl_PL.UTF-8 ./hello + Witaj swiecie + + + + To demonstrate further life of translation files, let's change polish + translation (poedit pl.po) to "Witaj drogi + swiecie\n". Run scons to see how scons + reacts to this + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + Now, open hello.c and add another one + printf line with new message. + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + return 0; + } + + + + Compile project with scons. This time, the + msgmerge(1) program is used by SCons to update + PO file. The output from compilation is like: + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (messages in file were outdated) + msgmerge --update de.po messages.pot + ... done. + msgfmt -c -o de.mo de.po + msgmerge --update en.po messages.pot + ... done. + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgmerge --update pl.po messages.pot + ... done. + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + The last 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 + creation/modification time changed and so on). Let's append another one + instruction to the program (after the last printf), so its code becomes: + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + printf("----------------\n"); + return a; + } + + Compile project. You'll see on your screen + + ptomulik@:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Not writting 'messages.pot' (messages in file found to be up-to-date) + gcc -o hello.o -c hello.c + gcc -o hello hello.o + scons: done building targets. + + As you see, the internationalized messages ditn't change, so the + POT and the rest of translation files have not + even been touched. + +
diff --git a/doc/user/main.in b/doc/user/main.in index 4b0807d..0f8e305 100644 --- a/doc/user/main.in +++ b/doc/user/main.in @@ -65,6 +65,7 @@ + @@ -253,6 +254,11 @@ &variants; + + Internaionalization and Localization with Gettext + &gettext; + + + + +This is actually a toolset, which supports internationalization and +localization of sofware being constructed with SCons. The toolset loads +following tools: + + + + &t-link-xgettext; - to extract internationalized messages from source code to + POT file(s), + + + &t-link-msginit; - may be optionally used to initialize PO + files, + + + &t-link-msgmerge; - to update PO files, that already contain + translated messages, + + &t-link-msgfmt; - to compile textual PO file to binary + installable MO file. + + + +When you enable &t-gettext;, it internally loads all abovementioned tools, +so you're encouraged to see their individual documentation. + +Each of the above tools provides its own builder(s) which may be used to +perform particular activities related to software internationalization. You +may be however interested in top-level builders +&b-Translate; and &b-InstallMOFiles; described few paragraphs later. + +To use &t-gettext; tools, copy SConsToolGettext +folder to your site_scons/ and simply add +'gettext' tool to your environment: + + env = Environment( tools = ['default', 'gettext'] ) + + + + + + + + + + + +This pseudo-builder belongs to &t-link-gettext; toolset. The builder extracts +internationalized messages from source files, updates POT +template (if necessary) and then updates PO translations (if +necessary). If &cv-link-POAUTOINIT; is set, missing PO files +will be automatically created (i.e. without translator person intervention). +The variables &cv-link-LINGUAS_FILE; and &cv-link-POTDOMAIN; are taken into +acount too. All other construction variables used by &b-link-POTUpdate;, and +&b-link-POUpdate; work here too. + +Example 1. +The simplest way is to specify input files and output languages inline in +a SCons script when invoking &b-Translate; + +# SConscript in 'po/' directory +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) + + +Example 2. +If you wish, you may also stick to conventional style known from +autotools, i.e. using +POTFILES.in and LINGUAS files + +# LINGUAS +en pl +#end + + + +# POTFILES.in +a.cpp +b.cpp +# end + + + +# SConscript +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env['XGETTEXTPATH'] = ['../'] +env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') + + +The last approach is perhaps the recommended one. It allows easily split +internationalization/localization onto separate SCons scripts, where a script +in source tree is responsible for translations (from sources to +PO files) and script(s) under variant directories are +responsible for compilation of PO to MO +files to and for installation of MO files. The "gluing +factor" synchronizing these two scripts is then the content of +LINGUAS file. Note, that the updated +POT and PO files are usually going to be +committed back to the repository, so they must be updated within the source +directory (and not in variant directories). Additionaly, the file listing of +po/ directory contains LINGUAS file, +so the source tree looks familiar to translators, and they may work with the +project in their usual way. + +Example 3. +Let's prepare a development tree as below + + project/ + + SConstruct + + build/ + + src/ + + po/ + + SConscript + + SConscript.i18n + + POTFILES.in + + LINGUAS + +with build being variant directory. Write the top-level +SConstruct script as follows + + # SConstruct + env = Environment( tools = ["default", "gettext"] ) + VariantDir('build', 'src', duplicate = 0) + env['POAUTOINIT'] = 1 + SConscript('src/po/SConscript.i18n', exports = 'env') + SConscript('build/po/SConscript', exports = 'env') + +the src/po/SConscript.i18n as + + # src/po/SConscript.i18n + Import('env') + env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../']) + +and the src/po/SConscript + + # src/po/SConscript + Import('env') + env.MOFiles(LINGUAS_FILE = 1) + +Such setup produces POT and PO files +under source tree in src/po/ and binary +MO files under variant tree in +build/po/. This way the POT and +PO files are separated from other output files, which must +not be committed back to source repositories (e.g. MO +files). + +In above example, the PO files are not updated, +nor created automatically when you issue scons '.' command. +The files must be updated (created) by hand via scons +po-update and then MO files can be compiled by +running scons '.'. + + + + + + + + +The &cv-POTDOMAIN; defines default domain, used to generate +POT filename as &cv-POTDOMAIN;.pot when +no POT file name is provided by the user. This applies to +&b-link-POTUpdate;, &b-link-POInit; and &b-link-POUpdate; builders (and +builders, that use them, e.g. &b-Translate;). Normally (if &cv-POTDOMAIN; is +not defined), the builders use messages.pot as default +POT file name. + + + + + +The &cv-POAUTOINIT; variable, if set to True (on non-zero +numeric value), let the SConsToolGettext to automatically initialize +missing PO files with +msginit(1). This applies to both, +&b-link-POInit; and &b-link-POUpdate; builders (and others that use any of +them). + + + + + +The &cv-LINGUAS_FILE; defines file(s) containing list of additional linguas +to be processed by &b-link-POInit;, &b-link-POUpdate; or &b-link-MOFiles; +builders. It also affects &b-link-Translate; builder. If the variable contains +a string, it defines name of the list file. The &cv-LINGUAS_FILE; may be a +list of file names as well. If &cv-LINGUAS_FILE; is set to +True (or non-zero numeric value), the list will be read from +default file named +LINGUAS. + + + + + + +TODO: Try to remove me. + + +TODO: Try to remove me. + + diff --git a/src/engine/SCons/Tool/msgfmt.py b/src/engine/SCons/Tool/msgfmt.py new file mode 100644 index 0000000..ce8cff8 --- /dev/null +++ b/src/engine/SCons/Tool/msgfmt.py @@ -0,0 +1,101 @@ +""" msgfmt tool """ + +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +from SCons.Builder import BuilderBase +############################################################################# +class _MOFileBuilder(BuilderBase): + """ The builder class for `MO` files. + + The reason for this builder to exists and its purpose is quite simillar + as for `SConsToolGettext._POFileBuilder`. This time, we extend list of + sources, not targets, and call `BuilderBase._execute()` only once (as we + assume single-target here). + """ + + def _execute(self, env, target, source, *args, **kw): + # Here we add support for 'LINGUAS_FILE' keyword. Emitter is not suitable + # in this case, as it is called too late (after multiple sources + # are handled single_source builder. + import SCons.Util + from SCons.Tool.GettextCommon import _read_linguas_from_files + linguas_files = None + if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE'] is not None: + linguas_files = env['LINGUAS_FILE'] + # This should prevent from endless recursion. + env['LINGUAS_FILE'] = None + # We read only languages. Suffixes shall be added automatically. + linguas = _read_linguas_from_files(env, linguas_files) + if SCons.Util.is_List(source): + source.extend(linguas) + elif source is not None: + source = [source] + linguas + else: + source = linguas + result = BuilderBase._execute(self,env,target,source,*args, **kw) + if linguas_files is not None: + env['LINGUAS_FILE'] = linguas_files + return result +############################################################################# + +############################################################################# +def _create_mo_file_builder(env, **kw): + """ Create builder object for `MOFiles` builder """ + import SCons.Action + # FIXME: What factory use for source? Ours or their? + kw['action'] = SCons.Action.Action('$MSGFMTCOM','$MSGFMTCOMSTR') + kw['suffix'] = '$MOSUFFIX' + kw['src_suffix'] = '$POSUFFIX' + kw['src_builder'] = '_POUpdateBuilder' + kw['single_source'] = True + return _MOFileBuilder(**kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate `msgfmt` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import _detect_msgfmt + env['MSGFMT'] = _detect_msgfmt(env) + env.SetDefault( + MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], + MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', + MSGFMTCOMSTR = '', + MOSUFFIX = '.mo' + ) + env.Append( BUILDERS = { 'MOFiles' : _create_mo_file_builder(env) } ) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msgfmt_exists + return _msgfmt_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/msgfmt.xml b/src/engine/SCons/Tool/msgfmt.xml new file mode 100644 index 0000000..93e6e02 --- /dev/null +++ b/src/engine/SCons/Tool/msgfmt.xml @@ -0,0 +1,101 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides scons +interface to msgfmt(1) command, which generates binary +message catalog (MO) from a textual translation description +(PO). + + +MOSUFFIX +MSGFMT +MSGFMTCOM +MSGFMTCOMSTR +MSGFMTFLAGS + + +LINGUAS_FILE + + + + + +This builder belongs to &t-link-msgfmt; tool. The builder compiles +PO files to MO files. + +Example 1. +Create pl.mo and en.mo by compiling +pl.po and en.po: + + # ... + env.MOFiles(['pl', 'en']) + + +Example 2. +Compile files for languages defined in LINGUAS file: + + # ... + env.MOFiles(LINGUAS_FILE = 1) + + +Example 3. +Create pl.mo and en.mo by compiling +pl.po and en.po plus files for +languages defined in LINGUAS file: + + # ... + env.MOFiles(['pl', 'en'], LINGUAS_FILE = 1) + + +Example 4. +Compile files for languages defined in LINGUAS file +(another version): + + # ... + env['LINGUAS_FILE'] = 1 + env.MOFiles() + + + + + + +Suffix used for MO files (default: '.mo'). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Absolute path to msgfmt(1) binary, found by +Detect(). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Complete command line to run msgfmt(1) program. +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +String to display when msgfmt(1) is invoked +(default: '', which means ``print &cv-link-MSGFMTCOM;''). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Additional flags to msgfmt(1). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + diff --git a/src/engine/SCons/Tool/msginit.py b/src/engine/SCons/Tool/msginit.py new file mode 100644 index 0000000..164215b --- /dev/null +++ b/src/engine/SCons/Tool/msginit.py @@ -0,0 +1,111 @@ +""" msginit tool + +Tool specific initialization of msginit tool. +""" + +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Warnings +import SCons.Builder +import re + +############################################################################# +def _optional_no_translator_flag(env): + """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive + mode.""" + import SCons.Util + if env.has_key('POAUTOINIT'): + autoinit = env['POAUTOINIT'] + else: + autoinit = False + if autoinit: + return [SCons.Util.CLVar('--no-translator')] + else: + return [SCons.Util.CLVar('')] +############################################################################# + +############################################################################# +def _POInitBuilder(env, **kw): + """ Create builder object for `POInit` builder. """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder + action = SCons.Action.Action(_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POInitBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for _POFileBuilder. We use it to make user's life easier. + + This wrapper checks for `$POTDOMAIN` construction variable (or override in + `**kw`) and treats it appropriatelly. + """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN'): + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POInitBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `msginit` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import _detect_msginit + env['MSGINIT'] = _detect_msginit(env) + msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' + env.SetDefault( + POSUFFIX = '.po', + _MSGINITLOCALE = '${TARGET.filebase}', + _MSGNoTranslator = _optional_no_translator_flag, + MSGINITCOM = msginitcom, + MSGINITCOMSTR = '', + MSGINITFLAGS = [ ], + POAUTOINIT = False, + POCREATE_ALIAS = 'po-create' + ) + env.Append( BUILDERS = { '_POInitBuilder' : _POInitBuilder(env) } ) + env.AddMethod(_POInitBuilderWrapper, 'POInit') + env.AlwaysBuild(env.Alias('$POCREATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msginit_exists + return _msginit_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml new file mode 100644 index 0000000..527a168 --- /dev/null +++ b/src/engine/SCons/Tool/msginit.xml @@ -0,0 +1,167 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to msginit(1) program, which creates new +PO file, initializing the meta information with values from +user's environment (or options). + + +MSGINIT +MSGINITCOM +MSGINITCOMSTR +MSGINITFLAGS +POAUTOINIT +POCREATE_ALIAS +POSUFFIX +_MSGINITLOCALE + + +POTDOMAIN +LINGUAS_FILE +POAUTOINIT + + + + + +This builder belongs to &t-link-msginit; tool. The builder initializes missing +PO file(s) if &cv-link-POAUTOINIT; is set. If +&cv-link-POAUTOINIT; is not set (default), &b-POInit; prints instruction for +user (that is supposed to be a translator), telling how the +PO file should be initialized. In normal projects +you should not use &b-POInit; and use &b-link-POUpdate; +instead. &b-link-POUpdate; chooses intelligently between +msgmerge(1) and msginit(1). &b-POInit; +always uses msginit(1) and should be regarded as builder for +special purposes or for temporary use (e.g. for quick, one time initialization +of a bunch of PO files) or for tests. + +Target nodes defined through &b-POInit; are not built by default (they're +Ignored from '.' node) but are added to +special Alias ('po-create' by default). +The alias name may be changed through the &cv-link-POCREATE_ALIAS; +construction variable. All PO files defined through +&b-POInit; may be easily initialized by scons po-create. + +Example 1. +Initialize en.po and pl.po from +messages.pot: + + # ... + env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po] + + +Example 2. +Initialize en.po and pl.po from +foo.pot: + + # ... + env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po] + + +Example 3. +Initialize en.po and pl.po from +foo.pot but using &cv-link-POTDOMAIN; construction +variable: + + # ... + env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] + + +Example 4. +Initialize PO files for languages defined in +LINGUAS file. The files will be initialized from template +messages.pot: + + # ... + env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file + + +Example 5. +Initialize en.po and pl.pl +PO files plus files for languages defined in +LINGUAS file. The files will be initialized from template +messages.pot: + + # ... + env.POInit(['en', 'pl'], LINGUAS_FILE = 1) + + +Example 6. +You may preconfigure your environment first, and then initialize +PO files: + + # ... + env['POAUTOINIT'] = 1 + env['LINGUAS_FILE'] = 1 + env['POTDOMAIN'] = 'foo' + env.POInit() + +which has same efect as: + + # ... + env.POInit(POAUTOINIT = 1, LINGUAS_FILE = 1, POTDOMAIN = 'foo') + + + + + + + +Common alias for all PO files created with &b-POInit; +builder (default: 'po-create'). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Suffix used for PO files (default: '.po') +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Path to msginit(1) program (found via +Detect()). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Complete command line to run msginit(1) program. +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +String to display when msginit(1) is invoked +(default: '', which means ``print &cv-link-MSGINITCOM;''). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +List of additional flags to msginit(1) (default: +[]). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Internal ``macro''. Computes locale (language) name based on target filename +(default: '${TARGET.filebase}' ). + +See &t-link-msginit; tool and &b-link-POInit; builder. + diff --git a/src/engine/SCons/Tool/msgmerge.py b/src/engine/SCons/Tool/msgmerge.py new file mode 100644 index 0000000..19db36c --- /dev/null +++ b/src/engine/SCons/Tool/msgmerge.py @@ -0,0 +1,97 @@ +""" msgmerget tool + +Tool specific initialization for `msgmerge` tool. +""" + +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +############################################################################# +def _update_or_init_po_files(target, source, env): + """ Action function for `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files + for tgt in target: + if tgt.rexists(): + action = SCons.Action.Action('$MSGMERGECOM', '$MSGMERGECOMSTR') + else: + action = _init_po_files + status = action([tgt], source, env) + if status : return status + return 0 +############################################################################# + +############################################################################# +def _POUpdateBuilder(env, **kw): + """ Create an object of `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _POFileBuilder + action = SCons.Action.Action(_update_or_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POUPDATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for `POUpdate` builder - make user's life easier """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN') and env['POTDOMAIN']: + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POUpdateBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `xgettext` tool """ + from SCons.Tool.GettextCommon import _detect_msgmerge + env['MSGMERGE'] = _detect_msgmerge(env) + env.SetDefault( + POSUFFIX = '.po', + MSGMERGECOM = '$MSGMERGE $MSGMERGEFLAGS --update $TARGET $SOURCE', + MSGMERGECOMSTR = '', + MSGMERGEFLAGS = [ ], + POUPDATE_ALIAS = 'po-update' + ) + env.Append(BUILDERS = { '_POUpdateBuilder':_POUpdateBuilder(env) }) + env.AddMethod(_POUpdateBuilderWrapper, 'POUpdate') + env.AlwaysBuild(env.Alias('$POUPDATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msgmerge_exists + return _msgmerge_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/msgmerge.xml b/src/engine/SCons/Tool/msgmerge.xml new file mode 100644 index 0000000..1c567a1 --- /dev/null +++ b/src/engine/SCons/Tool/msgmerge.xml @@ -0,0 +1,157 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to msgmerge(1) command, which merges two +Uniform style .po files together. + + +MSGMERGE +MSGMERGECOM +MSGMERGECOMSTR +MSGMERGEFLAGS +POSUFFIX +POUPDATE_ALIAS + + +POTDOMAIN +LINGUAS_FILE +POAUTOINIT + + + + + +The builder belongs to &t-link-msgmerge; tool. The builder updates +PO files with msgmerge(1), or initializes +missing PO files as described in documentation of +&t-link-msginit; tool and &b-link-POInit; builder (see also +&cv-link-POAUTOINIT;). Note, that &b-POUpdate; does not add its +targets to po-create alias as &b-link-POInit; +does. + +Target nodes defined through &b-POUpdate; are not built by default +(they're Ignored from '.' node). Instead, +they are added automatically to special Alias +('po-update' by default). The alias name may be changed +through the &cv-link-POUPDATE_ALIAS; construction variable. You can easilly +update PO files in your project by scons +po-update. + +Example 1. +Update en.po and pl.po from +messages.pot template (see also &cv-link-POTDOMAIN;), +assuming that the later one exists or there is rule to build it (see +&b-link-POTUpdate;): + + # ... + env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po] + + +Example 2. +Update en.po and pl.po from +foo.pot template: + + # ... + env.POUpdate(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.pl] + + +Example 3. +Update en.po and pl.po from +foo.pot (another version): + + # ... + env.POUpdate(['en', 'pl'], POTDOMAIN='foo') # foo.pot -- > [en.po, pl.pl] + + +Example 4. +Update files for languages defined in LINGUAS file. The +files are updated from messages.pot template: + + # ... + env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file + + +Example 5. +Same as above, but update from foo.pot template: + + # ... + env.POUpdate(LINGUAS_FILE = 1, source = ['foo']) + + +Example 6. +Update en.po and pl.po plus files for +languages defined in LINGUAS file. The files are updated +from messages.pot template: + + # produce 'en.po', 'pl.po' + files defined in 'LINGUAS': + env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1) + + +Example 7. +Use &cv-link-POAUTOINIT; to automatically initialize PO file +if it doesn't exist: + + # ... + env.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1) + + +Example 8. +Update PO files for languages defined in +LINGUAS file. The files are updated from +foo.pot template. All necessary settings are +pre-configured via environment. + + # ... + env['POAUTOINIT'] = 1 + env['LINGUAS_FILE'] = 1 + env['POTDOMAIN'] = 'foo' + env.POUpdate() + + + + + + + + +Common alias for all PO files being defined with +&b-link-POUpdate; builder (default: 'po-update'). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Absolute path to msgmerge(1) binary as found by +Detect(). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Complete command line to run msgmerge(1) command. +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +String to be displayed when msgmerge(1) is invoked +(default: '', which means ``print &cv-link-MSGMERGECOM;''). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Additional flags to msgmerge(1) command. +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py new file mode 100644 index 0000000..0495174 --- /dev/null +++ b/src/engine/SCons/Tool/xgettext.py @@ -0,0 +1,331 @@ +""" xgettext tool + +Tool specific initialization of `xgettext` tool. +""" + +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +############################################################################# +class _CmdRunner(object): + """ Callabe object, which runs shell command storing its stdout and stderr to + variables. It also provides `strfunction()` method, which shall be used by + scons Action objects to print command string. """ + + def __init__( self, command, commandstr = None): + self.out = None + self.err = None + self.status = None + self.command = command + self.commandstr = commandstr + + def __call__(self, target, source, env): + import SCons.Action + import subprocess + import os + import sys + kw = { + 'stdin' : 'devnull', + 'stdout' : subprocess.PIPE, + 'stderr' : subprocess.PIPE, + 'universal_newlines' : True, + 'shell' : True + } + command = env.subst(self.command, target = target, source = source) + proc = SCons.Action._subproc(env, command, **kw) + self.out, self.err = proc.communicate() + self.status = proc.wait() + if self.err: sys.stderr.write(unicode(self.err)) + return self.status + + def strfunction(self, target, source, env): + import os + comstr = self.commandstr + if env.subst(comstr, target = target, source = source) == "": + comstr = self.command + s = env.subst(comstr, target = target, source = source) + return s +############################################################################# + +############################################################################# +def _update_pot_file(target, source, env): + """ Action function for `POTUpdate` builder """ + import re + import os + import SCons.Action + nop = lambda target, source, env : 0 + + # Save scons cwd and os cwd (NOTE: they may be different. After the job, we + # revert ech one to its original state). + save_cwd = env.fs.getcwd() + save_os_cwd = os.getcwd() + chdir = target[0].dir + chdir_str = repr(chdir.get_abspath()) + # Print chdir message (employ SCons.Action.Action for that. It knows better + # than me how to to this correctly). + env.Execute(SCons.Action.Action(nop, "Entering " + chdir_str)) + # Go to target's directory and do our job + env.fs.chdir(chdir, 1) # Go into target's directory + try: + cmd = _CmdRunner('$XGETTEXTCOM', '$XGETTEXTCOMSTR') + action = SCons.Action.Action(cmd, strfunction=cmd.strfunction) + status = action([ target[0] ], source, env) + except: + # Something went wrong. + env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) + # Revert working dirs to previous state and re-throw exception. + env.fs.chdir(save_cwd, 0) + os.chdir(save_os_cwd) + raise + # Print chdir message. + env.Execute(SCons.Action.Action(nop, "Leaving " + chdir_str)) + # Revert working dirs to previous state. + env.fs.chdir(save_cwd, 0) + os.chdir(save_os_cwd) + # If the command was not successfull, return error code. + if status: return status + + new_content = cmd.out + + if not new_content: + # When xgettext finds no internationalized messages, no *.pot is created + # (because we don't want to bother translators with empty POT files). + needs_update = False + explain = "no internationalized messages encountered" + else: + if target[0].exists(): + # If the file already exists, it's left unaltered unless its messages + # are outdated (w.r.t. to these recovered by xgettext from sources). + old_content = target[0].get_text_contents() + re_cdate = re.compile(r'^"POT-Creation-Date: .*"$[\r\n]?', re.M) + old_content_nocdate = re.sub(re_cdate,"",old_content) + new_content_nocdate = re.sub(re_cdate,"",new_content) + if(old_content_nocdate == new_content_nocdate): + # Messages are up-to-date + needs_update = False + explain = "messages in file found to be up-to-date" + else: + # Messages are outdated + needs_update = True + explain = "messages in file were outdated" + else: + # No POT file found, create new one + needs_update = True + explain = "new file" + if needs_update: + # Print message employing SCons.Action.Action for that. + msg = "Writting " + repr(str(target[0])) + " (" + explain + ")" + env.Execute(SCons.Action.Action(nop, msg)) + f = open(str(target[0]),"w") + f.write(new_content) + f.close() + return 0 + else: + # Print message employing SCons.Action.Action for that. + msg = "Not writting " + repr(str(target[0])) + " (" + explain + ")" + env.Execute(SCons.Action.Action(nop, msg)) + return 0 +############################################################################# + +############################################################################# +from SCons.Builder import BuilderBase +############################################################################# +class _POTBuilder(BuilderBase): + def _execute(self, env, target, source, *args): + if not target: + if env.has_key('POTDOMAIN') and env['POTDOMAIN']: + domain = env['POTDOMAIN'] + else: + domain = 'messages' + target = [ domain ] + return BuilderBase._execute(self, env, target, source, *args) +############################################################################# + +############################################################################# +def _scan_xgettext_from_files(target, source, env, files = None, path = None): + """ Parses `POTFILES.in`-like file and returns list of extracted file names. + """ + import re + import SCons.Util + import SCons.Node.FS + + if files is None: + return 0 + if not SCons.Util.is_List(files): + files = [ files ] + + if path is None: + if env.has_key('XGETTEXTPATH'): + path = env['XGETTEXTPATH'] + else: + path = [] + if not SCons.Util.is_List(path): + path = [ path ] + + dirs = () + for p in path: + if not isinstance(p, SCons.Node.FS.Base): + if SCons.Util.is_String(p): + p = env.subst(p, source = source, target = target) + p = env.arg2nodes(p, env.fs.Dir) + if SCons.Util.is_List(p): + dirs = dirs + tuple(p) + else: + dirs += (p,) + if not dirs: + dirs = (env.fs.getcwd(),) + + re_comment = re.compile(r'^#[^\n\r]*$\r?\n?', re.M) + re_emptyln = re.compile(r'^[ \t\r]*$\r?\n?', re.M) + re_trailws = re.compile(r'[ \t\r]+$') + for f in files: + # Find files in search path $XGETTEXTPATH + if isinstance(f, SCons.Node.FS.Base) and f.rexists(): + contents = f.get_text_contents() + contents = re_comment.sub("", contents) + contents = re_emptyln.sub("", contents) + contents = re_trailws.sub("", contents) + depnames = contents.splitlines() + for depname in depnames: + depfile = SCons.Node.FS.find_file(depname, dirs) + if not depfile: + depfile = env.arg2nodes(depname, dirs[0].File) + env.Depends(target, depfile) + return 0 +############################################################################# + +############################################################################# +def _pot_update_emitter(target, source, env): + """ Emitter function for `POTUpdate` builder """ + from SCons.Tool.GettextCommon import _POTargetFactory + import SCons.Util + import SCons.Node.FS + + if env.has_key('XGETTEXTFROM'): + xfrom = env['XGETTEXTFROM'] + else: + return target, source + if not SCons.Util.is_List(xfrom): + xfrom = [ xfrom ] + + files = [] + for xf in xfrom: + if not isinstance(xf, SCons.Node.FS.Base): + if SCons.Util.is_String(xf): + xf = env.subst(xf, source = source, target = target) + xf = env.arg2nodes(xf) + if SCons.Util.is_List(xf): + files.extend(xf) + else: + files.append(xf) + if files: + env.Depends(target, files) + _scan_xgettext_from_files(target, source, env, files) + return target, source +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POTUpdateBuilderWrapper(env, target=None, source=_null, **kw): + return env._POTUpdateBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def _POTUpdateBuilder(env, **kw): + """ Creates `POTUpdate` builder object """ + import SCons.Action + from SCons.Tool.GettextCommon import _POTargetFactory + kw['action'] = SCons.Action.Action(_update_pot_file, None) + kw['suffix'] = '$POTSUFFIX' + kw['target_factory'] = _POTargetFactory(env, alias='$POTUPDATE_ALIAS').File + kw['emitter'] = _pot_update_emitter + return _POTBuilder(**kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate `xgettext` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import RPaths, _detect_xgettext + + env['XGETTEXT'] = _detect_xgettext(env) + # NOTE: sources="$SOURCES" would work as well. However, we use following + # construction to convert absolute paths provided by scons onto paths + # relative to current working dir. Note, that scons expands $SOURCE(S) to + # absolute paths for sources $SOURCE(s) outside of current subtree (e.g. in + # "../"). With source=$SOURCE these absolute paths would be written to the + # resultant *.pot file (and its derived *.po files) as references to lines in + # source code (e.g. referring lines in *.c files). Such references would be + # correct (e.g. in poedit) only on machine on which *.pot was generated and + # would be of no use on other hosts (having a copy of source code located + # in different place in filesystem). + sources = '$( ${_concat( "", SOURCES, "", __env__, XgettextRPaths, TARGET' \ + + ', SOURCES)} $)' + + # NOTE: the output from $XGETTEXTCOM command must go to stdout, not to a file. + # This is required by the POTUpdate builder's action. + xgettextcom = '$XGETTEXT $XGETTEXTFLAGS $_XGETTEXTPATHFLAGS' \ + + ' $_XGETTEXTFROMFLAGS -o - ' + sources + + xgettextpathflags = '$( ${_concat( XGETTEXTPATHPREFIX, XGETTEXTPATH' \ + + ', XGETTEXTPATHSUFFIX, __env__, RDirs, TARGET, SOURCES)} $)' + xgettextfromflags = '$( ${_concat( XGETTEXTFROMPREFIX, XGETTEXTFROM' \ + + ', XGETTEXTFROMSUFFIX, __env__, target=TARGET, source=SOURCES)} $)' + + env.SetDefault( + _XGETTEXTDOMAIN = '${TARGET.filebase}', + XGETTEXTFLAGS = [ ], + XGETTEXTCOM = xgettextcom, + XGETTEXTCOMSTR = '', + XGETTEXTPATH = [ ], + XGETTEXTPATHPREFIX = '-D', + XGETTEXTPATHSUFFIX = '', + XGETTEXTFROM = None, + XGETTEXTFROMPREFIX = '-f', + XGETTEXTFROMSUFFIX = '', + _XGETTEXTPATHFLAGS = xgettextpathflags, + _XGETTEXTFROMFLAGS = xgettextfromflags, + POTSUFFIX = ['.pot'], + POTUPDATE_ALIAS = 'pot-update', + XgettextRPaths = RPaths(env) + ) + env.Append( BUILDERS = { + '_POTUpdateBuilder' : _POTUpdateBuilder(env) + } ) + env.AddMethod(_POTUpdateBuilderWrapper, 'POTUpdate') + env.AlwaysBuild(env.Alias('$POTUPDATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check, whether the tool exists """ + from SCons.Tool.GettextCommon import _xgettext_exists + return _xgettext_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/xgettext.xml b/src/engine/SCons/Tool/xgettext.xml new file mode 100644 index 0000000..0a919d6 --- /dev/null +++ b/src/engine/SCons/Tool/xgettext.xml @@ -0,0 +1,288 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to xgettext(1) +program, which extracts internationalized messages from source code. The tool +provides &b-POTUpdate; builder to make PO +Template files. + + +POTSUFFIX +POTUPDATE_ALIAS +XGETTEXTCOM +XGETTEXTCOMSTR +XGETTEXTFLAGS +XGETTEXTFROM +XGETTEXTFROMPREFIX +XGETTEXTFROMSUFFIX +XGETTEXTPATH +XGETTEXTPATHPREFIX +XGETTEXTPATHSUFFIX +_XGETTEXTDOMAIN +_XGETTEXTFROMFLAGS +_XGETTEXTPATHFLAGS + + +POTDOMAIN + + + + + +The builder belongs to &t-link-xgettext; tool. The builder updates target +POT file if exists or creates one if it doesn't. The node is +not built by default (i.e. it is Ignored from +'.'), but only on demand (i.e. when given +POT file is required or when special alias is invoked). This +builder adds its targe node (messages.pot, say) to a +special alias (pot-update by default, see +&cv-link-POTUPDATE_ALIAS;) so you can update/create them easily with +scons pot-update. The file is not written until there is no +real change in internationalized messages (or in comments that enter +POT file). + + You may see xgettext(1) being invoked by the +&t-link-xgettext; tool even if there is no real change in internationalized +messages (so the POT file is not being updated). This +happens every time a source file has changed. In such case we invoke +xgettext(1) and compare its output with the content of +POT file to decide whether the file should be updated or +not. + +Example 1. +Let's create po/ directory and place following +SConstruct script there: + + # SConstruct in 'po/' subdir + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) + env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) + +Then invoke scons few times: + + user@host:$ scons # Does not create foo.pot nor bar.pot + user@host:$ scons foo.pot # Updates or creates foo.pot + user@host:$ scons pot-update # Updates or creates foo.pot and bar.pot + user@host:$ scons -c # Does not clean foo.pot nor bar.pot. + +the results shall be as the comments above say. + +Example 2. +The &b-POTUpdate; builder may be used with no target specified, in which +case default target messages.pot will be used. The +default target may also be overriden by setting &cv-link-POTDOMAIN; construction +variable or providing it as an override to &b-POTUpdate; builder: + + # SConstruct script + env = Environment( tools = ['default', 'xgettext'] ) + env['POTDOMAIN'] = "foo" + env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ... + env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot + + +Example 3. +The sources may be specified within separate file, for example +POTFILES.in: + + # POTFILES.in in 'po/' subdirectory + ../a.cpp + ../b.cpp + # end of file + +The name of the file (POTFILES.in) containing the list of +sources is provided via &cv-link-XGETTEXTFROM;: + + # SConstruct file in 'po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') + + +Example 4. +You may use &cv-link-XGETTEXTPATH; to define source search path. Assume, for +example, that you have files a.cpp, +b.cpp, po/SConstruct, +po/POTFILES.in. Then your POT-related +files could look as below: + + # POTFILES.in in 'po/' subdirectory + a.cpp + b.cpp + # end of file + + + + # SConstruct file in 'po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../') + + +Example 5. +Multiple search directories may be defined within a list, i.e. +XGETTEXTPATH = ['dir1', 'dir2', ...]. The order in the list +determines the search order of source files. The path to the first file found +is used. + +Let's create 0/1/po/SConstruct script: + + # SConstruct file in '0/1/po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../']) + +and 0/1/po/POTFILES.in: + + # POTFILES.in in '0/1/po/' subdirectory + a.cpp + # end of file + +Write two *.cpp files, the first one is +0/a.cpp: + + /* 0/a.cpp */ + gettext("Hello from ../../a.cpp") + +and the second is 0/1/a.cpp: + + /* 0/1/a.cpp */ + gettext("Hello from ../a.cpp") + +then run scons. You'll obtain 0/1/po/messages.pot with the +message "Hello from ../a.cpp". When you reverse order in +$XGETTEXTFOM, i.e. when you write SConscript as + + # SConstruct file in '0/1/po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) + then the messages.pot will contain +msgid "Hello from ../../a.cpp" line and not +msgid "Hello from ../a.cpp". + + + + + + + + +Suffix used for PO Template files (default: '.pot'). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Name of the common phony target for all PO Templates created with +&b-link-POUpdate; (default: 'pot-update'). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Path to xgettext(1) program (found via +Detect()). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Complete xgettext command line. +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +A string that is shown when xgettext(1) command is invoked +(default: '', which means "print &cv-link-XGETTEXTCOM;"). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Additional flags to xgettext(1). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Name of file containing list of xgettext(1)'s source +files. Autotools' users know this as POTFILES.in so they +will in most cases set XGETTEXTFROM="POTFILES.in" here. +The &cv-XGETTEXTFROM; files have same syntax and semantics as the well known +GNU POTFILES.in. +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +List of directories, there xgettext(1) will look for +source files (default: []). + +This variable works only together with &cv-link-XGETTEXTFROM; + +See also &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +This flag is used to add single search path to +xgettext(1)'s commandline (default: +'-D'). + + + + + +(default: '') + + + + + +This flag is used to add single &cv-link-XGETTEXTFROM; file to +xgettext(1)'s commandline (default: +'-f'). + + + + + +(default: '') + + + + + +Internal "macro". Generates xgettext domain name +form source and target (default: '${TARGET.filebase}'). + + + + + +Internal "macro". Genrates list of -D<dir> flags +from the &cv-link-XGETTEXTPATH; list. + + + + + +Internal "macro". Generates list of -f<file> flags +from &cv-link-XGETTEXTFROM;. + + + + diff --git a/test/GETTEXT/Translate_doc_user_examples1.py b/test/GETTEXT/Translate_doc_user_examples1.py new file mode 100644 index 0000000..946f18b --- /dev/null +++ b/test/GETTEXT/Translate_doc_user_examples1.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +# NOTE: When integrating into upstream SCons development tree, remove the next +# line, and the "toolpath = ..." line +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.subdir('po/') +test.write('po/SConstruct', +""" +env = Environment( + toolpath = ['""" + site_scons + """/SConsToolGettext'] +, tools = ["default", "gettext"] +) +env['POAUTOINIT'] = 1 +env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) +""") +# +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None, chdir = 'po') +test.must_exist('po/messages.pot') +test.must_exist('po/en.po', 'po/pl.po') +test.must_contain('po/en.po', "Hello from a.cpp") +test.must_contain('po/en.po', "Hello from b.cpp") +test.must_contain('po/pl.po', "Hello from a.cpp") +test.must_contain('po/pl.po', "Hello from b.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/Translate_doc_user_examples2.py b/test/GETTEXT/Translate_doc_user_examples2.py new file mode 100644 index 0000000..51464d4 --- /dev/null +++ b/test/GETTEXT/Translate_doc_user_examples2.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +# NOTE: When integrating into upstream SCons development tree, remove the next +# line, and the "toolpath = ..." line +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.subdir('po/') +test.write('po/SConstruct', +""" +env = Environment( + toolpath = ['""" + site_scons + """/SConsToolGettext'] +, tools = ["default", "gettext"] +) +env['POAUTOINIT'] = 1 +env['XGETTEXTPATH'] = ['../'] +env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') +""") +# +test.write('po/LINGUAS', """\ +en pl +""") +# +test.write('po/POTFILES.in', """\ +# POTFILES.in +a.cpp +b.cpp +# end +""") +# +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None, chdir = 'po') +test.must_exist('po/messages.pot') +test.must_exist('po/en.po', 'po/pl.po') +test.must_contain('po/en.po', "Hello from a.cpp") +test.must_contain('po/en.po', "Hello from b.cpp") +test.must_contain('po/pl.po', "Hello from a.cpp") +test.must_contain('po/pl.po', "Hello from b.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/Translate_doc_user_examples3.py b/test/GETTEXT/Translate_doc_user_examples3.py new file mode 100644 index 0000000..6a93b5e --- /dev/null +++ b/test/GETTEXT/Translate_doc_user_examples3.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +# NOTE: When integrating into upstream SCons development tree, remove the next +# line, and the "toolpath = ..." line +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.subdir('src', ['src', 'po'], 'build') +test.write('SConstruct', +""" +env = Environment( + toolpath = ['""" + site_scons + """/SConsToolGettext'] +, tools = ["default", "gettext"] +) +VariantDir('build', 'src', duplicate = 0) +env['POAUTOINIT'] = 1 +SConscript('src/po/SConscript.i18n', exports = 'env') +SConscript('build/po/SConscript', exports = 'env') +""") +# +test.write('src/po/SConscript.i18n', """\ +# src/po/SConscript.i18n +Import('env') +env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../']) +""") +# +test.write('src/po/SConscript',"""\ +# src/po/SConscript +Import('env') +env.MOFiles(LINGUAS_FILE = 1) +""") +test.write('src/po/LINGUAS', """\ +en pl +""") +# +test.write('src/po/POTFILES.in', """\ +# POTFILES.in +a.cpp +b.cpp +# end +""") +# +test.write('src/a.cpp', """ gettext("Hello from a.cpp") """) +test.write('src/b.cpp', """ gettext("Hello from b.cpp") """) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('src/po/messages.pot') +test.must_exist('src/po/en.po', 'src/po/pl.po') +test.must_not_exist('build/po/en.po', 'build/po/pl.po') +test.must_contain('src/po/en.po', "Hello from a.cpp") +test.must_contain('src/po/en.po', "Hello from b.cpp") +test.must_contain('src/po/pl.po', "Hello from a.cpp") +test.must_contain('src/po/pl.po', "Hello from b.cpp") + +test.run(arguments = '.', stderr = None) +test.must_exist('build/po/en.mo', 'build/po/pl.mo') +test.must_not_exist('src/po/en.mo', 'src/po/pl.mo') + +test.run(arguments = '-c', stderr = None) +test.must_exist('src/po/messages.pot') +test.must_exist('src/po/en.po', 'src/po/pl.po') +test.must_not_exist('build/po/en.mo', 'build/po/pl.mo') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/doc_user_examples1.py b/test/GETTEXT/doc_user_examples1.py new file mode 100644 index 0000000..3d05a21 --- /dev/null +++ b/test/GETTEXT/doc_user_examples1.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +# NOTE: When integrating into upstream SCons development tree, remove the next +# line, and the "toolpath = ..." line +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( + toolpath = ['""" + site_scons + """/SConsToolGettext'] +, tools = ["default", "gettext"] +) +""") +test.run(arguments = '.') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples1.py b/test/MSGFMT/MOFile_doc_user_examples1.py new file mode 100644 index 0000000..71b5996 --- /dev/null +++ b/test/MSGFMT/MOFile_doc_user_examples1.py @@ -0,0 +1,114 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.MOFiles(['pl', 'en']) +""") +# +##test.write('LINGUAS', +##""" +##en +##pl +##""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +test.run(arguments = '.') +test.must_exist('en.mo', 'pl.mo') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples2.py b/test/MSGFMT/MOFile_doc_user_examples2.py new file mode 100644 index 0000000..ad67b3e --- /dev/null +++ b/test/MSGFMT/MOFile_doc_user_examples2.py @@ -0,0 +1,114 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.MOFiles(LINGUAS_FILE = 1) +""") +# +test.write('LINGUAS', +""" +en +pl +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +test.run(arguments = '.') +test.must_exist('en.mo', 'pl.mo') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples3.py b/test/MSGFMT/MOFile_doc_user_examples3.py new file mode 100644 index 0000000..e7cc0ff --- /dev/null +++ b/test/MSGFMT/MOFile_doc_user_examples3.py @@ -0,0 +1,163 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.MOFiles(['en', 'pl'], LINGUAS_FILE = 1) +""") +test.write('LINGUAS', +""" +de +fr +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") +# +test.write('de.po',"""\ +# German translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: de\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""") +# +test.write('fr.po',"""\ +# French translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: fr\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""") + +test.run(arguments = '.') +test.must_exist('en.mo', 'pl.mo', 'de.mo', 'fr.mo') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples4.py b/test/MSGFMT/MOFile_doc_user_examples4.py new file mode 100644 index 0000000..8737b2b --- /dev/null +++ b/test/MSGFMT/MOFile_doc_user_examples4.py @@ -0,0 +1,115 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['LINGUAS_FILE'] = 1 +env.MOFiles() +""") +# +test.write('LINGUAS', +""" +en +pl +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +test.run(arguments = '.') +test.must_exist('en.mo', 'pl.mo') + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples1.py b/test/MSGINIT/POinit_doc_user_examples1.py new file mode 100644 index 0000000..9082a11 --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples1.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl']) # messages.pot --> [en.po, pl.po] +""") +# +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples2.py b/test/MSGINIT/POinit_doc_user_examples2.py new file mode 100644 index 0000000..a96d921 --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples2.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples3.py b/test/MSGINIT/POinit_doc_user_examples3.py new file mode 100644 index 0000000..f21f874 --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples3.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples4.py b/test/MSGINIT/POinit_doc_user_examples4.py new file mode 100644 index 0000000..2bcb68e --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples4.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +test.write('LINGUAS',""" +en +pl +""") +# +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples5.py b/test/MSGINIT/POinit_doc_user_examples5.py new file mode 100644 index 0000000..c3971e7 --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples5.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en', 'pl'], LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +test.write('LINGUAS',""" +de +fr +""") +# +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po', 'de.po', 'fr.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") +test.must_contain('de.po', "Hello from a.cpp") +test.must_contain('fr.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples6.py b/test/MSGINIT/POinit_doc_user_examples6.py new file mode 100644 index 0000000..bf694fa --- /dev/null +++ b/test/MSGINIT/POinit_doc_user_examples6.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env['LINGUAS_FILE'] = 1 +env['POTDOMAIN'] = 'foo' +env.POInit() +""") +test.write('LINGUAS',""" +en +pl +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples1.py b/test/MSGMERGE/POUpdate_doc_user_examples1.py new file mode 100644 index 0000000..d925568 --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples1.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po] +""") +# +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples2.py b/test/MSGMERGE/POUpdate_doc_user_examples2.py new file mode 100644 index 0000000..0126391 --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples2.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples3.py b/test/MSGMERGE/POUpdate_doc_user_examples3.py new file mode 100644 index 0000000..31c09c5 --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples3.py @@ -0,0 +1,138 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples4.py b/test/MSGMERGE/POUpdate_doc_user_examples4.py new file mode 100644 index 0000000..51d944f --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples4.py @@ -0,0 +1,144 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +# +test.write('LINGUAS', +""" +en +pl +""") +# +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('messages.pot', 'en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples5.py b/test/MSGMERGE/POUpdate_doc_user_examples5.py new file mode 100644 index 0000000..07751ca --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples5.py @@ -0,0 +1,143 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(LINGUAS_FILE = 1, source = ['foo']) +""") +test.write('LINGUAS', +""" +en +pl +""") +# +test.write('foo.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples6.py b/test/MSGMERGE/POUpdate_doc_user_examples6.py new file mode 100644 index 0000000..bd71acf --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples6.py @@ -0,0 +1,194 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) +env.POUpdate(['en', 'pl'], LINGUAS_FILE = 1) +""") +test.write('LINGUAS', +""" +de +fr +""") +test.write('messages.pot',"""\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""") +# +test.write('en.po',"""\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""") +# +test.write('pl.po',"""\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""") +# +test.write('de.po',"""\ +# German translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: de\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""") +# +test.write('fr.po',"""\ +# French translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: fr\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""") + +# Note: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('en.po', 'pl.po', 'de.po', 'fr.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") +test.must_contain('de.po', "Hello from a.cpp") +test.must_contain('fr.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples8.py b/test/MSGMERGE/POUpdate_doc_user_examples8.py new file mode 100644 index 0000000..e113e2c --- /dev/null +++ b/test/MSGMERGE/POUpdate_doc_user_examples8.py @@ -0,0 +1,74 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +# Trivial example. Just load the tool. +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ["default", "gettext"] ) + +# script-wise settings +env['POAUTOINIT'] = 1 +env['LINGUAS_FILE'] = 1 +env['POTDOMAIN'] = 'foo' +env.POTUpdate(source = 'a.cpp') +env.POUpdate() +""") +test.write('LINGUAS', +""" +en +pl +""") +test.write('a.cpp', """ gettext("Hello from a.cpp") """) + +# Note: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', stderr = None) +test.must_exist('foo.pot', 'en.po', 'pl.po') +test.must_contain('en.po', "Hello from a.cpp") +test.must_contain('pl.po', "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples1.py b/test/XGETTEXT/POTUpdate_doc_user_examples1.py new file mode 100644 index 0000000..63bdfdb --- /dev/null +++ b/test/XGETTEXT/POTUpdate_doc_user_examples1.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +test = TestSCons.TestSCons() + +test.subdir('po') +test.write('po/SConstruct', +""" +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) +env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) +""") +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) +test.write('c.cpp', """ gettext("Hello from c.cpp") """) +test.write('d.cpp', """ gettext("Hello from d.cpp") """) + +# scons '.' does not create foo.pot nor bar.pot +test.run(arguments = '.', chdir = 'po') +test.must_not_exist('po/foo.pot', 'po/bar.pot') + +# scons 'foo.pot' creates foo.pot +test.run(arguments = 'foo.pot', chdir = 'po') +test.must_exist('po/foo.pot') +test.must_not_exist('po/bar.pot') +test.must_contain('po/foo.pot',"Hello from a.cpp") +test.must_contain('po/foo.pot',"Hello from b.cpp") +test.must_not_contain('po/foo.pot',"Hello from c.cpp") +test.must_not_contain('po/foo.pot',"Hello from d.cpp") + +# scons 'pot-update' creates foo.pot and bar.pot +test.run(arguments = 'pot-update', chdir = 'po') +test.must_exist('po/foo.pot', 'po/bar.pot') +test.must_not_contain('po/bar.pot',"Hello from a.cpp") +test.must_not_contain('po/bar.pot',"Hello from b.cpp") +test.must_contain('po/bar.pot',"Hello from c.cpp") +test.must_contain('po/bar.pot',"Hello from d.cpp") + +# scons -c does not clean anything +test.run(arguments = '-c', chdir = 'po') +test.must_exist('po/foo.pot', 'po/bar.pot') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples2.py b/test/XGETTEXT/POTUpdate_doc_user_examples2.py new file mode 100644 index 0000000..3698d24 --- /dev/null +++ b/test/XGETTEXT/POTUpdate_doc_user_examples2.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +test = TestSCons.TestSCons() + +test.write('SConstruct', +""" +env = Environment( tools = ['default', 'xgettext'] ) +env['POTDOMAIN'] = "foo" +env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ... +env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot +""") +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) +test.write('c.cpp', """ gettext("Hello from c.cpp") """) +test.write('d.cpp', """ gettext("Hello from d.cpp") """) + +test.run(arguments = 'pot-update') + +test.must_exist('foo.pot') +test.must_contain('foo.pot', "Hello from a.cpp") +test.must_contain('foo.pot', "Hello from b.cpp") +test.must_not_contain('foo.pot', "Hello from c.cpp") +test.must_not_contain('foo.pot', "Hello from d.cpp") + +test.must_exist('bar.pot') +test.must_not_contain('bar.pot', "Hello from a.cpp") +test.must_not_contain('bar.pot', "Hello from b.cpp") +test.must_contain('bar.pot', "Hello from c.cpp") +test.must_contain('bar.pot', "Hello from d.cpp") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples3.py b/test/XGETTEXT/POTUpdate_doc_user_examples3.py new file mode 100644 index 0000000..de9687e --- /dev/null +++ b/test/XGETTEXT/POTUpdate_doc_user_examples3.py @@ -0,0 +1,67 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +test = TestSCons.TestSCons() + +test.subdir('po') +test.write('po/SConstruct', +""" +# SConstruct file in 'po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') +""") +test.write('po/POTFILES.in', +""" +# POTFILES.in in 'po/' subdirectory +../a.cpp +../b.cpp +# end of file +""") +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = 'po') +test.must_exist('po/messages.pot') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples4.py b/test/XGETTEXT/POTUpdate_doc_user_examples4.py new file mode 100644 index 0000000..881f65e --- /dev/null +++ b/test/XGETTEXT/POTUpdate_doc_user_examples4.py @@ -0,0 +1,67 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +test = TestSCons.TestSCons() + +test.subdir('po') +test.write('po/SConstruct', +""" +# SConstruct file in 'po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../') +""") +test.write('po/POTFILES.in', +""" +# POTFILES.in in 'po/' subdirectory +a.cpp +b.cpp +# end of file +""") +test.write('a.cpp', """ gettext("Hello from a.cpp") """) +test.write('b.cpp', """ gettext("Hello from b.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = 'po') +test.must_exist('po/messages.pot') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples5.py b/test/XGETTEXT/POTUpdate_doc_user_examples5.py new file mode 100644 index 0000000..4afb3cf --- /dev/null +++ b/test/XGETTEXT/POTUpdate_doc_user_examples5.py @@ -0,0 +1,81 @@ + +#!/usr/bin/env python +# +# __TOOL_COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +site_scons = os.environ['SCONS_TOOL_LIB_DIR'] + +############################################################################### +test = TestSCons.TestSCons() + +test.subdir('0', ['0','1'], ['0', '1', 'po']) +test.write('0/1/po/SConstruct', +""" +# SConstruct file in '0/1/po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../']) +""") +test.write('0/1/po/POTFILES.in', +""" +# POTFILES.in in '0/1/po/' subdirectory +a.cpp +# end of file +""") +test.write('0/a.cpp', """ gettext("Hello from ../../a.cpp") """) +test.write('0/1/a.cpp', """ gettext("Hello from ../a.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = '0/1/po') +test.must_exist('0/1/po/messages.pot') +test.must_contain('0/1/po/messages.pot', 'Hello from ../a.cpp') +test.must_not_contain('0/1/po/messages.pot', 'Hello from ../../a.cpp') + +test.write('0/1/po/SConstruct', +""" +# SConstruct file in '0/1/po/' subdirectory +env = Environment( + toolpath = ['""" + site_scons + """/SConsToolGettext'] +, tools = ['default', 'xgettext'] +) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) +""") +test.run(arguments = 'pot-update', chdir = '0/1/po') +test.must_contain('0/1/po/messages.pot', 'Hello from ../../a.cpp') +test.must_not_contain('0/1/po/messages.pot', 'Hello from ../a.cpp') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 6940aa27b89c6c622aa77a845324a4b6751584eb Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 6 Jun 2012 22:18:00 +0200 Subject: Fixed MANIFEST files under src/engine --- src/engine/MANIFEST-xml.in | 5 +++ src/engine/MANIFEST.in | 98 +++++++++++++++++++++++----------------------- 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/src/engine/MANIFEST-xml.in b/src/engine/MANIFEST-xml.in index b6bafcf..2caad42 100644 --- a/src/engine/MANIFEST-xml.in +++ b/src/engine/MANIFEST-xml.in @@ -41,6 +41,7 @@ SCons/Tool/g++.xml SCons/Tool/g77.xml SCons/Tool/gas.xml SCons/Tool/gcc.xml +SCons/Tool/gettext.xml SCons/Tool/gfortran.xml SCons/Tool/gnulink.xml SCons/Tool/gs.xml @@ -66,6 +67,9 @@ SCons/Tool/m4.xml SCons/Tool/masm.xml SCons/Tool/midl.xml SCons/Tool/mingw.xml +SCons/Tool/msgfmt.xml +SCons/Tool/msginit.xml +SCons/Tool/msgmerge.xml SCons/Tool/mslib.xml SCons/Tool/mslink.xml SCons/Tool/mssdk.xml @@ -98,5 +102,6 @@ SCons/Tool/tar.xml SCons/Tool/tex.xml SCons/Tool/textfile.xml SCons/Tool/tlib.xml +SCons/Tool/xgettext.xml SCons/Tool/yacc.xml SCons/Tool/zip.xml diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 15b3cb4..130b47c 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -1,36 +1,24 @@ -SCons/__init__.py SCons/Action.py SCons/Builder.py -SCons/compat/__init__.py -SCons/compat/_scons_builtins.py -SCons/compat/_scons_collections.py -SCons/compat/_scons_dbm.py -SCons/compat/_scons_hashlib.py -SCons/compat/_scons_io.py -SCons/compat/_scons_sets.py -SCons/compat/_scons_subprocess.py SCons/CacheDir.py SCons/Conftest.py -SCons/cpp.py -SCons/dblite.py SCons/Debug.py SCons/Defaults.py SCons/Environment.py SCons/Errors.py SCons/Executor.py SCons/Job.py -SCons/exitfuncs.py SCons/Memoize.py -SCons/Node/__init__.py SCons/Node/Alias.py SCons/Node/FS.py SCons/Node/Python.py -SCons/Options/__init__.py +SCons/Node/__init__.py SCons/Options/BoolOption.py SCons/Options/EnumOption.py SCons/Options/ListOption.py SCons/Options/PackageOption.py SCons/Options/PathOption.py +SCons/Options/__init__.py SCons/PathList.py SCons/Platform/__init__.py SCons/Platform/aix.py @@ -42,7 +30,8 @@ SCons/Platform/os2.py SCons/Platform/posix.py SCons/Platform/sunos.py SCons/Platform/win32.py -SCons/Scanner/__init__.py +SCons/SConf.py +SCons/SConsign.py SCons/Scanner/C.py SCons/Scanner/D.py SCons/Scanner/Dir.py @@ -51,18 +40,34 @@ SCons/Scanner/IDL.py SCons/Scanner/LaTeX.py SCons/Scanner/Prog.py SCons/Scanner/RC.py -SCons/SConf.py -SCons/SConsign.py -SCons/Script/__init__.py +SCons/Scanner/__init__.py SCons/Script/Interactive.py SCons/Script/Main.py -SCons/Script/SConscript.py SCons/Script/SConsOptions.py +SCons/Script/SConscript.py +SCons/Script/__init__.py SCons/Sig.py SCons/Subst.py SCons/Taskmaster.py -SCons/Tool/__init__.py SCons/Tool/386asm.py +SCons/Tool/BitKeeper.py +SCons/Tool/CVS.py +SCons/Tool/FortranCommon.py +SCons/Tool/GettextCommon.py +SCons/Tool/JavaCommon.py +SCons/Tool/MSCommon/__init__.py +SCons/Tool/MSCommon/arch.py +SCons/Tool/MSCommon/common.py +SCons/Tool/MSCommon/netframework.py +SCons/Tool/MSCommon/sdk.py +SCons/Tool/MSCommon/vc.py +SCons/Tool/MSCommon/vs.py +SCons/Tool/Perforce.py +SCons/Tool/PharLapCommon.py +SCons/Tool/RCS.py +SCons/Tool/SCCS.py +SCons/Tool/Subversion.py +SCons/Tool/__init__.py SCons/Tool/aixc++.py SCons/Tool/aixcc.py SCons/Tool/aixf77.py @@ -71,27 +76,26 @@ SCons/Tool/applelink.py SCons/Tool/ar.py SCons/Tool/as.py SCons/Tool/bcc32.py -SCons/Tool/BitKeeper.py SCons/Tool/c++.py SCons/Tool/cc.py SCons/Tool/cvf.py -SCons/Tool/CVS.py SCons/Tool/default.py SCons/Tool/dmd.py SCons/Tool/dvi.py SCons/Tool/dvipdf.py SCons/Tool/dvips.py +SCons/Tool/f03.py SCons/Tool/f77.py SCons/Tool/f90.py SCons/Tool/f95.py -SCons/Tool/f03.py SCons/Tool/filesystem.py SCons/Tool/fortran.py -SCons/Tool/FortranCommon.py SCons/Tool/g++.py SCons/Tool/g77.py SCons/Tool/gas.py SCons/Tool/gcc.py +SCons/Tool/gettext.py +SCons/Tool/gettext.xml SCons/Tool/gfortran.py SCons/Tool/gnulink.py SCons/Tool/gs.py @@ -108,24 +112,22 @@ SCons/Tool/install.py SCons/Tool/intelc.py SCons/Tool/ipkg.py SCons/Tool/jar.py -SCons/Tool/JavaCommon.py SCons/Tool/javac.py SCons/Tool/javah.py SCons/Tool/latex.py SCons/Tool/lex.py SCons/Tool/link.py SCons/Tool/linkloc.py -SCons/Tool/MSCommon/__init__.py -SCons/Tool/MSCommon/arch.py -SCons/Tool/MSCommon/common.py -SCons/Tool/MSCommon/netframework.py -SCons/Tool/MSCommon/sdk.py -SCons/Tool/MSCommon/vs.py -SCons/Tool/MSCommon/vc.py SCons/Tool/m4.py SCons/Tool/masm.py SCons/Tool/midl.py SCons/Tool/mingw.py +SCons/Tool/msgfmt.py +SCons/Tool/msgfmt.xml +SCons/Tool/msginit.py +SCons/Tool/msginit.xml +SCons/Tool/msgmerge.py +SCons/Tool/msgmerge.xml SCons/Tool/mslib.py SCons/Tool/mslink.py SCons/Tool/mssdk.py @@ -147,19 +149,14 @@ SCons/Tool/packaging/zip.py SCons/Tool/pdf.py SCons/Tool/pdflatex.py SCons/Tool/pdftex.py -SCons/Tool/Perforce.py -SCons/Tool/PharLapCommon.py SCons/Tool/qt.py -SCons/Tool/RCS.py SCons/Tool/rmic.py SCons/Tool/rpcgen.py SCons/Tool/rpm.py -SCons/Tool/SCCS.py SCons/Tool/sgiar.py SCons/Tool/sgic++.py SCons/Tool/sgicc.py SCons/Tool/sgilink.py -SCons/Tool/Subversion.py SCons/Tool/sunar.py SCons/Tool/sunc++.py SCons/Tool/suncc.py @@ -173,24 +170,27 @@ SCons/Tool/tex.py SCons/Tool/textfile.py SCons/Tool/tlib.py SCons/Tool/wix.py +SCons/Tool/xgettext.py +SCons/Tool/xgettext.xml SCons/Tool/yacc.py SCons/Tool/zip.py SCons/Util.py -SCons/Variables/__init__.py SCons/Variables/BoolVariable.py SCons/Variables/EnumVariable.py SCons/Variables/ListVariable.py SCons/Variables/PackageVariable.py SCons/Variables/PathVariable.py +SCons/Variables/__init__.py SCons/Warnings.py -SCons/Tool/msgfmt.py -SCons/Tool/GettextCommon.py -SCons/Tool/gettext.py -SCons/Tool/msginit.py -SCons/Tool/msgmerge.py -SCons/Tool/xgettext.py -SCons/Tool/msgfmt.xml -SCons/Tool/xgettext.xml -SCons/Tool/msgmerge.xml -SCons/Tool/msginit.xml -SCons/Tool/gettext.xml +SCons/__init__.py +SCons/compat/__init__.py +SCons/compat/_scons_builtins.py +SCons/compat/_scons_collections.py +SCons/compat/_scons_dbm.py +SCons/compat/_scons_hashlib.py +SCons/compat/_scons_io.py +SCons/compat/_scons_sets.py +SCons/compat/_scons_subprocess.py +SCons/cpp.py +SCons/dblite.py +SCons/exitfuncs.py -- cgit v0.12 From 8ad30d47a35e1a4bd17b2ff4db49ae1d8a484368 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 6 Jun 2012 22:26:28 +0200 Subject: Another correction to MANIFEST files --- src/engine/MANIFEST.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 130b47c..7d68c3a 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -95,7 +95,6 @@ SCons/Tool/g77.py SCons/Tool/gas.py SCons/Tool/gcc.py SCons/Tool/gettext.py -SCons/Tool/gettext.xml SCons/Tool/gfortran.py SCons/Tool/gnulink.py SCons/Tool/gs.py @@ -123,11 +122,8 @@ SCons/Tool/masm.py SCons/Tool/midl.py SCons/Tool/mingw.py SCons/Tool/msgfmt.py -SCons/Tool/msgfmt.xml SCons/Tool/msginit.py -SCons/Tool/msginit.xml SCons/Tool/msgmerge.py -SCons/Tool/msgmerge.xml SCons/Tool/mslib.py SCons/Tool/mslink.py SCons/Tool/mssdk.py @@ -171,7 +167,6 @@ SCons/Tool/textfile.py SCons/Tool/tlib.py SCons/Tool/wix.py SCons/Tool/xgettext.py -SCons/Tool/xgettext.xml SCons/Tool/yacc.py SCons/Tool/zip.py SCons/Util.py -- cgit v0.12 From 9609517e3478139d5c503ce96f39eb856f1f78a7 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 6 Jun 2012 22:39:50 +0200 Subject: Corrections corrections corrections .. --- src/engine/SCons/Tool/GettextCommon.py | 25 ++++++++++++------------- src/engine/SCons/Tool/gettext.py | 4 ++-- src/engine/SCons/Tool/gettext.xml | 7 +++---- src/engine/SCons/Tool/msgfmt.py | 6 +++--- test/GETTEXT/Translate_doc_user_examples1.py | 9 +-------- test/GETTEXT/Translate_doc_user_examples2.py | 9 +-------- test/GETTEXT/Translate_doc_user_examples3.py | 9 +-------- test/GETTEXT/doc_user_examples1.py | 9 +-------- test/MSGFMT/MOFile_doc_user_examples1.py | 2 -- test/MSGFMT/MOFile_doc_user_examples2.py | 2 -- test/MSGFMT/MOFile_doc_user_examples3.py | 2 -- test/MSGFMT/MOFile_doc_user_examples4.py | 2 -- test/MSGINIT/POinit_doc_user_examples1.py | 2 -- test/MSGINIT/POinit_doc_user_examples2.py | 2 -- test/MSGINIT/POinit_doc_user_examples3.py | 2 -- test/MSGINIT/POinit_doc_user_examples4.py | 2 -- test/MSGINIT/POinit_doc_user_examples5.py | 2 -- test/MSGINIT/POinit_doc_user_examples6.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples1.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples2.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples3.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples4.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples5.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples6.py | 2 -- test/MSGMERGE/POUpdate_doc_user_examples8.py | 2 -- test/XGETTEXT/POTUpdate_doc_user_examples1.py | 2 -- test/XGETTEXT/POTUpdate_doc_user_examples2.py | 2 -- test/XGETTEXT/POTUpdate_doc_user_examples3.py | 2 -- test/XGETTEXT/POTUpdate_doc_user_examples4.py | 2 -- test/XGETTEXT/POTUpdate_doc_user_examples5.py | 7 +------ 30 files changed, 25 insertions(+), 102 deletions(-) diff --git a/src/engine/SCons/Tool/GettextCommon.py b/src/engine/SCons/Tool/GettextCommon.py index d786015..66ab57c 100644 --- a/src/engine/SCons/Tool/GettextCommon.py +++ b/src/engine/SCons/Tool/GettextCommon.py @@ -54,8 +54,8 @@ class _POTargetFactory(object): """ A factory of `PO` target files. Factory defaults differ from these of `SCons.Node.FS.FS`. We set `precious` - (this is required by builders and actions in `SConsToolGettext`) and - `noclean` flags by default for all produced nodes. + (this is required by builders and actions gettext) and `noclean` flags by + default for all produced nodes. """ def __init__( self, env, nodefault = True, alias = None, precious = True , noclean = True ): @@ -239,17 +239,16 @@ class RPaths(object): It seems like `SCons.Node.FS.Base.get_path()` returns absolute paths for nodes that are outside of current working directory (`env.fs.getcwd()`). - In `SConsToolGettext` way we often have `SConscript`, `POT` and `PO` files - within `po/` directory and source files (e.g. `*.c`) outside of it. When - generating `POT` template file, references to source files are written to - `POT` template, so a translator may later quickly jump to appropriate source - file and line from its `PO` editor (e.g. `poedit`). Relative paths in - `PO` file are usually interpreted by `PO` editor as paths relative to the - place, where `PO` file lives. The absolute paths would make resultant `POT` - file nonportable, as the references would be correct only on the machine, - where `POT` file was recently re-created. For such reason, we need a - function, which always returns relative paths. This is the purpose of - `RPaths` callable object. + Here, we often have `SConscript`, `POT` and `PO` files within `po/` + directory and source files (e.g. `*.c`) outside of it. When generating `POT` + template file, references to source files are written to `POT` template, so + a translator may later quickly jump to appropriate source file and line from + its `PO` editor (e.g. `poedit`). Relative paths in `PO` file are usually + interpreted by `PO` editor as paths relative to the place, where `PO` file + lives. The absolute paths would make resultant `POT` file nonportable, as + the references would be correct only on the machine, where `POT` file was + recently re-created. For such reason, we need a function, which always + returns relative paths. This is the purpose of `RPaths` callable object. The `__call__` method returns paths relative to current woking directory, but we assume, that *xgettext(1)* is run from the directory, where target file is diff --git a/src/engine/SCons/Tool/gettext.py b/src/engine/SCons/Tool/gettext.py index 1055087..8dfdecf 100644 --- a/src/engine/SCons/Tool/gettext.py +++ b/src/engine/SCons/Tool/gettext.py @@ -28,7 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" ############################################################################# def generate(env,**kw): import SCons.Tool - from SConsToolGettext.GettextCommon \ + from SCons.Tool.GettextCommon \ import _translate, _install_mo_files, tool_list for t in tool_list(env['PLATFORM'], env): env.Tool(t) @@ -39,7 +39,7 @@ def generate(env,**kw): ############################################################################# def exists(env): - from SConsToolGettext.GettextCommon \ + from SCons.Tool.GettextCommon \ import _xgettext_exists, _msginit_exists, \ _msgmerge_exists, _msgfmt_exists return _xgettext_exists(env) and _msginit_exists(env) \ diff --git a/src/engine/SCons/Tool/gettext.xml b/src/engine/SCons/Tool/gettext.xml index db76cc9..2c6f1ae 100644 --- a/src/engine/SCons/Tool/gettext.xml +++ b/src/engine/SCons/Tool/gettext.xml @@ -36,9 +36,8 @@ perform particular activities related to software internationalization. You may be however interested in top-level builders &b-Translate; and &b-InstallMOFiles; described few paragraphs later. -To use &t-gettext; tools, copy SConsToolGettext -folder to your site_scons/ and simply add -'gettext' tool to your environment: +To use &t-gettext; tools add 'gettext' tool to your +environment: env = Environment( tools = ['default', 'gettext'] ) @@ -207,7 +206,7 @@ not defined), the builders use messages.pot as default The &cv-POAUTOINIT; variable, if set to True (on non-zero -numeric value), let the SConsToolGettext to automatically initialize +numeric value), let the &t-link-msginit; tool to automatically initialize missing PO files with msginit(1). This applies to both, &b-link-POInit; and &b-link-POUpdate; builders (and others that use any of diff --git a/src/engine/SCons/Tool/msgfmt.py b/src/engine/SCons/Tool/msgfmt.py index ce8cff8..f5cdb8f 100644 --- a/src/engine/SCons/Tool/msgfmt.py +++ b/src/engine/SCons/Tool/msgfmt.py @@ -29,9 +29,9 @@ class _MOFileBuilder(BuilderBase): """ The builder class for `MO` files. The reason for this builder to exists and its purpose is quite simillar - as for `SConsToolGettext._POFileBuilder`. This time, we extend list of - sources, not targets, and call `BuilderBase._execute()` only once (as we - assume single-target here). + as for `_POFileBuilder`. This time, we extend list of sources, not targets, + and call `BuilderBase._execute()` only once (as we assume single-target + here). """ def _execute(self, env, target, source, *args, **kw): diff --git a/test/GETTEXT/Translate_doc_user_examples1.py b/test/GETTEXT/Translate_doc_user_examples1.py index 946f18b..96a6c2c 100644 --- a/test/GETTEXT/Translate_doc_user_examples1.py +++ b/test/GETTEXT/Translate_doc_user_examples1.py @@ -31,10 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -# NOTE: When integrating into upstream SCons development tree, remove the next -# line, and the "toolpath = ..." line -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() @@ -42,10 +38,7 @@ test = TestSCons.TestSCons() test.subdir('po/') test.write('po/SConstruct', """ -env = Environment( - toolpath = ['""" + site_scons + """/SConsToolGettext'] -, tools = ["default", "gettext"] -) +env = Environment( tools = ["default", "gettext"] ) env['POAUTOINIT'] = 1 env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) """) diff --git a/test/GETTEXT/Translate_doc_user_examples2.py b/test/GETTEXT/Translate_doc_user_examples2.py index 51464d4..7fffb86 100644 --- a/test/GETTEXT/Translate_doc_user_examples2.py +++ b/test/GETTEXT/Translate_doc_user_examples2.py @@ -31,10 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -# NOTE: When integrating into upstream SCons development tree, remove the next -# line, and the "toolpath = ..." line -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() @@ -42,10 +38,7 @@ test = TestSCons.TestSCons() test.subdir('po/') test.write('po/SConstruct', """ -env = Environment( - toolpath = ['""" + site_scons + """/SConsToolGettext'] -, tools = ["default", "gettext"] -) +env = Environment( tools = ["default", "gettext"] ) env['POAUTOINIT'] = 1 env['XGETTEXTPATH'] = ['../'] env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') diff --git a/test/GETTEXT/Translate_doc_user_examples3.py b/test/GETTEXT/Translate_doc_user_examples3.py index 6a93b5e..d099523 100644 --- a/test/GETTEXT/Translate_doc_user_examples3.py +++ b/test/GETTEXT/Translate_doc_user_examples3.py @@ -31,10 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -# NOTE: When integrating into upstream SCons development tree, remove the next -# line, and the "toolpath = ..." line -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() @@ -42,10 +38,7 @@ test = TestSCons.TestSCons() test.subdir('src', ['src', 'po'], 'build') test.write('SConstruct', """ -env = Environment( - toolpath = ['""" + site_scons + """/SConsToolGettext'] -, tools = ["default", "gettext"] -) +env = Environment( tools = ["default", "gettext"] ) VariantDir('build', 'src', duplicate = 0) env['POAUTOINIT'] = 1 SConscript('src/po/SConscript.i18n', exports = 'env') diff --git a/test/GETTEXT/doc_user_examples1.py b/test/GETTEXT/doc_user_examples1.py index 3d05a21..bf210a1 100644 --- a/test/GETTEXT/doc_user_examples1.py +++ b/test/GETTEXT/doc_user_examples1.py @@ -31,20 +31,13 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -# NOTE: When integrating into upstream SCons development tree, remove the next -# line, and the "toolpath = ..." line -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() test.write('SConstruct', """ -env = Environment( - toolpath = ['""" + site_scons + """/SConsToolGettext'] -, tools = ["default", "gettext"] -) +env = Environment( tools = ["default", "gettext"] ) """) test.run(arguments = '.') diff --git a/test/MSGFMT/MOFile_doc_user_examples1.py b/test/MSGFMT/MOFile_doc_user_examples1.py index 71b5996..d1b7982 100644 --- a/test/MSGFMT/MOFile_doc_user_examples1.py +++ b/test/MSGFMT/MOFile_doc_user_examples1.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGFMT/MOFile_doc_user_examples2.py b/test/MSGFMT/MOFile_doc_user_examples2.py index ad67b3e..ab37369 100644 --- a/test/MSGFMT/MOFile_doc_user_examples2.py +++ b/test/MSGFMT/MOFile_doc_user_examples2.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGFMT/MOFile_doc_user_examples3.py b/test/MSGFMT/MOFile_doc_user_examples3.py index e7cc0ff..3eae629 100644 --- a/test/MSGFMT/MOFile_doc_user_examples3.py +++ b/test/MSGFMT/MOFile_doc_user_examples3.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGFMT/MOFile_doc_user_examples4.py b/test/MSGFMT/MOFile_doc_user_examples4.py index 8737b2b..6be4707 100644 --- a/test/MSGFMT/MOFile_doc_user_examples4.py +++ b/test/MSGFMT/MOFile_doc_user_examples4.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples1.py b/test/MSGINIT/POinit_doc_user_examples1.py index 9082a11..b69e58f 100644 --- a/test/MSGINIT/POinit_doc_user_examples1.py +++ b/test/MSGINIT/POinit_doc_user_examples1.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples2.py b/test/MSGINIT/POinit_doc_user_examples2.py index a96d921..5832d67 100644 --- a/test/MSGINIT/POinit_doc_user_examples2.py +++ b/test/MSGINIT/POinit_doc_user_examples2.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples3.py b/test/MSGINIT/POinit_doc_user_examples3.py index f21f874..3f971c9 100644 --- a/test/MSGINIT/POinit_doc_user_examples3.py +++ b/test/MSGINIT/POinit_doc_user_examples3.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples4.py b/test/MSGINIT/POinit_doc_user_examples4.py index 2bcb68e..903a2ac 100644 --- a/test/MSGINIT/POinit_doc_user_examples4.py +++ b/test/MSGINIT/POinit_doc_user_examples4.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples5.py b/test/MSGINIT/POinit_doc_user_examples5.py index c3971e7..bd38950 100644 --- a/test/MSGINIT/POinit_doc_user_examples5.py +++ b/test/MSGINIT/POinit_doc_user_examples5.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGINIT/POinit_doc_user_examples6.py b/test/MSGINIT/POinit_doc_user_examples6.py index bf694fa..9e5f189 100644 --- a/test/MSGINIT/POinit_doc_user_examples6.py +++ b/test/MSGINIT/POinit_doc_user_examples6.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples1.py b/test/MSGMERGE/POUpdate_doc_user_examples1.py index d925568..dd7b41a 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples1.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples1.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples2.py b/test/MSGMERGE/POUpdate_doc_user_examples2.py index 0126391..a9f7dda 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples2.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples2.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples3.py b/test/MSGMERGE/POUpdate_doc_user_examples3.py index 31c09c5..782b4cd 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples3.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples3.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples4.py b/test/MSGMERGE/POUpdate_doc_user_examples4.py index 51d944f..71587ac 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples4.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples4.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples5.py b/test/MSGMERGE/POUpdate_doc_user_examples5.py index 07751ca..d92fa4d 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples5.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples5.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples6.py b/test/MSGMERGE/POUpdate_doc_user_examples6.py index bd71acf..6360db5 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples6.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples6.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/MSGMERGE/POUpdate_doc_user_examples8.py b/test/MSGMERGE/POUpdate_doc_user_examples8.py index e113e2c..78e478d 100644 --- a/test/MSGMERGE/POUpdate_doc_user_examples8.py +++ b/test/MSGMERGE/POUpdate_doc_user_examples8.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### # Trivial example. Just load the tool. test = TestSCons.TestSCons() diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples1.py b/test/XGETTEXT/POTUpdate_doc_user_examples1.py index 63bdfdb..f3e76a8 100644 --- a/test/XGETTEXT/POTUpdate_doc_user_examples1.py +++ b/test/XGETTEXT/POTUpdate_doc_user_examples1.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### test = TestSCons.TestSCons() diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples2.py b/test/XGETTEXT/POTUpdate_doc_user_examples2.py index 3698d24..72345a6 100644 --- a/test/XGETTEXT/POTUpdate_doc_user_examples2.py +++ b/test/XGETTEXT/POTUpdate_doc_user_examples2.py @@ -31,8 +31,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - test = TestSCons.TestSCons() test.write('SConstruct', diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples3.py b/test/XGETTEXT/POTUpdate_doc_user_examples3.py index de9687e..2c4cf06 100644 --- a/test/XGETTEXT/POTUpdate_doc_user_examples3.py +++ b/test/XGETTEXT/POTUpdate_doc_user_examples3.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### test = TestSCons.TestSCons() diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples4.py b/test/XGETTEXT/POTUpdate_doc_user_examples4.py index 881f65e..9743c0c 100644 --- a/test/XGETTEXT/POTUpdate_doc_user_examples4.py +++ b/test/XGETTEXT/POTUpdate_doc_user_examples4.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### test = TestSCons.TestSCons() diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples5.py b/test/XGETTEXT/POTUpdate_doc_user_examples5.py index 4afb3cf..21aa27a 100644 --- a/test/XGETTEXT/POTUpdate_doc_user_examples5.py +++ b/test/XGETTEXT/POTUpdate_doc_user_examples5.py @@ -32,8 +32,6 @@ Make sure, that the examples given in user guide all work. import TestSCons import os -site_scons = os.environ['SCONS_TOOL_LIB_DIR'] - ############################################################################### test = TestSCons.TestSCons() @@ -62,10 +60,7 @@ test.must_not_contain('0/1/po/messages.pot', 'Hello from ../../a.cpp') test.write('0/1/po/SConstruct', """ # SConstruct file in '0/1/po/' subdirectory -env = Environment( - toolpath = ['""" + site_scons + """/SConsToolGettext'] -, tools = ['default', 'xgettext'] -) +env = Environment( tools = ['default', 'xgettext'] ) env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) """) test.run(arguments = 'pot-update', chdir = '0/1/po') -- cgit v0.12 From a486464211ccae2b17049e86a7b05c531c6897a6 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 6 Jun 2012 22:42:39 +0200 Subject: Corrected COPYRIGH placeholders --- doc/user/gettext.in | 2 +- doc/user/gettext.xml | 2 +- src/engine/SCons/Tool/GettextCommon.py | 2 +- src/engine/SCons/Tool/gettext.py | 2 +- src/engine/SCons/Tool/gettext.xml | 2 +- src/engine/SCons/Tool/msgfmt.py | 2 +- src/engine/SCons/Tool/msgfmt.xml | 2 +- src/engine/SCons/Tool/msginit.py | 2 +- src/engine/SCons/Tool/msginit.xml | 2 +- src/engine/SCons/Tool/msgmerge.py | 2 +- src/engine/SCons/Tool/msgmerge.xml | 2 +- src/engine/SCons/Tool/xgettext.py | 2 +- src/engine/SCons/Tool/xgettext.xml | 2 +- test/GETTEXT/Translate_doc_user_examples1.py | 2 +- test/GETTEXT/Translate_doc_user_examples2.py | 2 +- test/GETTEXT/Translate_doc_user_examples3.py | 2 +- test/GETTEXT/doc_user_examples1.py | 2 +- test/MSGFMT/MOFile_doc_user_examples1.py | 2 +- test/MSGFMT/MOFile_doc_user_examples2.py | 2 +- test/MSGFMT/MOFile_doc_user_examples3.py | 2 +- test/MSGFMT/MOFile_doc_user_examples4.py | 2 +- test/MSGINIT/POinit_doc_user_examples1.py | 2 +- test/MSGINIT/POinit_doc_user_examples2.py | 2 +- test/MSGINIT/POinit_doc_user_examples3.py | 2 +- test/MSGINIT/POinit_doc_user_examples4.py | 2 +- test/MSGINIT/POinit_doc_user_examples5.py | 2 +- test/MSGINIT/POinit_doc_user_examples6.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples1.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples2.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples3.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples4.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples5.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples6.py | 2 +- test/MSGMERGE/POUpdate_doc_user_examples8.py | 2 +- test/XGETTEXT/POTUpdate_doc_user_examples1.py | 2 +- test/XGETTEXT/POTUpdate_doc_user_examples2.py | 2 +- test/XGETTEXT/POTUpdate_doc_user_examples3.py | 2 +- test/XGETTEXT/POTUpdate_doc_user_examples4.py | 2 +- test/XGETTEXT/POTUpdate_doc_user_examples5.py | 2 +- 39 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/user/gettext.in b/doc/user/gettext.in index 63c1d20..22545d3 100644 --- a/doc/user/gettext.in +++ b/doc/user/gettext.in @@ -1,6 +1,6 @@ - The &cv-POTDOMAIN; defines default domain, used to generate @@ -227,12 +198,3 @@ default file named - - - -TODO: Try to remove me. - - -TODO: Try to remove me. - - diff --git a/src/engine/SCons/Tool/msgfmt.py b/src/engine/SCons/Tool/msgfmt.py index cdbc4ed..83b54f7 100644 --- a/src/engine/SCons/Tool/msgfmt.py +++ b/src/engine/SCons/Tool/msgfmt.py @@ -82,7 +82,8 @@ def generate(env,**kw): MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', MSGFMTCOMSTR = '', - MOSUFFIX = '.mo' + MOSUFFIX = ['.mo'], + POSUFFIX = ['.po'] ) env.Append( BUILDERS = { 'MOFiles' : _create_mo_file_builder(env) } ) ############################################################################# diff --git a/src/engine/SCons/Tool/msgfmt.xml b/src/engine/SCons/Tool/msgfmt.xml index d72cc47..3c5db8f 100644 --- a/src/engine/SCons/Tool/msgfmt.xml +++ b/src/engine/SCons/Tool/msgfmt.xml @@ -17,6 +17,7 @@ MSGFMT MSGFMTCOM MSGFMTCOMSTR MSGFMTFLAGS +POSUFFIX LINGUAS_FILE diff --git a/src/engine/SCons/Tool/msginit.py b/src/engine/SCons/Tool/msginit.py index 28bcde1..87b3eec 100644 --- a/src/engine/SCons/Tool/msginit.py +++ b/src/engine/SCons/Tool/msginit.py @@ -82,8 +82,11 @@ def generate(env,**kw): env['MSGINIT'] = _detect_msginit(env) msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' + # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded + # (sometimes we really don't need it) env.SetDefault( - POSUFFIX = '.po', + POSUFFIX = ['.po'], + POTSUFFIX = ['.pot'], _MSGINITLOCALE = '${TARGET.filebase}', _MSGNoTranslator = _optional_no_translator_flag, MSGINITCOM = msginitcom, diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml index 1827d35..612b9d9 100644 --- a/src/engine/SCons/Tool/msginit.xml +++ b/src/engine/SCons/Tool/msginit.xml @@ -19,6 +19,7 @@ MSGINITFLAGS POAUTOINIT POCREATE_ALIAS POSUFFIX +POTSUFFIX _MSGINITLOCALE diff --git a/src/engine/SCons/Tool/msgmerge.py b/src/engine/SCons/Tool/msgmerge.py index 49ab651..78eb2c5 100644 --- a/src/engine/SCons/Tool/msgmerge.py +++ b/src/engine/SCons/Tool/msgmerge.py @@ -72,7 +72,8 @@ def generate(env,**kw): from SCons.Tool.GettextCommon import _detect_msgmerge env['MSGMERGE'] = _detect_msgmerge(env) env.SetDefault( - POSUFFIX = '.po', + POTSUFFIX = ['.pot'], + POSUFFIX = ['.po'], MSGMERGECOM = '$MSGMERGE $MSGMERGEFLAGS --update $TARGET $SOURCE', MSGMERGECOMSTR = '', MSGMERGEFLAGS = [ ], diff --git a/src/engine/SCons/Tool/msgmerge.xml b/src/engine/SCons/Tool/msgmerge.xml index c2018b1..69c848b 100644 --- a/src/engine/SCons/Tool/msgmerge.xml +++ b/src/engine/SCons/Tool/msgmerge.xml @@ -16,6 +16,7 @@ MSGMERGECOM MSGMERGECOMSTR MSGMERGEFLAGS POSUFFIX +POTSUFFIX POUPDATE_ALIAS diff --git a/test/MSGFMT/MOFile_doc_user_examples1.py b/test/MSGFMT/MOFile_doc_user_examples1.py deleted file mode 100644 index 6df8edf..0000000 --- a/test/MSGFMT/MOFile_doc_user_examples1.py +++ /dev/null @@ -1,112 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.MOFiles(['pl', 'en']) -""") -# -##test.write('LINGUAS', -##""" -##en -##pl -##""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -test.run(arguments = '.') -test.must_exist('en.mo', 'pl.mo') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples2.py b/test/MSGFMT/MOFile_doc_user_examples2.py deleted file mode 100644 index 72ad3a6..0000000 --- a/test/MSGFMT/MOFile_doc_user_examples2.py +++ /dev/null @@ -1,112 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.MOFiles(LINGUAS_FILE = 1) -""") -# -test.write('LINGUAS', -""" -en -pl -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -test.run(arguments = '.') -test.must_exist('en.mo', 'pl.mo') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples3.py b/test/MSGFMT/MOFile_doc_user_examples3.py deleted file mode 100644 index 8624b4a..0000000 --- a/test/MSGFMT/MOFile_doc_user_examples3.py +++ /dev/null @@ -1,161 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.MOFiles(['en', 'pl'], LINGUAS_FILE = 1) -""") -test.write('LINGUAS', -""" -de -fr -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") -# -test.write('de.po',"""\ -# German translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: de\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "" -""") -# -test.write('fr.po',"""\ -# French translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: fr\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "" -""") - -test.run(arguments = '.') -test.must_exist('en.mo', 'pl.mo', 'de.mo', 'fr.mo') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGFMT/MOFile_doc_user_examples4.py b/test/MSGFMT/MOFile_doc_user_examples4.py deleted file mode 100644 index e6d521d..0000000 --- a/test/MSGFMT/MOFile_doc_user_examples4.py +++ /dev/null @@ -1,113 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['LINGUAS_FILE'] = 1 -env.MOFiles() -""") -# -test.write('LINGUAS', -""" -en -pl -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: dummypkg 1.0\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -test.run(arguments = '.') -test.must_exist('en.mo', 'pl.mo') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples1.py b/test/MSGINIT/POinit_doc_user_examples1.py deleted file mode 100644 index 2dde34c..0000000 --- a/test/MSGINIT/POinit_doc_user_examples1.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.POInit(['en','pl']) # messages.pot --> [en.po, pl.po] -""") -# -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples2.py b/test/MSGINIT/POinit_doc_user_examples2.py deleted file mode 100644 index 23233f7..0000000 --- a/test/MSGINIT/POinit_doc_user_examples2.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.POInit(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples3.py b/test/MSGINIT/POinit_doc_user_examples3.py deleted file mode 100644 index e0a27d1..0000000 --- a/test/MSGINIT/POinit_doc_user_examples3.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.POInit(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples4.py b/test/MSGINIT/POinit_doc_user_examples4.py deleted file mode 100644 index cdd1733..0000000 --- a/test/MSGINIT/POinit_doc_user_examples4.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file -""") -test.write('LINGUAS',""" -en -pl -""") -# -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples5.py b/test/MSGINIT/POinit_doc_user_examples5.py deleted file mode 100644 index 20dee41..0000000 --- a/test/MSGINIT/POinit_doc_user_examples5.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.POInit(['en', 'pl'], LINGUAS_FILE = 1) # needs 'LINGUAS' file -""") -test.write('LINGUAS',""" -de -fr -""") -# -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po', 'de.po', 'fr.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") -test.must_contain('de.po', "Hello from a.cpp") -test.must_contain('fr.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGINIT/POinit_doc_user_examples6.py b/test/MSGINIT/POinit_doc_user_examples6.py deleted file mode 100644 index 7c829c0..0000000 --- a/test/MSGINIT/POinit_doc_user_examples6.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env['LINGUAS_FILE'] = 1 -env['POTDOMAIN'] = 'foo' -env.POInit() -""") -test.write('LINGUAS',""" -en -pl -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-create', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples1.py b/test/MSGMERGE/POUpdate_doc_user_examples1.py deleted file mode 100644 index 6a22698..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples1.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po] -""") -# -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples2.py b/test/MSGMERGE/POUpdate_doc_user_examples2.py deleted file mode 100644 index da721c4..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples2.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples3.py b/test/MSGMERGE/POUpdate_doc_user_examples3.py deleted file mode 100644 index 9a927ea..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples3.py +++ /dev/null @@ -1,136 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples4.py b/test/MSGMERGE/POUpdate_doc_user_examples4.py deleted file mode 100644 index 82dedc9..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples4.py +++ /dev/null @@ -1,142 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file -""") -# -test.write('LINGUAS', -""" -en -pl -""") -# -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('messages.pot', 'en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples5.py b/test/MSGMERGE/POUpdate_doc_user_examples5.py deleted file mode 100644 index d292c4f..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples5.py +++ /dev/null @@ -1,141 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(LINGUAS_FILE = 1, source = ['foo']) -""") -test.write('LINGUAS', -""" -en -pl -""") -# -test.write('foo.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") - -# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples6.py b/test/MSGMERGE/POUpdate_doc_user_examples6.py deleted file mode 100644 index de34a82..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples6.py +++ /dev/null @@ -1,192 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env.POUpdate(['en', 'pl'], LINGUAS_FILE = 1) -""") -test.write('LINGUAS', -""" -de -fr -""") -test.write('messages.pot',"""\ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=CHARSET\\n" -"Content-Transfer-Encoding: 8bit\\n" -# -#: a.cpp:1 -msgid "Hello from a.cpp" -msgstr "" -""") -# -test.write('en.po',"""\ -# English translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Pawel Tomulik , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:37+0200\\n" -"Last-Translator: Pawel Tomulik \\n" -"Language-Team: English\\n" -"Language: en\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ -# Polish translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: pl\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "Stara wiadomosc z a.cpp" -""") -# -test.write('de.po',"""\ -# German translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: de\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "" -""") -# -test.write('fr.po',"""\ -# French translations for PACKAGE package. -# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Automatically generated, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2012-05-27 00:35+0200\\n" -"PO-Revision-Date: 2012-05-27 00:35+0200\\n" -"Last-Translator: Automatically generated\\n" -"Language-Team: none\\n" -"Language: fr\\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=ASCII\\n" -"Content-Transfer-Encoding: 8bit\\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\\n" - -#: a.cpp:1 -msgid "Old message from a.cpp" -msgstr "" -""") - -# Note: msgmerge(1) prints its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('en.po', 'pl.po', 'de.po', 'fr.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") -test.must_contain('de.po', "Hello from a.cpp") -test.must_contain('fr.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSGMERGE/POUpdate_doc_user_examples8.py b/test/MSGMERGE/POUpdate_doc_user_examples8.py deleted file mode 100644 index 9e08225..0000000 --- a/test/MSGMERGE/POUpdate_doc_user_examples8.py +++ /dev/null @@ -1,72 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) - -# script-wise settings -env['POAUTOINIT'] = 1 -env['LINGUAS_FILE'] = 1 -env['POTDOMAIN'] = 'foo' -env.POTUpdate(source = 'a.cpp') -env.POUpdate() -""") -test.write('LINGUAS', -""" -en -pl -""") -test.write('a.cpp', """ gettext("Hello from a.cpp") """) - -# Note: msgmerge(1) prints its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('foo.pot', 'en.po', 'pl.po') -test.must_contain('en.po', "Hello from a.cpp") -test.must_contain('pl.po', "Hello from a.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples1.py b/test/XGETTEXT/POTUpdate_doc_user_examples1.py deleted file mode 100644 index 4eb3fd9..0000000 --- a/test/XGETTEXT/POTUpdate_doc_user_examples1.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -test = TestSCons.TestSCons() - -test.subdir('po') -test.write('po/SConstruct', -""" -env = Environment( tools = ['default', 'xgettext'] ) -env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) -env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) -""") -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) -test.write('c.cpp', """ gettext("Hello from c.cpp") """) -test.write('d.cpp', """ gettext("Hello from d.cpp") """) - -# scons '.' does not create foo.pot nor bar.pot -test.run(arguments = '.', chdir = 'po') -test.must_not_exist('po/foo.pot', 'po/bar.pot') - -# scons 'foo.pot' creates foo.pot -test.run(arguments = 'foo.pot', chdir = 'po') -test.must_exist('po/foo.pot') -test.must_not_exist('po/bar.pot') -test.must_contain('po/foo.pot',"Hello from a.cpp") -test.must_contain('po/foo.pot',"Hello from b.cpp") -test.must_not_contain('po/foo.pot',"Hello from c.cpp") -test.must_not_contain('po/foo.pot',"Hello from d.cpp") - -# scons 'pot-update' creates foo.pot and bar.pot -test.run(arguments = 'pot-update', chdir = 'po') -test.must_exist('po/foo.pot', 'po/bar.pot') -test.must_not_contain('po/bar.pot',"Hello from a.cpp") -test.must_not_contain('po/bar.pot',"Hello from b.cpp") -test.must_contain('po/bar.pot',"Hello from c.cpp") -test.must_contain('po/bar.pot',"Hello from d.cpp") - -# scons -c does not clean anything -test.run(arguments = '-c', chdir = 'po') -test.must_exist('po/foo.pot', 'po/bar.pot') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples2.py b/test/XGETTEXT/POTUpdate_doc_user_examples2.py deleted file mode 100644 index 9999a68..0000000 --- a/test/XGETTEXT/POTUpdate_doc_user_examples2.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ['default', 'xgettext'] ) -env['POTDOMAIN'] = "foo" -env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ... -env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot -""") -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) -test.write('c.cpp', """ gettext("Hello from c.cpp") """) -test.write('d.cpp', """ gettext("Hello from d.cpp") """) - -test.run(arguments = 'pot-update') - -test.must_exist('foo.pot') -test.must_contain('foo.pot', "Hello from a.cpp") -test.must_contain('foo.pot', "Hello from b.cpp") -test.must_not_contain('foo.pot', "Hello from c.cpp") -test.must_not_contain('foo.pot', "Hello from d.cpp") - -test.must_exist('bar.pot') -test.must_not_contain('bar.pot', "Hello from a.cpp") -test.must_not_contain('bar.pot', "Hello from b.cpp") -test.must_contain('bar.pot', "Hello from c.cpp") -test.must_contain('bar.pot', "Hello from d.cpp") - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples3.py b/test/XGETTEXT/POTUpdate_doc_user_examples3.py deleted file mode 100644 index 869a0ad..0000000 --- a/test/XGETTEXT/POTUpdate_doc_user_examples3.py +++ /dev/null @@ -1,65 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -test = TestSCons.TestSCons() - -test.subdir('po') -test.write('po/SConstruct', -""" -# SConstruct file in 'po/' subdirectory -env = Environment( tools = ['default', 'xgettext'] ) -env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') -""") -test.write('po/POTFILES.in', -""" -# POTFILES.in in 'po/' subdirectory -../a.cpp -../b.cpp -# end of file -""") -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) - -# scons 'pot-update' creates messages.pot -test.run(arguments = 'pot-update', chdir = 'po') -test.must_exist('po/messages.pot') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples4.py b/test/XGETTEXT/POTUpdate_doc_user_examples4.py deleted file mode 100644 index 70cbe29..0000000 --- a/test/XGETTEXT/POTUpdate_doc_user_examples4.py +++ /dev/null @@ -1,65 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -test = TestSCons.TestSCons() - -test.subdir('po') -test.write('po/SConstruct', -""" -# SConstruct file in 'po/' subdirectory -env = Environment( tools = ['default', 'xgettext'] ) -env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../') -""") -test.write('po/POTFILES.in', -""" -# POTFILES.in in 'po/' subdirectory -a.cpp -b.cpp -# end of file -""") -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) - -# scons 'pot-update' creates messages.pot -test.run(arguments = 'pot-update', chdir = 'po') -test.must_exist('po/messages.pot') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/XGETTEXT/POTUpdate_doc_user_examples5.py b/test/XGETTEXT/POTUpdate_doc_user_examples5.py deleted file mode 100644 index 39a2555..0000000 --- a/test/XGETTEXT/POTUpdate_doc_user_examples5.py +++ /dev/null @@ -1,76 +0,0 @@ - -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -test = TestSCons.TestSCons() - -test.subdir('0', ['0','1'], ['0', '1', 'po']) -test.write('0/1/po/SConstruct', -""" -# SConstruct file in '0/1/po/' subdirectory -env = Environment( tools = ['default', 'xgettext'] ) -env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../']) -""") -test.write('0/1/po/POTFILES.in', -""" -# POTFILES.in in '0/1/po/' subdirectory -a.cpp -# end of file -""") -test.write('0/a.cpp', """ gettext("Hello from ../../a.cpp") """) -test.write('0/1/a.cpp', """ gettext("Hello from ../a.cpp") """) - -# scons 'pot-update' creates messages.pot -test.run(arguments = 'pot-update', chdir = '0/1/po') -test.must_exist('0/1/po/messages.pot') -test.must_contain('0/1/po/messages.pot', 'Hello from ../a.cpp') -test.must_not_contain('0/1/po/messages.pot', 'Hello from ../../a.cpp') - -test.write('0/1/po/SConstruct', -""" -# SConstruct file in '0/1/po/' subdirectory -env = Environment( tools = ['default', 'xgettext'] ) -env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) -""") -test.run(arguments = 'pot-update', chdir = '0/1/po') -test.must_contain('0/1/po/messages.pot', 'Hello from ../../a.cpp') -test.must_not_contain('0/1/po/messages.pot', 'Hello from ../a.cpp') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/gettext/MOFiles/UserExamples.py b/test/gettext/MOFiles/UserExamples.py new file mode 100644 index 0000000..1b78268 --- /dev/null +++ b/test/gettext/MOFiles/UserExamples.py @@ -0,0 +1,240 @@ + +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +test = TestSCons.TestSCons() + +if not test.where_is('msgfmt'): + test.skip_test("Could not find 'msgfmt'; skipping test(s)\n") + +en_po_contents = """\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""" + +pl_po_contents = """\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""" + +de_po_contents = """\ +# German translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: de\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""" + +fr_po_contents = """\ +# French translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: dummypkg 1.0\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: fr\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "" +""" + +############################################################################# +# MOFiles: Example 1 +############################################################################# +test.subdir(['ex1']) +test.write( ['ex1', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgfmt"] ) +env.MOFiles(['pl', 'en']) +""") +test.write(['ex1', 'en.po'], en_po_contents) +test.write(['ex1', 'pl.po'], pl_po_contents) + +test.run(arguments = '.', chdir = 'ex1') +test.must_exist(['ex1', 'en.mo']) +test.must_exist(['ex1', 'pl.mo']) + + +############################################################################# +# MOFiles: Example 2 +############################################################################# +test.subdir(['ex2']) +test.write( ['ex2', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgfmt"] ) +env.MOFiles(LINGUAS_FILE = 1) +""") +# +test.write(['ex2', 'LINGUAS'], +""" +en +pl +""") +# +test.write(['ex2', 'en.po'], en_po_contents) +test.write(['ex2', 'pl.po'], pl_po_contents) + +test.run(arguments = '.', chdir = 'ex2') +test.must_exist(['ex2', 'en.mo']) +test.must_exist(['ex2', 'pl.mo']) + + +############################################################################# +# MOFiles: Example 3 +############################################################################# +test.subdir(['ex3']) +test.write( ['ex3', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgfmt"] ) +env.MOFiles(['en', 'pl'], LINGUAS_FILE = 1) +""") +test.write(['ex3', 'LINGUAS'], +""" +de +fr +""") +# +test.write(['ex3', 'en.po'], en_po_contents) +test.write(['ex3', 'pl.po'], pl_po_contents) +test.write(['ex3', 'de.po'], de_po_contents) +test.write(['ex3', 'fr.po'], fr_po_contents) + +test.run(arguments = '.', chdir = 'ex3') +test.must_exist(['ex3', 'en.mo']) +test.must_exist(['ex3', 'pl.mo']) +test.must_exist(['ex3', 'de.mo']) +test.must_exist(['ex3', 'fr.mo']) + + +############################################################################# +# MOFiles: Example 4 +############################################################################# +test.subdir(['ex4']) +test.write( ['ex4', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgfmt"] ) +env['LINGUAS_FILE'] = 1 +env.MOFiles() +""") + +test.write(['ex4', 'LINGUAS'], +""" +en +pl +""") + +test.write(['ex4', 'en.po'], en_po_contents) +test.write(['ex4', 'pl.po'], pl_po_contents) + +test.run(arguments = '.', chdir = 'ex4') +test.must_exist(['ex4', 'en.mo']) +test.must_exist(['ex4', 'pl.mo']) + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/gettext/POInit/UserExamples.py b/test/gettext/POInit/UserExamples.py new file mode 100644 index 0000000..a498a53 --- /dev/null +++ b/test/gettext/POInit/UserExamples.py @@ -0,0 +1,221 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +if not test.where_is('msginit'): + test.skip_test("Could not find 'msginit'; skipping test(s)\n") + +pot_contents = """\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""" + +############################################################################### +# POInit: Example 1 +############################################################################### +test.subdir(['ex1']) +test.write( ['ex1', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl']) # messages.pot --> [en.po, pl.po] +""") +# +test.write(['ex1', 'messages.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex1', stderr = None) +test.must_exist( ['ex1', 'en.po'] ) +test.must_exist( ['ex1', 'pl.po'] ) +test.must_contain( ['ex1', 'en.po'], "Hello from a.cpp") +test.must_contain( ['ex1', 'pl.po'], "Hello from a.cpp") + + +############################################################################### +# POInit: Example 2 +############################################################################### +test.subdir(['ex2']) +test.write( ['ex2', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] +""") +# +test.write(['ex2', 'foo.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex2', stderr = None) +test.must_exist( ['ex2', 'en.po'] ) +test.must_exist( ['ex2', 'pl.po'] ) +test.must_contain( ['ex2', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'pl.po'], "Hello from a.cpp" ) + +############################################################################### +# POInit: Example 3 +############################################################################### +test.subdir(['ex3']) +test.write( ['ex3', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] +""") +# +test.write(['ex3', 'foo.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex3', stderr = None) +test.must_exist( ['ex3', 'en.po'] ) +test.must_exist( ['ex3', 'pl.po'] ) +test.must_contain( ['ex3', 'en.po'], "Hello from a.cpp") +test.must_contain( ['ex3', 'pl.po'], "Hello from a.cpp") + +############################################################################### +# POInit: Example 4 +############################################################################### +test.subdir(['ex4']) +test.write( ['ex4', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +test.write(['ex4', 'LINGUAS'],""" +en +pl +""") +# +test.write(['ex4', 'messages.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex4', stderr = None) +test.must_exist( ['ex4', 'en.po'] ) +test.must_exist( ['ex4', 'pl.po'] ) +test.must_contain( ['ex4', 'en.po'], "Hello from a.cpp") +test.must_contain( ['ex4', 'pl.po'], "Hello from a.cpp") + +############################################################################### +# POInit: Example 5 +############################################################################### +test.subdir(['ex5']) +test.write( ['ex5', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env.POInit(['en', 'pl'], LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +test.write(['ex5', 'LINGUAS'],""" +de +fr +""") +# +test.write(['ex5', 'messages.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex5', stderr = None) +test.must_exist( ['ex5', 'en.po'] ) +test.must_exist( ['ex5', 'pl.po'] ) +test.must_exist( ['ex5', 'de.po'] ) +test.must_exist( ['ex5', 'fr.po'] ) +test.must_contain( ['ex5', 'en.po'], "Hello from a.cpp") +test.must_contain( ['ex5', 'pl.po'], "Hello from a.cpp") +test.must_contain( ['ex5', 'de.po'], "Hello from a.cpp") +test.must_contain( ['ex5', 'fr.po'], "Hello from a.cpp") + +############################################################################### +# POInit: Example 6 +############################################################################### +test.subdir(['ex6']) +test.write( ['ex6', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit"] ) +env['POAUTOINIT'] = 1 +env['LINGUAS_FILE'] = 1 +env['POTDOMAIN'] = 'foo' +env.POInit() +""") +test.write(['ex6', 'LINGUAS'],""" +en +pl +""") +# +test.write(['ex6', 'foo.pot'], pot_contents) + +# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-create', chdir = 'ex6', stderr = None) +test.must_exist( ['ex6', 'en.po'] ) +test.must_exist( ['ex6', 'pl.po'] ) +test.must_contain( ['ex6', 'en.po'], "Hello from a.cpp") +test.must_contain( ['ex6', 'pl.po'], "Hello from a.cpp") + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/gettext/POTUpdate/UserExamples.py b/test/gettext/POTUpdate/UserExamples.py new file mode 100644 index 0000000..3c1f298 --- /dev/null +++ b/test/gettext/POTUpdate/UserExamples.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +End-to-end tests for POTUpdate. Assure, taht the examples from user's +documentation all work. +""" + +import TestSCons +from os import path + +test = TestSCons.TestSCons() + +if not test.where_is('xgettext'): + test.skip_test("Could not find 'xgettext', skipping test(s).\n") + +############################################################################# +# POTUpdate: Example 1 +############################################################################# +test.subdir(['ex1']) +test.subdir(['ex1', 'po']) +test.write( ['ex1', 'po', 'SConstruct' ], +""" +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) +env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) +""") +test.write(['ex1', 'a.cpp'], """ gettext("Hello from a.cpp") """) +test.write(['ex1', 'b.cpp'], """ gettext("Hello from b.cpp") """) +test.write(['ex1', 'c.cpp'], """ gettext("Hello from c.cpp") """) +test.write(['ex1', 'd.cpp'], """ gettext("Hello from d.cpp") """) + +# scons '.' does not create foo.pot nor bar.pot +test.run(arguments = '.', chdir = path.join('ex1', 'po')) +test.must_not_exist( ['ex1', 'po', 'foo.pot'] ) +test.must_not_exist( ['ex1', 'po', 'bar.pot'] ) + +# scons 'foo.pot' creates foo.pot +test.run(arguments = 'foo.pot', chdir = path.join('ex1', 'po')) +test.must_exist( ['ex1', 'po', 'foo.pot'] ) +test.must_not_exist( ['ex1', 'po', 'bar.pot'] ) +test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from a.cpp" ) +test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from b.cpp" ) +test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from c.cpp" ) +test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from d.cpp" ) + +# scons 'pot-update' creates foo.pot and bar.pot +test.run(arguments = 'pot-update', chdir = path.join('ex1', 'po')) +test.must_exist( ['ex1', 'po', 'foo.pot'] ) +test.must_exist( ['ex1', 'po', 'bar.pot'] ) +test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from a.cpp" ) +test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from b.cpp" ) +test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from c.cpp" ) +test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from d.cpp" ) + +# scons -c does not clean anything +test.run(arguments = '-c', chdir = path.join('ex1', 'po')) +test.must_exist( ['ex1', 'po', 'foo.pot'] ) +test.must_exist( ['ex1', 'po', 'bar.pot'] ) + + +############################################################################# +# POTUpdate: Example 2 +############################################################################# +test.subdir(['ex2']) +test.write( ['ex2', 'SConstruct'], +""" +env = Environment( tools = ['default', 'xgettext'] ) +env['POTDOMAIN'] = "foo" +env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ... +env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot +""") +test.write(['ex2', 'a.cpp'], """ gettext("Hello from a.cpp") """) +test.write(['ex2', 'b.cpp'], """ gettext("Hello from b.cpp") """) +test.write(['ex2', 'c.cpp'], """ gettext("Hello from c.cpp") """) +test.write(['ex2', 'd.cpp'], """ gettext("Hello from d.cpp") """) + +test.run(arguments = 'pot-update', chdir = path.join('ex2')) + +test.must_exist( ['ex2', 'foo.pot']) +test.must_contain( ['ex2', 'foo.pot'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'foo.pot'], "Hello from b.cpp" ) +test.must_not_contain( ['ex2', 'foo.pot'], "Hello from c.cpp" ) +test.must_not_contain( ['ex2', 'foo.pot'], "Hello from d.cpp" ) + +test.must_exist( ['ex2', 'bar.pot']) +test.must_not_contain( ['ex2', 'bar.pot'], "Hello from a.cpp" ) +test.must_not_contain( ['ex2', 'bar.pot'], "Hello from b.cpp" ) +test.must_contain( ['ex2', 'bar.pot'], "Hello from c.cpp" ) +test.must_contain( ['ex2', 'bar.pot'], "Hello from d.cpp" ) + + +############################################################################# +# POTUpdate: Example 3 +############################################################################# +test.subdir(['ex3']) +test.subdir(['ex3', 'po']) +test.write( ['ex3', 'po', 'SConstruct'], +""" +# SConstruct file in 'po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') +""") +test.write( ['ex3', 'po', 'POTFILES.in'], +""" +# POTFILES.in in 'po/' subdirectory +../a.cpp +../b.cpp +# end of file +""") +test.write(['ex3', 'a.cpp'], """ gettext("Hello from a.cpp") """) +test.write(['ex3', 'b.cpp'], """ gettext("Hello from b.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = path.join('ex3', 'po')) +test.must_exist(['ex3', 'po', 'messages.pot']) + + +############################################################################# +# POTUpdate: Example 4 +############################################################################# +test.subdir(['ex4']) +test.subdir(['ex4', 'po']) +test.write( ['ex4', 'po', 'SConstruct'], +""" +# SConstruct file in 'po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../') +""") +test.write(['ex4', 'po', 'POTFILES.in'], +""" +# POTFILES.in in 'po/' subdirectory +a.cpp +b.cpp +# end of file +""") +test.write(['ex4', 'a.cpp'], """ gettext("Hello from a.cpp") """) +test.write(['ex4', 'b.cpp'], """ gettext("Hello from b.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = path.join('ex4', 'po')) +test.must_exist(['ex4', 'po', 'messages.pot']) + + + +############################################################################# +# POTUpdate: Example 5 +############################################################################# +test.subdir(['ex5']) +test.subdir(['ex5', '0']) +test.subdir(['ex5', '0','1']) +test.subdir(['ex5', '0', '1', 'po']) +test.write( ['ex5', '0', '1', 'po', 'SConstruct'], +""" +# SConstruct file in '0/1/po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../']) +""") +test.write( ['ex5', '0', '1', 'po', 'POTFILES.in'], +""" +# POTFILES.in in '0/1/po/' subdirectory +a.cpp +# end of file +""") +test.write(['ex5', '0', 'a.cpp'], """ gettext("Hello from ../../a.cpp") """) +test.write(['ex5', '0', '1', 'a.cpp'], """ gettext("Hello from ../a.cpp") """) + +# scons 'pot-update' creates messages.pot +test.run(arguments = 'pot-update', chdir = path.join('ex5', '0', '1', 'po')) +test.must_exist( ['ex5', '0', '1', 'po', 'messages.pot']) +test.must_contain( ['ex5', '0', '1', 'po', 'messages.pot'], + 'Hello from ../a.cpp' ) +test.must_not_contain( ['ex5', '0', '1', 'po', 'messages.pot'], + 'Hello from ../../a.cpp' ) + +test.write(['ex5', '0', '1', 'po', 'SConstruct'], +""" +# SConstruct file in '0/1/po/' subdirectory +env = Environment( tools = ['default', 'xgettext'] ) +env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) +""") +test.run(arguments = 'pot-update', chdir = path.join('ex5', '0', '1', 'po')) +test.must_contain( ['ex5', '0', '1', 'po', 'messages.pot'], + 'Hello from ../../a.cpp' ) +test.must_not_contain( ['ex5', '0', '1', 'po', 'messages.pot'], + 'Hello from ../a.cpp') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/gettext/POUpdate/UserExamples.py b/test/gettext/POUpdate/UserExamples.py new file mode 100644 index 0000000..01d3706 --- /dev/null +++ b/test/gettext/POUpdate/UserExamples.py @@ -0,0 +1,402 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Make sure, that the examples given in user guide all work. +""" + +import TestSCons +import os + +test = TestSCons.TestSCons() + + +if not test.where_is('msgmerge'): + test.skip_test("Could not find 'msgmerge'; skipping test(s)\n") + +pot_contents = """\ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" +"Last-Translator: FULL NAME \\n" +"Language-Team: LANGUAGE \\n" +"Language: \\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=CHARSET\\n" +"Content-Transfer-Encoding: 8bit\\n" +# +#: a.cpp:1 +msgid "Hello from a.cpp" +msgstr "" +""" + +en_po_contents = """\ +# English translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pawel Tomulik , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:37+0200\\n" +"Last-Translator: Pawel Tomulik \\n" +"Language-Team: English\\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Old message from a.cpp" +""" + +pl_po_contents = """\ +# Polish translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: pl\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Stara wiadomosc z a.cpp" +""" + +de_po_contents = """\ +# German translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: de\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "EINE ALTE Nachricht vom a.cpp" +""" + +fr_po_contents = """\ +# French translations for PACKAGE package. +# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\\n" +"Report-Msgid-Bugs-To: \\n" +"POT-Creation-Date: 2012-05-27 00:35+0200\\n" +"PO-Revision-Date: 2012-05-27 00:35+0200\\n" +"Last-Translator: Automatically generated\\n" +"Language-Team: none\\n" +"Language: fr\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=ASCII\\n" +"Content-Transfer-Encoding: 8bit\\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\\n" + +#: a.cpp:1 +msgid "Old message from a.cpp" +msgstr "Un ancien message du a.cpp" +""" + +############################################################################# +# POUpdate: Example 1 +############################################################################# +test.subdir(['ex1']) +test.write( ['ex1', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po] +""") +test.write(['ex1', 'messages.pot'], pot_contents) +test.write(['ex1', 'en.po'], en_po_contents) +test.write(['ex1', 'pl.po'], pl_po_contents) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex1', stderr = None) +test.must_exist( ['ex1', 'en.po'] ) +test.must_exist( ['ex1', 'pl.po'] ) +test.must_contain( ['ex1', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex1', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 2 +############################################################################# +test.subdir(['ex2']) +test.write( ['ex2', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po] +""") +# +test.write(['ex2', 'foo.pot'], pot_contents) +test.write(['ex2', 'en.po'], en_po_contents) +test.write(['ex2', 'pl.po'], pl_po_contents) + +# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex2', stderr = None) +test.must_exist( ['ex2', 'en.po'] ) +test.must_exist( ['ex2', 'pl.po'] ) +test.must_contain( ['ex2', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 3 +############################################################################# +test.subdir(['ex3']) +test.write( ['ex3', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] +""") +# +test.write(['ex3', 'foo.pot'], pot_contents) +test.write(['ex3', 'en.po'], en_po_contents) +test.write(['ex3', 'pl.po'], pl_po_contents) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex3', stderr = None) +test.must_exist( ['ex3', 'en.po'] ) +test.must_exist( ['ex3', 'pl.po'] ) +test.must_contain( ['ex3', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex3', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 4 +############################################################################# +test.subdir(['ex4']) +test.write( ['ex4', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file +""") +# +test.write(['ex4', 'LINGUAS'], +""" +en +pl +""") +# +test.write(['ex4', 'messages.pot'], pot_contents) +test.write(['ex4', 'en.po'], en_po_contents) +test.write(['ex4', 'pl.po'], pl_po_contents) + +# NOTE: msgmerge(1) prints all messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex4', stderr = None) +test.must_exist( ['ex4', 'messages.pot'] ) +test.must_exist( ['ex4', 'en.po'] ) +test.must_exist( ['ex4', 'pl.po'] ) +test.must_contain( ['ex4', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex4', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 5 +############################################################################# +test.subdir(['ex5']) +test.write( ['ex5', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(LINGUAS_FILE = 1, source = ['foo']) +""") +test.write(['ex5', 'LINGUAS'], +""" +en +pl +""") +# +test.write(['ex5', 'foo.pot'], pot_contents) +test.write(['ex5', 'en.po'], en_po_contents) +test.write(['ex5', 'pl.po'], pl_po_contents) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir= 'ex5', stderr = None) +test.must_exist( ['ex5', 'en.po'] ) +test.must_exist( ['ex5', 'pl.po'] ) +test.must_contain( ['ex5', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex5', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 6 +############################################################################# +test.subdir(['ex6']) +test.write( ['ex6', 'SConstruct'], +""" +env = Environment( tools = ["default", "msgmerge"] ) +env.POUpdate(['en', 'pl'], LINGUAS_FILE = 1) +""") +test.write(['ex6', 'LINGUAS'], +""" +de +fr +""") +test.write(['ex6', 'messages.pot'], pot_contents) +test.write(['ex6', 'en.po'], en_po_contents) +test.write(['ex6', 'pl.po'], pl_po_contents) +test.write(['ex6', 'de.po'], de_po_contents) +test.write(['ex6', 'fr.po'], fr_po_contents) + +# Note: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex6', stderr = None) +test.must_exist( ['ex6', 'en.po'] ) +test.must_exist( ['ex6', 'pl.po'] ) +test.must_exist( ['ex6', 'de.po'] ) +test.must_exist( ['ex6', 'fr.po'] ) +test.must_contain( ['ex6', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex6', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex6', 'de.po'], "Hello from a.cpp" ) +test.must_contain( ['ex6', 'fr.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 7 +############################################################################# +# +# From this poin we need msginit +# +if not test.where_is('msginit'): + test.skip_test("could not find 'msginit'; skipping test(s)\n") +### +test.subdir(['ex7']) +test.write( ['ex7', 'SConstruct'], +""" +env = Environment( tools = ["default", "msginit", "msgmerge"] ) +env.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1) +""") +test.write(['ex7', 'LINGUAS'], +""" +en +pl +""") +# +test.write(['ex7', 'messages.pot'], pot_contents) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir= 'ex7', stderr = None) +test.must_exist( ['ex7', 'en.po'] ) +test.must_exist( ['ex7', 'pl.po'] ) +test.must_contain( ['ex7', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex7', 'pl.po'], "Hello from a.cpp" ) + +############################################################################# +# POUpdate: Example 8 +############################################################################# +# +# From this point we need xgettext +# +if not test.where_is('xgettext'): + test.skip_test("could not find 'xgettext'; skipping test(s)\n") +### +test.subdir(['ex8']) +test.write( ['ex8', 'SConstruct'], +""" +env = Environment( tools = ["default", "xgettext", "msginit", "msgmerge"] ) + +# script-wise settings +env['POAUTOINIT'] = 1 +env['LINGUAS_FILE'] = 1 +env['POTDOMAIN'] = 'foo' +env.POTUpdate(source = 'a.cpp') +env.POUpdate() +""") +test.write(['ex8', 'LINGUAS'], +""" +en +pl +""") +test.write(['ex8', 'a.cpp'], """ gettext("Hello from a.cpp") """) + +# Note: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex8', stderr = None) +test.must_exist( ['ex8', 'foo.pot'] ) +test.must_exist( ['ex8', 'en.po'] ) +test.must_exist( ['ex8', 'pl.po'] ) +test.must_contain( ['ex8', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex8', 'pl.po'], "Hello from a.cpp" ) + +test.pass_test() + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 0f45606711da90eebed54c7b3131f20438d2afbb Mon Sep 17 00:00:00 2001 From: ptomulik Date: Mon, 18 Jun 2012 04:40:32 +0200 Subject: Removed some garbage from tests (found by accident) --- test/SWIG/SWIGOUTDIR.py | 2 - test/option/debug-duplicate.py | 134 ----------------------------------------- test/option/debug-prepare.py | 60 ------------------ 3 files changed, 196 deletions(-) diff --git a/test/SWIG/SWIGOUTDIR.py b/test/SWIG/SWIGOUTDIR.py index fe5b8a0..10b1575 100644 --- a/test/SWIG/SWIGOUTDIR.py +++ b/test/SWIG/SWIGOUTDIR.py @@ -33,8 +33,6 @@ import TestSCons test = TestSCons.TestSCons() -test = TestSCons.TestSCons() - swig = test.where_is('swig') if not swig: diff --git a/test/option/debug-duplicate.py b/test/option/debug-duplicate.py index e46a535..df2723e 100644 --- a/test/option/debug-duplicate.py +++ b/test/option/debug-duplicate.py @@ -65,137 +65,3 @@ test.pass_test() # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4: -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -_python_ = TestSCons._python_ - -test = TestSCons.TestSCons() - -test.subdir('sub1') - -test.write('SConstruct', """\ -env=Environment() -Export('env') -env.SConscript('SConscript', variant_dir='Build') -""") - -test.write('SConscript', """\ -Import('env') -env.Command('foo.out', 'SConscript', Copy('$TARGET', '$SOURCE')) -""") - -test.run(arguments = "--debug=duplicate -Q", - stdout='.*relinking variant.*', match=TestSCons.match_re_dotall) - -test.must_exist('Build/foo.out') - -test.write('SConscript', """\ -# different this time! -Import('env') -env.Command('foo.out', 'SConscript', Copy('$TARGET', '$SOURCE')) -""") - -test.run(arguments = "--debug=duplicate -Q", - stdout='.*relinking variant.*removing existing target.*', - match=TestSCons.match_re_dotall) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -_python_ = TestSCons._python_ - -test = TestSCons.TestSCons() - -test.subdir('sub1') - -test.write('SConstruct', """\ -env=Environment() -Export('env') -env.SConscript('SConscript', variant_dir='Build') -""") - -test.write('SConscript', """\ -Import('env') -env.Command('foo.out', 'SConscript', Copy('$TARGET', '$SOURCE')) -""") - -test.run(arguments = "--debug=duplicate -Q", - stdout='.*relinking variant.*', match=TestSCons.match_re_dotall) - -test.must_exist('Build/foo.out') - -test.write('SConscript', """\ -# different this time! -Import('env') -env.Command('foo.out', 'SConscript', Copy('$TARGET', '$SOURCE')) -""") - -test.run(arguments = "--debug=duplicate -Q", - stdout='.*relinking variant.*removing existing target.*', - match=TestSCons.match_re_dotall) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/option/debug-prepare.py b/test/option/debug-prepare.py index a29f431..350c352 100644 --- a/test/option/debug-prepare.py +++ b/test/option/debug-prepare.py @@ -58,63 +58,3 @@ test.pass_test() # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4: -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -_python_ = TestSCons._python_ - -test = TestSCons.TestSCons() - -test.write('SConstruct', """\ -env=Environment() -dest=env.Command('foo.out', 'SConstruct', - [Copy('$TARGET', '$SOURCE'), - Copy('${TARGET}.extra', '$SOURCE')]) -env.SideEffect('foo.out.extra', dest) -""") - -expect = """\ -Preparing target foo.out... -...with side-effect foo.out.extra... -...Preparing side-effect foo.out.extra... -Copy("foo.out", "SConstruct") -Copy("foo.out.extra", "SConstruct") -Preparing target .... -""" - -test.run(arguments = "--debug=prepare", stdout=test.wrap_stdout(expect)) - -test.must_exist('foo.out') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 0fb10d023356a3252321ce513874446e1b8a3d57 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Mon, 18 Jun 2012 13:24:42 +0200 Subject: Added tests covering the examples in Translate tool's documentation --- test/gettext/Translate/UserExamples.py | 179 +++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 test/gettext/Translate/UserExamples.py diff --git a/test/gettext/Translate/UserExamples.py b/test/gettext/Translate/UserExamples.py new file mode 100644 index 0000000..b2e6a59 --- /dev/null +++ b/test/gettext/Translate/UserExamples.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +XXX Put a description of the test here. +""" + +import TestSCons +from os import path + +test = TestSCons.TestSCons() + +if not test.where_is('xgettext'): + test.skip_test("could not find 'xgettext'; skipping test(s)\n") +if not test.where_is('msgmerge'): + test.skip_test("Could not find 'msgmerge'; skipping test(s)\n") +if not test.where_is('msginit'): + test.skip_test("could not find 'msginit'; skipping test(s)\n") +if not test.where_is('msgfmt'): + # We really don't use it until the Example 3, but we load "gettext" tool, + # which depends on msgfmt. + test.skip_test("could not find 'msgfmt'; skipping test(s)\n") + + +############################################################################# +# Translate: Example 1 +############################################################################# +test.subdir(['ex1']) +test.subdir(['ex1', 'po']) +test.write( ['ex1', 'po', 'SConstruct'], +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.Translate(['en','pl'], ['../a.cpp', '../b.cpp']) +""") +test.write(['ex1', 'a.cpp'], """ gettext("Hello from a.cpp") """ ) +test.write(['ex1', 'b.cpp'], """ gettext("Hello from b.cpp") """) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = path.join('ex1','po'), stderr = None) +test.must_exist( ['ex1', 'po', 'en.po'] ) +test.must_exist( ['ex1', 'po', 'pl.po'] ) +test.must_contain( ['ex1', 'po', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex1', 'po', 'en.po'], "Hello from b.cpp" ) +test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from b.cpp" ) + +############################################################################# +# Translate: Example 2 +############################################################################# +test.subdir(['ex2']) +test.subdir(['ex2', 'po']) +test.write( ['ex2', 'po', 'SConstruct'], +""" +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env['XGETTEXTPATH'] = ['../'] +env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') +""") +test.write(['ex2', 'po', 'LINGUAS'], """ +# LINGUAS +en pl +#end""") +test.write(['ex2', 'po', 'POTFILES.in'], """ +# POTFILES.in +a.cpp +b.cpp +# end""") +test.write(['ex2', 'a.cpp'], """ gettext("Hello from a.cpp") """ ) +test.write(['ex2', 'b.cpp'], """ gettext("Hello from b.cpp") """) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = path.join('ex2','po'), stderr = None) +test.must_exist( ['ex2', 'po', 'en.po'] ) +test.must_exist( ['ex2', 'po', 'pl.po'] ) +test.must_contain( ['ex2', 'po', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'po', 'en.po'], "Hello from b.cpp" ) +test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from b.cpp" ) + +############################################################################# +# Translate: Example 3 +############################################################################# +test.subdir(['ex3']) +test.subdir(['ex3', 'build']) +test.subdir(['ex3', 'src']) +test.subdir(['ex3', 'src', 'po']) +test.write( ['ex3', 'Sconstruct'], +""" +# SConstruct +env = Environment( tools = ["default", "gettext"] ) +VariantDir('build', 'src', duplicate = 0) +env['POAUTOINIT'] = 1 +SConscript('src/po/SConscript.i18n', exports = 'env') +SConscript('build/po/SConscript', exports = 'env') +""") +test.write( ['ex3', 'src', 'po', 'SConscript.i18n'], +""" +# src/po/SConscript.i18n +Import('env') +env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../']) +""") +test.write( ['ex3', 'src', 'po', 'SConscript'], +""" +# src/po/SConscript +Import('env') +env.MOFiles(LINGUAS_FILE = 1) +""") +test.write(['ex3', 'src', 'po', 'LINGUAS'], """ +# LINGUAS +en pl +#end""") +test.write(['ex3', 'src', 'po', 'POTFILES.in'], """ +# POTFILES.in +a.cpp +b.cpp +# end""") +test.write(['ex3', 'src', 'a.cpp'], """ gettext("Hello from a.cpp") """ ) +test.write(['ex3', 'src', 'b.cpp'], """ gettext("Hello from b.cpp") """) + +# NOTE: msgmerge(1) prints its messages to stderr, we must ignore them, +# So, stderr=None is crucial here. It is no point to match stderr to some +# specific valuse; the messages are internationalized :) ). +test.run(arguments = 'po-update', chdir = 'ex3', stderr = None) +test.must_exist( ['ex3', 'src', 'po', 'messages.pot'] ) +test.must_exist( ['ex3', 'src', 'po', 'en.po'] ) +test.must_exist( ['ex3', 'src', 'po', 'pl.po'] ) +# +test.must_not_exist( ['ex3', 'build', 'po', 'messages.pot'] ) +test.must_not_exist( ['ex3', 'build', 'po', 'en.po'] ) +test.must_not_exist( ['ex3', 'build', 'po', 'pl.po'] ) +# +test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from a.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from b.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from a.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from b.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from b.cpp" ) + +test.run(arguments = '.', chdir = 'ex3', stderr = None) +test.must_exist( ['ex3', 'build', 'po', 'en.mo'] ) +test.must_exist( ['ex3', 'build', 'po', 'pl.mo'] ) +test.must_not_exist( ['ex3', 'src', 'po', 'en.mo'] ) +test.must_not_exist( ['ex3', 'src', 'po', 'pl.mo'] ) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 611b809ac42c269cb337a2e20ad0d4363bc6fe91 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Tue, 19 Jun 2012 01:26:07 +0200 Subject: Removed test/GETTEXT --- test/GETTEXT/Translate_doc_user_examples1.py | 67 ------------------ test/GETTEXT/Translate_doc_user_examples2.py | 79 --------------------- test/GETTEXT/Translate_doc_user_examples3.py | 101 --------------------------- test/GETTEXT/doc_user_examples1.py | 51 -------------- 4 files changed, 298 deletions(-) delete mode 100644 test/GETTEXT/Translate_doc_user_examples1.py delete mode 100644 test/GETTEXT/Translate_doc_user_examples2.py delete mode 100644 test/GETTEXT/Translate_doc_user_examples3.py delete mode 100644 test/GETTEXT/doc_user_examples1.py diff --git a/test/GETTEXT/Translate_doc_user_examples1.py b/test/GETTEXT/Translate_doc_user_examples1.py deleted file mode 100644 index f3c20be..0000000 --- a/test/GETTEXT/Translate_doc_user_examples1.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.subdir('po/') -test.write('po/SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) -""") -# -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None, chdir = 'po') -test.must_exist('po/messages.pot') -test.must_exist('po/en.po', 'po/pl.po') -test.must_contain('po/en.po', "Hello from a.cpp") -test.must_contain('po/en.po', "Hello from b.cpp") -test.must_contain('po/pl.po', "Hello from a.cpp") -test.must_contain('po/pl.po', "Hello from b.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/Translate_doc_user_examples2.py b/test/GETTEXT/Translate_doc_user_examples2.py deleted file mode 100644 index 674c975..0000000 --- a/test/GETTEXT/Translate_doc_user_examples2.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.subdir('po/') -test.write('po/SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -env['POAUTOINIT'] = 1 -env['XGETTEXTPATH'] = ['../'] -env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') -""") -# -test.write('po/LINGUAS', """\ -en pl -""") -# -test.write('po/POTFILES.in', """\ -# POTFILES.in -a.cpp -b.cpp -# end -""") -# -test.write('a.cpp', """ gettext("Hello from a.cpp") """) -test.write('b.cpp', """ gettext("Hello from b.cpp") """) - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None, chdir = 'po') -test.must_exist('po/messages.pot') -test.must_exist('po/en.po', 'po/pl.po') -test.must_contain('po/en.po', "Hello from a.cpp") -test.must_contain('po/en.po', "Hello from b.cpp") -test.must_contain('po/pl.po', "Hello from a.cpp") -test.must_contain('po/pl.po', "Hello from b.cpp") - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/Translate_doc_user_examples3.py b/test/GETTEXT/Translate_doc_user_examples3.py deleted file mode 100644 index 456d328..0000000 --- a/test/GETTEXT/Translate_doc_user_examples3.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.subdir('src', ['src', 'po'], 'build') -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -VariantDir('build', 'src', duplicate = 0) -env['POAUTOINIT'] = 1 -SConscript('src/po/SConscript.i18n', exports = 'env') -SConscript('build/po/SConscript', exports = 'env') -""") -# -test.write('src/po/SConscript.i18n', """\ -# src/po/SConscript.i18n -Import('env') -env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../']) -""") -# -test.write('src/po/SConscript',"""\ -# src/po/SConscript -Import('env') -env.MOFiles(LINGUAS_FILE = 1) -""") -test.write('src/po/LINGUAS', """\ -en pl -""") -# -test.write('src/po/POTFILES.in', """\ -# POTFILES.in -a.cpp -b.cpp -# end -""") -# -test.write('src/a.cpp', """ gettext("Hello from a.cpp") """) -test.write('src/b.cpp', """ gettext("Hello from b.cpp") """) - -# NOTE: msginit(1) prints all its messages to stderr, we must ignore them, -# So, stderr=None is crucial here. It is no point to match stderr to some -# specific valuse; the messages are internationalized :) ). -test.run(arguments = 'po-update', stderr = None) -test.must_exist('src/po/messages.pot') -test.must_exist('src/po/en.po', 'src/po/pl.po') -test.must_not_exist('build/po/en.po', 'build/po/pl.po') -test.must_contain('src/po/en.po', "Hello from a.cpp") -test.must_contain('src/po/en.po', "Hello from b.cpp") -test.must_contain('src/po/pl.po', "Hello from a.cpp") -test.must_contain('src/po/pl.po', "Hello from b.cpp") - -test.run(arguments = '.', stderr = None) -test.must_exist('build/po/en.mo', 'build/po/pl.mo') -test.must_not_exist('src/po/en.mo', 'src/po/pl.mo') - -test.run(arguments = '-c', stderr = None) -test.must_exist('src/po/messages.pot') -test.must_exist('src/po/en.po', 'src/po/pl.po') -test.must_not_exist('build/po/en.mo', 'build/po/pl.mo') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GETTEXT/doc_user_examples1.py b/test/GETTEXT/doc_user_examples1.py deleted file mode 100644 index 56d56e6..0000000 --- a/test/GETTEXT/doc_user_examples1.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -""" -Make sure, that the examples given in user guide all work. -""" - -import TestSCons -import os - -############################################################################### -# Trivial example. Just load the tool. -test = TestSCons.TestSCons() - -test.write('SConstruct', -""" -env = Environment( tools = ["default", "gettext"] ) -""") -test.run(arguments = '.') - -test.pass_test() - - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12