diff options
author | ptomulik <ptomulik@meil.pw.edu.pl> | 2012-06-18 02:35:11 (GMT) |
---|---|---|
committer | ptomulik <ptomulik@meil.pw.edu.pl> | 2012-06-18 02:35:11 (GMT) |
commit | 5b83cf3b2af8b25093ff15960fbc5a86ed3062b3 (patch) | |
tree | e01d677c815b0bd2e498bef9207d4a3f394a43d3 | |
parent | 6a587bf579a5c57e713668a5538d4591ca81db92 (diff) | |
download | SCons-5b83cf3b2af8b25093ff15960fbc5a86ed3062b3.zip SCons-5b83cf3b2af8b25093ff15960fbc5a86ed3062b3.tar.gz SCons-5b83cf3b2af8b25093ff15960fbc5a86ed3062b3.tar.bz2 |
Changes in gettext tool - tests refactored, small changes in sources.
34 files changed, 956 insertions, 2253 deletions
diff --git a/src/engine/SCons/Tool/GettextCommon.py b/src/engine/SCons/Tool/GettextCommon.py index af506d7..86d7eaf 100644 --- a/src/engine/SCons/Tool/GettextCommon.py +++ b/src/engine/SCons/Tool/GettextCommon.py @@ -362,20 +362,6 @@ def _init_po_files(target, source, env): ############################################################################# ############################################################################# -def _install_mo_files( env, localedir, source, domain, category="LC_MESSAGES" - , *args, **kw): - """ Function for `InstallMOFiles` pseudo-builder """ - import SCons.Util - import os - nodes = [] - for src in source: - lang = SCons.Util.splitext(os.path.basename(str(src)))[0] - tgt = os.path.join(localedir, lang, category, domain + "$MOSUFFIX") - nodes.extend(env.InstallAs(tgt, src, *args, **kw)) - return nodes -############################################################################# - -############################################################################# def _detect_xgettext(env): """ Detects *xgettext(1)* binary """ if env.has_key('XGETTEXT'): diff --git a/src/engine/SCons/Tool/gettext.py b/src/engine/SCons/Tool/gettext.py index 42fafd7..dd336b6 100644 --- a/src/engine/SCons/Tool/gettext.py +++ b/src/engine/SCons/Tool/gettext.py @@ -29,12 +29,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" def generate(env,**kw): import SCons.Tool from SCons.Tool.GettextCommon \ - import _translate, _install_mo_files, tool_list + import _translate, tool_list for t in tool_list(env['PLATFORM'], env): env.Tool(t) env.AddMethod(_translate, 'Translate') - # This is not ready yet - # env.AddMethod(_install_mo_files, 'InstallMOFiles') ############################################################################# ############################################################################# diff --git a/src/engine/SCons/Tool/gettext.xml b/src/engine/SCons/Tool/gettext.xml index 54ed1d6..3a9a78d 100644 --- a/src/engine/SCons/Tool/gettext.xml +++ b/src/engine/SCons/Tool/gettext.xml @@ -162,35 +162,6 @@ running <command>scons '.'</command>.</para></note> </summary> </builder> -<!-- -<builder name="InstallMOFiles"> -<summary> -This is not implemented yet. -Install <literal>MO</literal> catalog files into system directories. - -The parameters are: -- <literal>localedir</literal> - system locale base directory, e.g. <literal>/usr/share/locale</literal> -- <literal>source</literal> - list of <literal>MO</literal> files to install -- <literal>domain</literal> - domain, i.e. your package/program name -- <literal>category</literal> - locale category, e.g. <literal>LC_MESSAGES</literal> - -The installation goes in standard way. For example, if -<literal>localedir="/usr/share/locale"</literal>, <literal>domain="program1"</literal>, -<literal>category="LC_MESSAGES"</literal>, <literal>sources=['en.mo', 'fr.mo']</literal>, then the -installation goes as follows: -<example> -en.mo ===> /usr/share/locale/en/LC_MESSAGES/program1.mo -fr.mo ===> /usr/share/locale/fr/LC_MESSAGES/program1.mo -</example> -The <literal>InstallMOFiles</literal> builder uses internaly <literal>InstallAs</literal> builder, so all -the features of <literal>InstallAs</literal> (e.g. <literal>xxinstall-sandbox</literal>) should work. -<example> -TODO: -</example> -</summary> -</builder> ---> - <cvar name="POTDOMAIN"> <summary> The &cv-POTDOMAIN; defines default domain, used to generate @@ -227,12 +198,3 @@ default file named </summary> </cvar> - -<scons_function name="Dummy"> -<arguments> -TODO: Try to remove me. -</arguments> -<summary> -TODO: Try to remove me. -</summary> -</scons_function> 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 </sets> <uses> 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 </sets> <uses> 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 </sets> <uses> 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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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_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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" -"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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/MSGFMT/MOFile_doc_user_examples3.py b/test/gettext/MOFiles/UserExamples.py index 8624b4a..1b78268 100644 --- a/test/MSGFMT/MOFile_doc_user_examples3.py +++ b/test/gettext/MOFiles/UserExamples.py @@ -32,22 +32,12 @@ 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',"""\ +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. @@ -70,9 +60,9 @@ msgstr "" #: a.cpp:1 msgid "Old message from a.cpp" msgstr "Old message from a.cpp" -""") -# -test.write('pl.po',"""\ +""" + +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. @@ -96,9 +86,9 @@ msgstr "" #: a.cpp:1 msgid "Old message from a.cpp" msgstr "Stara wiadomosc z a.cpp" -""") -# -test.write('de.po',"""\ +""" + +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. @@ -121,9 +111,9 @@ msgstr "" #: a.cpp:1 msgid "Old message from a.cpp" msgstr "" -""") -# -test.write('fr.po',"""\ +""" + +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. @@ -146,10 +136,99 @@ msgstr "" #: 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 = '.') -test.must_exist('en.mo', 'pl.mo', 'de.mo', 'fr.mo') +test.run(arguments = '.', chdir = 'ex4') +test.must_exist(['ex4', 'en.mo']) +test.must_exist(['ex4', 'pl.mo']) test.pass_test() 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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" +"Language-Team: LANGUAGE <LL@li.org>\\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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\\n" +"Language-Team: LANGUAGE <LL@li.org>\\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 <ptomulik@meil.pw.edu.pl>, 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 <ptomulik@meil.pw.edu.pl>\\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: |