Locale-XGettext-0.7000755000765000024 013367562357 13745 5ustar00guidostaff000000000000LICENSE100644000765000024 12501713367562357 15101 0ustar00guidostaff000000000000Locale-XGettext-0.7Copyright (C) 2018 Guido Flohr This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ------------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . Changes100644000765000024 116313367562357 15322 0ustar00guidostaff000000000000Locale-XGettext-0.7Changes for Locale-XGettext. 0.7 2018-11-04 - fixes for utf-8 ideosyncrasies that caused wrong encoding on output files 0.6 2018-10-22 - fixes https://github.com/gflohr/Locale-XGettext/issues/3 That was a blocker for [Qgoda](http://www.qgoda.net/), see https://github.com/gflohr/qgoda/issues/33 - releases 0.4 and 0.5 had to be skipped because of a versioning problem 0.3 2017-12-31 - Allow overriding program name. - Allow setting CLI options for internal use. 0.2 2017-09-14 - Allow arbitrary keywords. - Check for sufficient version of Getopt::Long. 0.1 2017-09-10 - Initial version. META.yml100644000765000024 175613367562357 15310 0ustar00guidostaff000000000000Locale-XGettext-0.7--- abstract: 'Extract Strings To PO Files' author: - 'Guido Flohr ' build_requires: Module::Build: '0.28' Test::More: '0' vars: '0' configure_requires: ExtUtils::MakeMaker: '0' Module::Build: '0.28' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: lgpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Locale-XGettext requires: Carp: '0' Encode: '0' File::Spec: '0' Getopt::Long: '2.36' Locale::Messages: '0' Locale::PO: '0.27' Locale::Recode: '0' Locale::TextDomain: '1.20' Scalar::Util: '0' base: '0' perl: '5.008' strict: '0' utf8: '0' resources: bugtracker: https://github.com/gflohr/Locale-XGettext/issues homepage: http://www.guido-flohr.net/en/projects#locale-xgettext repository: git://github.com/gflohr/Locale-XGettext.git version: '0.7' x_generated_by_perl: v5.26.2 x_serialization_backend: 'YAML::Tiny version 1.73' MANIFEST100644000765000024 304013367562357 15154 0ustar00guidostaff000000000000Locale-XGettext-0.7# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Build.PL Changes LICENSE MANIFEST META.json META.yml Makefile.PL README.md README.pod bin/xgettext-txt dist.ini lib/Locale/XGettext.pm lib/Locale/XGettext.pod lib/Locale/XGettext/Text.pm lib/Locale/XGettext/Text.pod lib/Locale/XGettext/Util/Flag.pm lib/Locale/XGettext/Util/Flag.pod lib/Locale/XGettext/Util/Keyword.pm lib/Locale/XGettext/Util/Keyword.pod lib/Locale/XGettext/Util/POEntries.pm lib/Locale/XGettext/Util/POEntries.pod lib/LocaleData/de/LC_MESSAGES/Locale-XGettext.mo perlcritic.rc po/Locale-XGettext.pot po/Makefile po/PACKAGE po/POTFILES po/de.po samples/C/CXGettext.c samples/C/README.md samples/C/xgettext-lines.pl samples/Java/JavaXGettext.java samples/Java/README.md samples/Java/xgettext-lines.pl samples/Perl/README.md samples/Perl/xgettext-lines.pl samples/Python/PythonXGettext.py samples/Python/README.md samples/Python/xgettext-lines.pl samples/Python/xgettext-lines.py samples/README.md samples/Ruby/README.md samples/Ruby/RubyXGettext.rb samples/Ruby/xgettext-lines.pl t/POTFILES1 t/POTFILES2 t/TestLib.pm t/author-critic.t t/author-pod-coverage.t t/author-pod-syntax.t t/automatic-flags.t t/comments.t t/copyright-holder.t t/directory.t t/exclude-file.po t/exclude-file.t t/files/additional.txt t/files/extra.txt t/files/hello.txt t/files2/hello.txt t/files2/two.txt t/flags.t t/foreign-user.t t/input-files.t t/join-existing.t t/keywords.t t/msgid-bugs-address.t t/omit-header.t t/output-file.t t/package-name.t t/package-version.t t/release-cpan-changes.t Build.PL100644000765000024 257113367562357 15327 0ustar00guidostaff000000000000Locale-XGettext-0.7 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.012. use strict; use warnings; use Module::Build 0.28; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.28" }, "configure_requires" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "dist_abstract" => "Extract Strings To PO Files", "dist_author" => [ "Guido Flohr " ], "dist_name" => "Locale-XGettext", "dist_version" => "0.7", "license" => "lgpl", "module_name" => "Locale::XGettext", "recursive_test_files" => 1, "requires" => { "Carp" => 0, "Encode" => 0, "File::Spec" => 0, "Getopt::Long" => "2.36", "Locale::Messages" => 0, "Locale::PO" => "0.27", "Locale::Recode" => 0, "Locale::TextDomain" => "1.20", "Scalar::Util" => 0, "base" => 0, "perl" => "5.008", "strict" => 0, "utf8" => 0 }, "script_files" => [ "bin/xgettext-txt" ], "test_requires" => { "Test::More" => 0, "vars" => 0 } ); my %fallback_build_requires = ( "Module::Build" => "0.28", "Test::More" => 0, "vars" => 0 ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = Module::Build->new(%module_build_args); $build->create_build_script; dist.ini100644000765000024 343713367562357 15501 0ustar00guidostaff000000000000Locale-XGettext-0.7; Copyright (C) 2016-2017 Guido Flohr , ; all rights reserved. ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 3 of the License, or ; (at your option) any later version. ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . name = Locale-XGettext version = 0.7 author = Guido Flohr license = LGPL_3_0::or_later copyright_holder = Guido Flohr [@Filter] -bundle = @Basic -remove = Readme -remove = GatherDir [@Git] [PkgVersion] [NextRelease] format=%v %{yyyy-MM-dd}d [ModuleBuild] [Git::GatherDir] exclude_filename = Build.PL exclude_filename = LICENSE exclude_filename = MANIFEST exclude_filename = Makefile.PL [Test::Perl::Critic] [Test::CPAN::Changes] [PodCoverageTests] [PodSyntaxTests] [AutoPrereqs] [MetaJSON] [MinimumPerlFast] [MetaResources] homepage = http://www.guido-flohr.net/en/projects#locale-xgettext bugtracker.web = https://github.com/gflohr/Locale-XGettext/issues repository.url = git://github.com/gflohr/Locale-XGettext.git repository.web = http://github.com/gflohr/Locale-XGettext.git repository.type = git [BuildFile / README.pod] command = perl -MMarkdown::To::POD -e 'print Markdown::To::POD::markdown_to_pod(join "", <>)' README.md >{{$target}} [GatherFile] filename = README.pod [CopyFilesFromBuild] copy = Build.PL copy = LICENSE copy = MANIFEST copy = Makefile.PL po000755000765000024 013367562357 14304 5ustar00guidostaff000000000000Locale-XGettext-0.7de.po100644000765000024 4215713367562357 15425 0ustar00guidostaff000000000000Locale-XGettext-0.7/po# German translations for Locale-XGettext. # Copyright (C) 2016-2017 Guido Flohr. # This file is distributed under the same license as the # Locale-XGettext package. msgid "" msgstr "" "Project-Id-Version: Locale-XGettext 0.1\n" "Report-Msgid-Bugs-To: guido.flohr@cantanea.com\n" "POT-Creation-Date: 2017-12-31 09:07+0200\n" "PO-Revision-Date: 2017-08-23 18:12+0200\n" "Last-Translator: Guido Flohr \n" "Language-Team: Guido Flohr \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.1\n" #: ../lib/Locale/XGettext/Text.pm:34 ../lib/Locale/XGettext.pm:770 #, perl-brace-format msgid "Error reading '{filename}': {error}!\n" msgstr "Fehler beim Lesen von „{filename}“: {error}!\n" #: ../lib/Locale/XGettext/Text.pm:63 #, perl-brace-format msgid "" "{program} (Locale-XGettext) {version}\n" "Copyright (C) {years} Cantanea EOOD (http://www.cantanea.com/).\n" "License LGPLv3+: GNU Lesser General Public Licence version 3 \n" "or later .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" "Written by Guido Flohr (http://www.guido-flohr.net/).\n" msgstr "" "{program} (Locale-XGettext) {version}\n" "Copyright (C) {years} Cantanea EOOD (http://www.cantanea.com/).\n" "License LGPLv3+: GNU Lesser General Public Licence version 3 \n" "oder neuer .\n" "Dies ist freie Software: es sterht Ihnen frei, sie zu verändern und " "weiterzugeben.\n" "Es gibt KEINE GARANTIE, soweit gesetzlich zulässig.\n" "Geschrieben von Guido Flohr (http://www.guido-flohr.net/).\n" #: ../lib/Locale/XGettext/Text.pm:75 msgid "" "Input files are interpreted as plain text files with each paragraph being\n" "a separately translatable unit.\n" msgstr "" "Eingabedateien werden als einfache Textdateien ausgewertet, wobei jeder\n" "Absatz zu einer separaten Übersetzungseinheit wird.\n" #: ../lib/Locale/XGettext/Util/Keyword.pm:46 #, perl-brace-format msgid "Multiple meanings for argument #{num} for function '{function}'!\n" msgstr "Mehrere Bedeutungen für Argument #{num} für Funktion „{function}“!\n" #: ../lib/Locale/XGettext/Util/Keyword.pm:50 #, perl-brace-format msgid "Multiple context arguments for function '{function}'!\n" msgstr "Mehrere Kontextargumente für Funktion „{function}“!\n" #: ../lib/Locale/XGettext/Util/Keyword.pm:55 #, perl-brace-format msgid "Too many forms for '{function}'!\n" msgstr "Zu viele Formen für Funktion „{function}“!\n" #: ../lib/Locale/XGettext/Util/Keyword.pm:63 #, perl-brace-format msgid "Multiple automatic comments for function '{function}'!\n" msgstr "Mehrere automatische Kommentare für Funktion „{function}“!\n" #: ../lib/Locale/XGettext/Util/Keyword.pm:68 #, perl-brace-format msgid "Invalid argument specification '{spec}' for function '{function}'!\n" msgstr "" "Unzulässige Argumentspezifikation „{spec}“ für die Funktion „{function}“!\n" #: ../lib/Locale/XGettext/Util/POEntries.pm:105 msgid "conflicting plural forms" msgstr "in Konflikt stehende Pluralformen" #: ../lib/Locale/XGettext/Util/POEntries.pm:151 #: ../lib/Locale/XGettext/Util/POEntries.pm:155 msgid "conflicting flags" msgstr "in Konflikt stehende Flags" #: ../lib/Locale/XGettext/Util/POEntries.pm:170 #, perl-brace-format msgid "" "{new_ref}: conflicts with ...\n" "{old_ref}: {msg}\n" msgstr "" "{new_ref}: steht in Konflikt mit ...\n" "{old_ref}: {msg}\n" #: ../lib/Locale/XGettext.pm:65 #, perl-brace-format msgid "" "{package} is an abstract base class and must not be instantiated directly" msgstr "" "„{package}“ ist eine abstrakte Basisklasse und kann nicht direkt " "instantiiert werden" #: ../lib/Locale/XGettext.pm:79 msgid "The argument to '--add-location' must be 'full', 'file', or 'never'.\n" msgstr "" "Das Argument für „--add-location“ must entweder „full“, „file“ oder „never“ " "lauten!\n" #: ../lib/Locale/XGettext.pm:86 msgid "Option 'add_comments' must be an array reference.\n" msgstr "Die Option „--add-location“ muss eine Array-Referenz sein.\n" #: ../lib/Locale/XGettext.pm:101 #, perl-brace-format msgid "" "warning: '{from_code}' is not a valid encoding name. Using ASCII as " "fallback." msgstr "" " „{from_code}“ ist kein gültiger Name für eine Zeichenkodierung. ASCII wird " "ersatzweise verwendet." #: ../lib/Locale/XGettext.pm:112 msgid "no input file given" msgstr "Eingabedatei fehlt" #: ../lib/Locale/XGettext.pm:165 msgid "Attempt to re-run extractor" msgstr "Versuch, den Extrahierer erneut zu starten" #: ../lib/Locale/XGettext.pm:173 msgid "--join-existing cannot be used when output is written to stdout" msgstr "" "„--join-existing“ kann nicht benutzt werden, wenn nach Standardausgabe\n" "geschrieben wird" #: ../lib/Locale/XGettext.pm:181 #, perl-brace-format msgid "Error resolving file name '{filename}': {error}!\n" msgstr "Fehler beim Auflösen des Dateinamens „{filename}“: {error}!\n" #: ../lib/Locale/XGettext.pm:229 ../lib/Locale/XGettext.pm:611 #, perl-brace-format msgid "error reading '{filename}': {error}!\n" msgstr "Fehler beim Lesen der Datei „{filename}“: {error}!\n" #. TRANSLATORS: run() is a method that should be invoked first. #: ../lib/Locale/XGettext.pm:249 msgid "Attempt to add entries before run" msgstr "Fehler, Einträge vor Aufruf der Methode run() zuzufügen" #: ../lib/Locale/XGettext.pm:388 #, perl-brace-format msgid "" "Non-ASCII string at '{reference}'.\n" " Please specify the source encoding through '--from-code'.\n" msgstr "" "{reference}: Nicht-ASCII-String.\n" " Bitte die Kodierung des Quelltextes mit „--from-code“ angeben!\n" #: ../lib/Locale/XGettext.pm:399 #, perl-brace-format msgid "{reference}: invalid multibyte sequence\n" msgstr "{reference}: Ungültige Multibyte-Sequenz\n" #: ../lib/Locale/XGettext.pm:473 msgid "Attempt to output from extractor before run" msgstr "" "Versuch, die Ausgabe des Extrahierers zu starten, bevor run() aufgerufen " "wurde" #: ../lib/Locale/XGettext.pm:478 msgid "No PO data" msgstr "Keine PO-Daten" #: ../lib/Locale/XGettext.pm:487 ../lib/Locale/XGettext.pm:492 #: ../lib/Locale/XGettext.pm:496 #, perl-brace-format msgid "Error writing '{file}': {error}.\n" msgstr "Fehler beim Schreiben der Datei „{file}“: {error}!\n" #: ../lib/Locale/XGettext.pm:583 #, perl-brace-format msgid "" "{program} ({package}) {version}\n" "Please see the source for copyright information!\n" msgstr "" "{program} ({package}) {version}\n" "Lesen Sie den Quelltext für Urherberrechts-Informationen!\n" #: ../lib/Locale/XGettext.pm:666 #, perl-brace-format msgid "" "error calling method '{method}' with value '{value}' on Locale::PO instance: " "{error}.\n" msgstr "" "Fehler beim Aufruf der Methode „{method}“ mit dem Wert „{value}“ für eine " "Instanz von Locale::PO: {error}.\n" #: ../lib/Locale/XGettext.pm:681 #, perl-brace-format msgid "{reference}: {conversion_error}\n" msgstr "{reference}: {conversion_error}\n" #: ../lib/Locale/XGettext.pm:819 #, perl-brace-format msgid "Error opening '{file}': {error}!\n" msgstr "Fehler beim Öffnen der Datei „{file}“: {error}!\n" #: ../lib/Locale/XGettext.pm:947 #, perl-brace-format msgid "" "A --flag argument doesn't have the ::[pass-] syntax: " "{flag}" msgstr "" "Ein --flag-Argument folgt nicht der ::[pass-]-Syntax: " "{flag}" #: ../lib/Locale/XGettext.pm:970 #, perl-brace-format msgid "Usage: {program} [OPTION] [INPUTFILE]...\n" msgstr "Aufruf: {program} [OPTION] [EINGABEDATEI]...\n" #: ../lib/Locale/XGettext.pm:975 msgid "Extract translatable strings from given input files.\n" msgstr "" "Aus den Eingabedateien die zu übersetzenden Meldungen herausschreiben.\n" #: ../lib/Locale/XGettext.pm:978 #, perl-brace-format msgid "Usage: {program} [OPTION]\n" msgstr "Aufruf: {program} [OPTION]\n" #: ../lib/Locale/XGettext.pm:982 msgid "Extract translatable strings.\n" msgstr "Zu übersetzenden Meldungen herausschreiben.\n" #: ../lib/Locale/XGettext.pm:996 msgid "" "Mandatory arguments to long options are mandatory for short options too.\n" "Similarly for optional arguments.\n" msgstr "" "Notwendige Argumente für Optionen in Langform sind auch für die Kurzform\n" "notwendig. Dies gilt in gleicher Weise für optionale Argumente.\n" #: ../lib/Locale/XGettext.pm:1003 msgid "Input file location:\n" msgstr "Angaben zu Eingabedateien:\n" #: ../lib/Locale/XGettext.pm:1007 msgid " INPUTFILE ... input files\n" msgstr " EINGABEDATEI... Eingabedateien\n" #: ../lib/Locale/XGettext.pm:1011 msgid " -f, --files-from=FILE get list of input files from FILE\n" msgstr "" " -f, --files-from=DATEI Namen der Eingabedateien aus DATEI holen\n" #: ../lib/Locale/XGettext.pm:1015 msgid "" " -D, --directory=DIRECTORY add DIRECTORY to list for input files search\n" msgstr "" " -D, --directory=VERZ VERZ der Liste der Eingabedateien hinzufügen\n" #: ../lib/Locale/XGettext.pm:1019 msgid "If input file is -, standard input is read.\n" msgstr "Wenn die Eingabedatei „-“ ist, wird die Standardeingabe gelesen.\n" #: ../lib/Locale/XGettext.pm:1025 msgid "Output file location:\n" msgstr "Angaben zu Ausgabedateien:\n" #: ../lib/Locale/XGettext.pm:1029 msgid "" " -d, --default-domain=NAME use NAME.po for output (instead of messages." "po)\n" msgstr "" " -d, --default-domain=NAME Ausgabe in NAME.po (anstatt in messages.po)\n" #: ../lib/Locale/XGettext.pm:1033 msgid " -o, --output=FILE write output to specified file\n" msgstr "" " -o, --output=DATEI Ausgabe in die angegebene DATEI schreiben\n" #: ../lib/Locale/XGettext.pm:1037 msgid "" " -p, --output-dir=DIR output files will be placed in directory DIR\n" msgstr "" " -p, --output-dir=VERZ Ausgabedateien in Verzeichnis VERZ ablegen\n" #: ../lib/Locale/XGettext.pm:1041 msgid "If output file is -, output is written to standard output.\n" msgstr "" "Ergebnisse werden nach der Standardausgabe geschrieben, wenn „-“ angegeben " "ist.\n" #: ../lib/Locale/XGettext.pm:1047 msgid "Input file interpretation:\n" msgstr "Überprüfung der Eingabedatei:\n" #: ../lib/Locale/XGettext.pm:1051 msgid " --from-code=NAME encoding of input files\n" msgstr " --from-code=NAME Kodierung für die Eingabe\n" #: ../lib/Locale/XGettext.pm:1054 msgid "By default the input files are assumed to be in ASCII.\n" msgstr "Die Vorgabe ist, dass für Eingabedateien ASCII angenommen wird.\n" #: ../lib/Locale/XGettext.pm:1060 msgid "Operation mode:\n" msgstr "Art der Verarbeitung:\n" #: ../lib/Locale/XGettext.pm:1064 msgid " -j, --join-existing join messages with existing file\n" msgstr "" " -j, --join-existing Meldungen an existierende Datei anhängen\n" #: ../lib/Locale/XGettext.pm:1068 msgid " -x, --exclude-file=FILE.po entries from FILE.po are not extracted\n" msgstr "" " -x, --exclude-file=DATEI.po Einträge aus DATEI.po nicht herausholen\n" #: ../lib/Locale/XGettext.pm:1072 msgid "" " -cTAG, --add-comments=TAG place comment blocks starting with TAG and\n" " preceding keyword lines in output file\n" " -c, --add-comments place all comment blocks preceding keyword " "lines\n" " in output file\n" msgstr "" " -cKENNUNG, --add-comments=KENNUNG\n" " Kommentare, die mit KENNUNG beginnen und " "welche\n" " einer Zeile mit Schlüsselworten vorausgehen " "in\n" " die Ausgabedatei schreiben.\n" " -c, --add-comments Alle Kommentarblöcke, die einer Zeile mit\n" " Schlüsselworten vorausgehen, in die\n" " Ausgabedatei schreiben.\n" #: ../lib/Locale/XGettext.pm:1081 msgid "Language specific options:\n" msgstr "Besondere Optionen bei „Language“:\n" #: ../lib/Locale/XGettext.pm:1086 msgid " -a, --extract-all extract all strings\n" msgstr " -a, --extract-all alle Zeichenketten extrahieren\n" #: ../lib/Locale/XGettext.pm:1092 msgid "" " -kWORD, --keyword=WORD look for WORD as an additional keyword\n" " -k, --keyword do not to use default keywords\"));\n" " --flag=WORD:ARG:FLAG additional flag for strings inside the " "argument\n" " number ARG of keyword WORD\n" msgstr "" " -kWORD, --keyword=WORD zusätzliches Schlüsselwort, nach dem gesucht\n" " wird.\n" " -k, --keyword \n" " --flag=WORT:ARG:FLAG zusätzliches Flag für Zeichenketten innerhalb " "der\n" " Argumentzahl ARG des Schlüsselworts WORT\n" #: ../lib/Locale/XGettext.pm:1104 msgid "Output details:\n" msgstr "Details zur Ausgabe:\n" #: ../lib/Locale/XGettext.pm:1108 msgid " --force-po write PO file even if empty\n" msgstr "" " --force-po PO-Datei erstellen, auch wenn sie leer ist\n" #: ../lib/Locale/XGettext.pm:1112 msgid " --no-location do not write '#: filename:line' lines\n" msgstr "" " --no-location Zeilen mit „#: Datei:Zeilennr.“ nicht " "schreiben\n" #: ../lib/Locale/XGettext.pm:1116 msgid "" " -n, --add-location generate '#: filename:line' lines (default)\n" msgstr "" " -n, --add-location Zeilen mit „#: Datei:Zeilennr.“ erhalten " "(Vorgabe)\n" #: ../lib/Locale/XGettext.pm:1120 msgid " -s, --sort-output generate sorted output\n" msgstr " -s, --sort-output sortierte Ausgabe erstellen\n" #: ../lib/Locale/XGettext.pm:1124 msgid " -F, --sort-by-file sort output by file location\n" msgstr "" " -F, --sort-by-file Ausgabe gemäß Vorkommen in Dateien erstellen\n" #: ../lib/Locale/XGettext.pm:1128 msgid "" " --omit-header don't write header with 'msgid \"\"' entry\n" msgstr "" " --omit-header „msgid \"\"“-Eintrag im Kopfteil nicht " "erstellen\n" #: ../lib/Locale/XGettext.pm:1132 msgid " --copyright-holder=STRING set copyright holder in output\n" msgstr "" " --copyright-holder=KETTE Uhrheberrechtsinhaber in Ausgabe setzen\n" #: ../lib/Locale/XGettext.pm:1136 msgid "" " --foreign-user omit FSF copyright in output for foreign user\n" msgstr "" " --foreign-user keine Zeile mit FSF-Copyright in Ausgabe\n" " einfügen\n" #: ../lib/Locale/XGettext.pm:1140 msgid " --package-name=PACKAGE set package name in output\n" msgstr " --package-name=PAKET Paketname für die Ausgabe setzen\n" #: ../lib/Locale/XGettext.pm:1144 msgid " --package-version=VERSION set package version in output\n" msgstr " --package-version=VERSION Paketversion in Ausgabe setzen\n" #: ../lib/Locale/XGettext.pm:1148 msgid "" " --msgid-bugs-address=EMAIL@ADDRESS set report address for msgid bugs\n" msgstr "" " --msgid-bugs-address=EMAIL@ADRESSE Adresse für msgid-Fehler angeben\n" #: ../lib/Locale/XGettext.pm:1152 msgid "" " -m[STRING], --msgstr-prefix[=STRING] use STRING or \"\" as prefix for " "msgstr\n" " values\n" msgstr "" " -m[ZEICHENKETTE], --msgstr-prefix[=ZEICHENKETTE]\n" " ZEICHENKETTE oder \"\" als Präfix für " "msgstr\n" " nehmen\n" #: ../lib/Locale/XGettext.pm:1157 msgid "" " -M[STRING], --msgstr-suffix[=STRING] use STRING or \"\" as suffix for " "msgstr\n" " values\n" msgstr "" " -M[ZEICHENKETTE], --msgstr-suffix[=ZEICHENKETTE]\n" " ZEICHENKETTE oder \"\" als Suffix für " "msgstr\n" " nehmen\n" #: ../lib/Locale/XGettext.pm:1164 msgid "Informative output:\n" msgstr "Informative Ausgabe:\n" #: ../lib/Locale/XGettext.pm:1168 msgid " -h, --help display this help and exit\n" msgstr " -h, --help diese Hilfe anzeigen und beenden\n" #: ../lib/Locale/XGettext.pm:1172 msgid " -V, --version output version information and exit\n" msgstr " -V, --version Versionsnummer anzeigen und beenden\n" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: ../lib/Locale/XGettext.pm:1184 #, perl-brace-format msgid "Report bugs at <{URL}>!\n" msgstr "Fehler bitte an <{URL}> melden!\n" #: ../lib/Locale/XGettext.pm:1195 #, perl-brace-format msgid "{program_name}: {error}\n" msgstr "{program_name}: {error}\n" #: ../lib/Locale/XGettext.pm:1201 #, perl-brace-format msgid "Try '{program_name} --help' for more information!\n" msgstr "„{program_name} --help“ gibt weitere Informationen.\n" #~ msgid "Invalid function name '{function}'!\n" #~ msgstr "Unzulässiger Funktionsname „{function}“!\n" #~ msgid "Invalid function name in keyword specification '{spec}'!\n" #~ msgstr "" #~ "Unzulässiger Funktionsname in Schlüsselwort-Spezifikation „{spec}“!\n" README.md100644000765000024 1207613367562357 15333 0ustar00guidostaff000000000000Locale-XGettext-0.7# Locale-XGettext Extract strings from arbitrary formats into PO files ## Description When using [GNU gettext](https://www.gnu.org/software/gettext/) you often find yourself extracting translatable strings from more or less exotic file formats that cannot be handled by xgettext from the [GNU gettext](https://www.gnu.org/software/gettext/) suite directly. This package simplifies the task of writing a string extractor in Perl, Python, Java, Ruby or other languages by providing a common base needed for such scripts. ## Usage Included is a sample string extractor [xgettext-txt](bin/xgettext-txt) for plain text files. It simply splits the input into paragraphs, and turns each paragraph into an entry of a PO file. ## Common Workflow The idea of the package is that you just a write a parser plug-in for `Locale::XGettext` and use all the boilerplate code for generating the PO file and for processing script options from this library. One such example is a parser plug-in for strings in templates for the Template Toolkit version 2 included in the package [Template-Plugin-Gettext](https://github.com/gflohr/Template-Plugin-Gettext). that contains a script `xgettext-tt2` which can only extract strings from that particular template language. If this is the only source of translatable strings you are mostly done. Often times you will, however, have to merge strings from all different input formats into one single PO file. Let's assume that your project is written in Perl and C and that it also contains Template Toolkit templates and plain text files that have to be translated. 1. Use `xgettext-txt` from this package to extract strings from all plain text files and write the output into `text.pot`. 2. Use `xgettext-tt2` from [Template-Plugin-Gettext](https://github.com/gflohr/Template-Plugin-Gettext) to extract all strings from your templates into another file `templates.pot`. 3. Finally use `xgettext` from [GNU gettext](https://www.gnu.org/software/gettext/) for extracting strings from all source files written in Perl and C, _and_ from the previously created pot files `text.pot` and `templates.pot`. This works because `xgettext` natively understands `.po` resp. `.pot` files. By the way, all xgettext flavors based on `Locale::XGettext` are also able to extract strings from `.po` or `.pot` files. So you can also make do completely without GNU gettext and use any `Locale::XGettext` extractor instead of GNU gettext for the last step. ## Writing Extractors Writing an extractor is as easy as implementing one single method that takes a filename argument and extract strings from that file. See the manual page [Locale::XGettext(3pm)](http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm) for more information. See [samples/README.md](samples/README.md) as a starting point for writing an extractor in Perl or many other languages. The distribution currently contains fully functional examples written in [C](samples/C/README.md), [Java](samples/Java/README.md), [Python](samples/Python/README.md), [Perl](samples/Perl/README.md), and [Ruby](samples/Ruby/README.md). ## Differences To `xgettext` From GNU Gettext There a couple of subtle differences in the handling of command-line arguments between extractors based on `Locale::XGettext` and the original `xgettext` program. Report a bug if you think that a particular difference is a bug and not an improvement. One thing that `Locale::XGettext` does not support is the prefix "pass-" for flag definitions. While it is possible for an extractor to implement the behavior of GNU gettext, this is not directly supported by `Locale::XGettext`. Instead, that prefix is simply ignored, when specified on the command-line for an option argument to "--flag" or as part of the set of default flags for a particular extractor. Additionally, while `xgettext` from GNU gettext has a hard-coded, fixed set of supported formats, you can specify arbitrary formats with "--flag" for extractors based on `Locale::XGettext`. ## Installation ### From CPAN You can install the latest version of `Locale::XGettext` from [CPAN](http://search.cpan.org/) with: ``` $ cpan Locale::XGettext ``` If the command `cpan` is not installed, try instead: ``` $ perl -MCPAN -e 'install Locale::XGettext' ``` ### From Sources Download the sources from [Locale-XGettext](https://github.com/gflohr/Locale-XGettext) and ``` $ tar cxf Locale-XGettext-VERSION.tar.gz $ cd Locale-XGettext-VERSION $ perl Makefile.PL $ make $ make test $ make install ``` ### From Git ``` $ git clone https://github.com/gflohr/Locale-XGettext.git $ cd Locale-XGettext $ dzil build $ cd Locale-XGettext-VERSION ``` From here, follow the instructions for installation from sources. The command `dzil` is part of [Dist::Zilla](http://search.cpan.org/~rjbs/Dist-Zilla/). ## TODO The module should ship with its own PO parser and writer. ## Bugs Please report bugs at [https://github.com/gflohr/Locale-XGettext/issues](https://github.com/gflohr/Locale-XGettext/issues) ## Copyright Copyright (C) 2016-2017, Guido Flohr, , all rights reserved. t000755000765000024 013367562357 14131 5ustar00guidostaff000000000000Locale-XGettext-0.7flags.t100644000765000024 307013367562357 15552 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 6; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my ($xgettext, @po); my $entry = { msgid => 'Hello, %s!', flags => 'perl-format' }; $xgettext = Locale::XGettext::Test->new; $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2; ok $po[1]->has_flag('perl-format'); ok !$po[1]->has_flag('c-format'); $entry->{flags} = 'perl-format, no-c-format'; $xgettext = Locale::XGettext::Test->new; $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2; ok $po[1]->has_flag('perl-format'); ok $po[1]->has_flag('no-c-format'); META.json100644000765000024 404613367562357 15453 0ustar00guidostaff000000000000Locale-XGettext-0.7{ "abstract" : "Extract Strings To PO Files", "author" : [ "Guido Flohr " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "license" : [ "lgpl_3_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Locale-XGettext", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.28" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Module::Build" : "0.28" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.19", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Carp" : "0", "Encode" : "0", "File::Spec" : "0", "Getopt::Long" : "2.36", "Locale::Messages" : "0", "Locale::PO" : "0.27", "Locale::Recode" : "0", "Locale::TextDomain" : "1.20", "Scalar::Util" : "0", "base" : "0", "perl" : "5.008", "strict" : "0", "utf8" : "0" } }, "test" : { "requires" : { "Test::More" : "0", "vars" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/gflohr/Locale-XGettext/issues" }, "homepage" : "http://www.guido-flohr.net/en/projects#locale-xgettext", "repository" : { "type" : "git", "url" : "git://github.com/gflohr/Locale-XGettext.git", "web" : "http://github.com/gflohr/Locale-XGettext.git" } }, "version" : "0.7", "x_generated_by_perl" : "v5.26.2", "x_serialization_backend" : "JSON::XS version 3.04" } PACKAGE100644000765000024 63213367562357 15403 0ustar00guidostaff000000000000Locale-XGettext-0.7/po# Makefile snippet that holds all package-dependent information. # Add more languages here! Beware that this is a makefile snippet and # you have to adhere to make syntax. LINGUAS = de # Textdomain for our package. TEXTDOMAIN = Locale-XGettext # Initial copyright holder added to pot and po files. COPYRIGHT_HOLDER = Guido Flohr # Where to send msgid bugs? MSGID_BUGS_ADDRESS = guido.flohr@cantanea.com README.pod100644000765000024 1164413367562357 15515 0ustar00guidostaff000000000000Locale-XGettext-0.7=head1 Locale-XGettext Extract strings from arbitrary formats into PO files =head2 Description When using LL you often find yourself extracting translatable strings from more or less exotic file formats that cannot be handled by xgettext from the LL suite directly. This package simplifies the task of writing a string extractor in Perl, Python, Java, Ruby or other languages by providing a common base needed for such scripts. =head2 Usage Included is a sample string extractor L for plain text files. It simply splits the input into paragraphs, and turns each paragraph into an entry of a PO file. =head2 Common Workflow The idea of the package is that you just a write a parser plug-in for C and use all the boilerplate code for generating the PO file and for processing script options from this library. One such example is a parser plug-in for strings in templates for the Template Toolkit version 2 included in the package LL. that contains a script C which can only extract strings from that particular template language. If this is the only source of translatable strings you are mostly done. Often times you will, however, have to merge strings from all different input formats into one single PO file. Let's assume that your project is written in Perl and C and that it also contains Template Toolkit templates and plain text files that have to be translated. =over =item 1. Use C from this package to extract strings from all plain text files and write the output into C. =item 2. Use C from LLL to extract all strings from your templates into another file C. =item 3. Finally use C from LLL for extracting strings from all source files written in Perl and C, I from the previously created pot files C and C. This works because C natively understands C<.po> resp. C<.pot> files. =back By the way, all xgettext flavors based on C are also able to extract strings from C<.po> or C<.pot> files. So you can also make do completely without GNU gettext and use any C extractor instead of GNU gettext for the last step. =head2 Writing Extractors Writing an extractor is as easy as implementing one single method that takes a filename argument and extract strings from that file. See the manual page LL for more information. See L as a starting point for writing an extractor in Perl or many other languages. The distribution currently contains fully functional examples written in L, L, L, L, and L. =head2 Differences To C From GNU Gettext There a couple of subtle differences in the handling of command-line arguments between extractors based on C and the original C program. Report a bug if you think that a particular difference is a bug and not an improvement. One thing that C does not support is the prefix "pass-" for flag definitions. While it is possible for an extractor to implement the behavior of GNU gettext, this is not directly supported by C. Instead, that prefix is simply ignored, when specified on the command-line for an option argument to "--flag" or as part of the set of default flags for a particular extractor. Additionally, while C from GNU gettext has a hard-coded, fixed set of supported formats, you can specify arbitrary formats with "--flag" for extractors based on C. =head2 Installation =head3 From CPAN You can install the latest version of C from LL with: C< $ cpan Locale::XGettext > If the command C is not installed, try instead: C< $ perl -MCPAN -e 'install Locale::XGettext' > =head3 From Sources Download the sources from LL and C< $ tar cxf Locale-XGettext-VERSION.tar.gz $ cd Locale-XGettext-VERSION $ perl Makefile.PL $ make $ make test $ make install > =head3 From Git C< $ git clone https://github.com/gflohr/Locale-XGettext.git $ cd Locale-XGettext $ dzil build $ cd Locale-XGettext-VERSION > From here, follow the instructions for installation from sources. The command C is part of LL. =head2 TODO The module should ship with its own PO parser and writer. =head2 Bugs Please report bugs at LL =head2 Copyright Copyright (C) 2016-2017, Guido Flohr, L, all rights reserved. Makefile.PL100644000765000024 331713367562357 16004 0ustar00guidostaff000000000000Locale-XGettext-0.7# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Extract Strings To PO Files", "AUTHOR" => "Guido Flohr ", "BUILD_REQUIRES" => { "Module::Build" => "0.28" }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "DISTNAME" => "Locale-XGettext", "EXE_FILES" => [ "bin/xgettext-txt" ], "LICENSE" => "lgpl", "MIN_PERL_VERSION" => "5.008", "NAME" => "Locale::XGettext", "PREREQ_PM" => { "Carp" => 0, "Encode" => 0, "File::Spec" => 0, "Getopt::Long" => "2.36", "Locale::Messages" => 0, "Locale::PO" => "0.27", "Locale::Recode" => 0, "Locale::TextDomain" => "1.20", "Scalar::Util" => 0, "base" => 0, "strict" => 0, "utf8" => 0 }, "TEST_REQUIRES" => { "Test::More" => 0, "vars" => 0 }, "VERSION" => "0.7", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Encode" => 0, "File::Spec" => 0, "Getopt::Long" => "2.36", "Locale::Messages" => 0, "Locale::PO" => "0.27", "Locale::Recode" => 0, "Locale::TextDomain" => "1.20", "Module::Build" => "0.28", "Scalar::Util" => 0, "Test::More" => 0, "base" => 0, "strict" => 0, "utf8" => 0, "vars" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Makefile100644000765000024 450113367562357 16104 0ustar00guidostaff000000000000Locale-XGettext-0.7/po# Makefile for various po files. srcdir = . libdir = ../lib CATALOGS = $(LINGUAS) MO_FILES = $(addsuffix .gmo, $(LINGUAS)) MSGMERGE = msgmerge MSGFMT = msgfmt XGETTEXT = xgettext CATOBJEXT = .po include PACKAGE TD = $(strip $(TEXTDOMAIN)) default: help all: $(TD).pot update-po update-mo install help: @echo "Available targets:" @echo " pot - remake master catalog" @echo " update-po - merge po files" @echo " update-mo - regenerate mo files" @echo " install - install mo files" @echo " all - all of the above" POTFILES = $(srcdir)/POTFILES \ $(shell cat $(srcdir)/POTFILES) pot: $(TD).pot clean: rm -f *~ *.bak *.gmo $(TD).pot: $(POTFILES) $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \ --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES \ --language=Perl \ --copyright-holder="$(COPYRIGHT_HOLDER)" \ --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \ --keyword --keyword='$$__' --keyword=__ --keyword=__x \ --keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \ --keyword=__p:1c,2 --keyword=__np:1c,2,3 \ --keyword=__npx:1c,2,3 --keyword=N__ --keyword=N__n:1,2 \ --keyword=N__p:1c,2 --keyword=N__np:1c,2,3 --keyword=%__ && \ rm -f $@ && mv $(TD).pox $@ install: $(MO_FILES) cd $(srcdir); \ targetdir='$(libdir)/LocaleData'; \ languages='$(LINGUAS)'; \ for lang in $$languages; do \ mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \ dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \ cat="$$lang.gmo"; \ echo "installing $$cat as $$dest"; \ cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \ done update-mo: $(MO_FILES) update-po: $(MAKE) $(TD).pot cd $(srcdir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ mv $$lang.po $$lang.old.po; \ echo "$$lang:"; \ if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \ rm -f $$lang.old.po; \ else \ echo "msgmerge for $$cat failed!"; \ rm -f $$lang.po; \ mv $$lang.old.po $$lang.po; \ fi; \ done .SUFFIXES: .SUFFIXES: .po .gmo .po.gmo: $(MSGFMT) --check --statistics --verbose -o $@ $< POTFILES100644000765000024 30113367562357 15566 0ustar00guidostaff000000000000Locale-XGettext-0.7/po../bin/xgettext-txt ../lib/Locale/XGettext/Text.pm ../lib/Locale/XGettext/Util/Flag.pm ../lib/Locale/XGettext/Util/Keyword.pm ../lib/Locale/XGettext/Util/POEntries.pm ../lib/Locale/XGettext.pm POTFILES1100644000765000024 4513367562357 15461 0ustar00guidostaff000000000000Locale-XGettext-0.7/tfiles/hello.txt files/additional.txt POTFILES2100644000765000024 4513367562357 15462 0ustar00guidostaff000000000000Locale-XGettext-0.7/tfiles/additional.txt files/extra.txt TestLib.pm100644000765000024 416213367562357 16200 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use vars qw(@ISA @EXPORT_OK); use Locale::XGettext::Text; use Locale::XGettext::Util::Keyword; @ISA = qw(Exporter); @EXPORT_OK = qw(find_entries use_keywords); sub find_entries { my ($po, %args) = @_; my @hits; foreach my $entry (@$po) { next if exists $args{msgid} && $entry->msgid ne $args{msgid}; next if exists $args{msgstr} && $entry->msgstr ne $args{msgstr}; next if exists $args{comment} && $entry->comment ne $args{comment}; push @hits, $entry; } return @hits; } sub use_keywords($) { my ($keywords) = @_; foreach my $function (keys %$keywords) { $keywords->{$function} = Locale::XGettext::Util::Keyword->new($function, @{$keywords->{$function}}); } Locale::XGettext::Text->new({keywords => $keywords}, 'dummy'); } package Locale::XGettext::Test; use strict; use base qw(Locale::XGettext); sub needInputFiles { return; } sub extractFromNonFiles { my ($self) = @_; my @added = @{$self->{__fed_entries} || []}; foreach my $entry (@added) { $self->addEntry($entry); } return $self; } sub _feedEntry { my ($self, $entry) = @_; $self->{__fed_entries} ||= []; push @{$self->{__fed_entries}}, $entry; return $self; } 1; comments.t100644000765000024 703113367562357 16304 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 13; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my ($xgettext, @po); my $entry = { msgid => 'Hello, world!'}; $xgettext = Locale::XGettext::Test->new; my $comment = "TRANSLATORS: There was no comment specified!\n"; $entry->{automatic} = $comment; $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2; ok !defined $po[1]->automatic, "no comment keyword specified"; my $comment1 = "TRANSLATORS: This comment should go into the PO file!\n"; $entry->{automatic} = $comment1; $xgettext = Locale::XGettext::Test->new({add_comments => ['TRANSLATORS:']}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2; is $po[1]->automatic, $comment1, "regular comment"; $xgettext = Locale::XGettext::Test->new({add_comments => ['TRANSLATORS:', 'CODERS:']}); my $multi_comment = <{automatic} = $multi_comment; $xgettext->_feedEntry($entry); my $comment2 = "CODERS: Think before you type!\n"; my $entry2 = { msgid => "Hello, underworld!", automatic => $comment2 }; $xgettext->_feedEntry($entry2); @po = $xgettext->run->po; is scalar @po, 3; is $po[1]->automatic, <automatic, <new({add_comments => ['TRANSLATORS:']}); my $multi_comment2 = <{automatic} = $multi_comment2; $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2; is $po[1]->automatic, $multi_comment2, '"xgettext:" without valid flags'; $xgettext = Locale::XGettext::Test->new({keyword => ['greet:1,"Hello!"']}); $xgettext->_feedEntry({msgid => 'world', keyword => 'greet'}); @po = $xgettext->run->po; is scalar @po, 2; is $po[1]->automatic, "Hello!", "automatic keyword comment not used"; $xgettext = Locale::XGettext::Test->new({keyword => ['greet:1,"world!"'], add_comments => ['TRANSLATORS:']}); my $comment3 = "TRANSLATORS: Hello,"; $xgettext->_feedEntry({msgid => 'world', keyword => 'greet', automatic => $comment3}); @po = $xgettext->run->po; is scalar @po, 2; is $po[1]->automatic, "TRANSLATORS: Hello,\nworld!", "automatic comments not joined"; keywords.t100644000765000024 733713367562357 16337 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 38; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(use_keywords); my (%keywords, $okay); %keywords = (foo => ['']); $okay = eval { use_keywords \%keywords }; ok $okay, $@; %keywords = (foo => [''], bar => ['1']); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # Too many elements. %keywords = (foo => ['1', '2', '3', '4', '5']); $okay = eval { use_keywords \%keywords }; ok !$okay, 'too many forms'; # Extract first argument. %keywords = (foo => []); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # The same. %keywords = (foo => [undef]); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # And again the same. %keywords = (foo => ['']); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # Scalar. %keywords = (foo => '1c,2,3'); $okay = eval { use_keywords \%keywords }; ok !$okay; # Hash reference. %keywords = (foo => {}); $okay = eval { use_keywords \%keywords }; ok !$okay; # Multiple specifications of position. %keywords = (foo => ['1c', 3, 1]); $okay = eval { use_keywords \%keywords }; ok !$okay; # Automatic comments. %keywords = (foo => ['1', '"a comment"']); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # No strict syntax for automatic comments. %keywords = (foo => ['1', '"a "comment""']); $okay = eval { use_keywords \%keywords }; ok $okay, $@; # Multiple comments. %keywords = (foo => ['1', '"a comment"', '"another comment"']); $okay = eval { use_keywords \%keywords }; ok !$okay, $@; # Multiple context specifications. %keywords = (foo => ['1c', 2, '3c']); $okay = eval { use_keywords \%keywords }; ok !$okay, $@; # Ambiguous %keywords = (foo => [1, '', 3]); $okay = eval { use_keywords \%keywords }; ok !$okay; # We now allow all keywords, even those with a colon or comma in the name. my $keyword; use Locale::XGettext::Util::Keyword; $keyword = Locale::XGettext::Util::Keyword->newFromString('npx:1c,2,3,"c"'); ok defined $keyword, "all keyword components"; is $keyword->function, 'npx'; is $keyword->context, '1'; is $keyword->singular, 2; is $keyword->plural, 3; is $keyword->comment, 'c'; $keyword = Locale::XGettext::Util::Keyword->newFromString('__'); ok defined $keyword, "keyword '__'"; is $keyword->function, '__'; is $keyword->context, 0; is $keyword->singular, 1; is $keyword->plural, 0; is $keyword->comment, undef; $keyword = Locale::XGettext::Util::Keyword->newFromString('L::G::_'); ok defined $keyword, "keyword 'L::G::_'"; is $keyword->function, 'L::G::_'; is $keyword->context, 0; is $keyword->singular, 1; is $keyword->plural, 0; is $keyword->comment, undef; $keyword = Locale::XGettext::Util::Keyword->newFromString('1c,1c:1c,2,3,"c"'); ok defined $keyword, '1c,1c:1c,2,3,"c"'; is $keyword->function, '1c,1c'; is $keyword->context, 1; is $keyword->singular, 2; is $keyword->plural, 3; is $keyword->comment, 'c'; perlcritic.rc100644000765000024 162213367562357 16515 0ustar00guidostaff000000000000Locale-XGettext-0.7; Copyright (C) 2016-2017 Guido Flohr , ; all rights reserved. ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 3 of the License, or ; (at your option) any later version. ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . ; Prototypes are good and important, contrary to what Conway thinks. [-Subroutines::ProhibitSubroutinePrototypes] ; Outsmarts automatic versioning. [-TestingAndDebugging::RequireUseStrict] directory.t100644000765000024 266313367562357 16471 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 3; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my @po = Locale::XGettext::Text->new({directory => ['files', 'files2']}, 'hello.txt', 'two.txt')->run->po; is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 1); is((scalar find_entries \@po, msgid => qq{"Do not extract!"}), 0); is((scalar find_entries \@po, msgid => qq{"Two, too!"}), 1); input-files.t100644000765000024 432313367562357 16717 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 9; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my @po = Locale::XGettext::Text->new({}, 'files/hello.txt', 'files/additional.txt') ->run->po; is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, Mars!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, extraterrestrials!"}), 0); @po = Locale::XGettext::Text->new({files_from => ['POTFILES1']}, 'files/extra.txt') ->run->po; is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, Mars!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, extraterrestrials!"}), 1); # Test that we can read from multiple files and that the entries are merged. @po = Locale::XGettext::Text->new({files_from => ['POTFILES1', 'POTFILES2']}) ->run->po; is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, Mars!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, extraterrestrials!"}), 1); omit-header.t100644000765000024 234013367562357 16653 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 2; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; is $po[0]->msgid, '""'; @po = Locale::XGettext::Text->new({omit_header => 1}, 'files/hello.txt')->run->po; isnt $po[0]->msgid, '""'; output-file.t100644000765000024 614113367562357 16735 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 26; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } $SIG{DIE} = sub { unlink 'messages.po'; unlink 'domain.po'; unlink 'output/messages.po'; unlink 'output/domain.po'; rmdir 'output'; }; $SIG{DIE}->(); die "could not unlink messages.po" if -e 'messages.po'; die "could not unlink domain.po" if -e 'domain.po'; die "could not unlink output/messages.po" if -e 'output/messages.po'; die "could not unlink output/domain.po" if -e 'output/domain.po'; die "could not rmdir output/" if -e 'output'; ok mkdir 'output'; ok(Locale::XGettext::Text->new({}, 'files/hello.txt')->run->output); ok -e 'messages.po'; ok unlink 'messages.po'; ok(Locale::XGettext::Text->new({output => 'domain.po'}, 'files/hello.txt') ->run->output); ok -e 'domain.po'; ok unlink 'domain.po'; ok(Locale::XGettext::Text->new({default_domain => 'domain'}, 'files/hello.txt') ->run->output); ok -e 'domain.po'; ok unlink 'domain.po'; ok(Locale::XGettext::Text->new({output_dir => 'output'}, 'files/hello.txt') ->run->output); ok -e 'output/messages.po'; ok unlink 'output/messages.po'; ok(Locale::XGettext::Text->new({output_dir => 'output', output => 'domain.po'}, 'files/hello.txt') ->run->output); ok -e 'output/domain.po'; ok unlink 'output/domain.po'; ok(Locale::XGettext::Text->new({output_dir => 'output', default_domain => 'domain'}, 'files/hello.txt') ->run->output); ok -e 'output/domain.po'; ok unlink 'output/domain.po'; open STDOUT, '>', 'domain.po'; ok(Locale::XGettext::Text->new({default_domain => '-'}, 'files/hello.txt') ->run->output); ok -e 'domain.po'; ok !-e '-.po'; unlink '-.po'; ok(Locale::XGettext::Text->new({output => '-'}, 'files/hello.txt') ->run->output); ok -e 'domain.po'; ok !-e '-.po'; unlink '-.po'; ok rmdir 'output'; $SIG{DIE}->(); bin000755000765000024 013367562357 14436 5ustar00guidostaff000000000000Locale-XGettext-0.7xgettext-txt100755000765000024 403513367562357 17217 0ustar00guidostaff000000000000Locale-XGettext-0.7/bin#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . use strict; use Getopt::Long; use Locale::Messages qw(setlocale LC_MESSAGES); use Locale::TextDomain qw('Locale-XGettext'); use Locale::XGettext::Text; Locale::Messages::setlocale(LC_MESSAGES, ""); Locale::XGettext::Text->newFromArgv(\@ARGV)->run->output; =head1 NAME xgettext-txt - Create PO files from text files =head1 USAGE xgettext-txt [OPTIONS] TEXTFILE[, TEXTFILE] xgettext-txt [OPTIONS] --files-from="filelist" xgettext-txt --help =head1 DESCRIPTION Reads one or more text files and turns every paragraph into a translatable string in a PO, resp. .pot file. See the L or the command output "perldoc Locale::XGettext" for a complete list of options. =head1 BUGS It should be possible to specify alternative delimiters and not just paragraphs. =head1 AUTHOR Written by Guido Flohr (http://www.guido-flohr.net/). =head1 COPYRIGHT Copyright (C) 2016-2017 Guido Flohr (http://www.guido-flohr.net/). License LGPLv1.1+: L This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. =head1 SEE ALSO L, L, L exclude-file.t100644000765000024 307413367562357 17030 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 4; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my @po = Locale::XGettext::Text->new({exclude_file => 'exclude-file.po'}, 'files/hello.txt', 'files/additional.txt', 'files/extra.txt') ->run->po; is((@po), 3); is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 0); is((scalar find_entries \@po, msgid => qq{"Hello, Mars!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, extraterrestrials!"}), 1); files2000755000765000024 013367562357 15315 5ustar00guidostaff000000000000Locale-XGettext-0.7/ttwo.txt100644000765000024 1213367562357 16760 0ustar00guidostaff000000000000Locale-XGettext-0.7/t/files2Two, too! foreign-user.t100644000765000024 403613367562357 17066 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 6; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->comment, qr/\nCopyright \(C\) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n/; @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->comment, qr/\nThis file is distributed under the same license as the PACKAGE package.\n/; @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; unlike $po[0]->comment, qr/\nThis file is put in the public domain\.\n/; @po = Locale::XGettext::Text->new({foreign_user => 1}, 'files/hello.txt') ->run->po; unlike $po[0]->comment, qr/\nCopyright \(C\) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n/; @po = Locale::XGettext::Text->new({foreign_user => 1}, 'files/hello.txt') ->run->po; unlike $po[0]->comment, qr/\nThis file is distributed under the same license as the PACKAGE package.\n/; @po = Locale::XGettext::Text->new({foreign_user => 1}, 'files/hello.txt') ->run->po; like $po[0]->comment, qr/\nThis file is put in the public domain\.\n/; package-name.t100644000765000024 253313367562357 16772 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 2; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my $sep = '(?:"|\\\\n)'; my @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sep}Project-Id-Version: PACKAGE VERSION${sep}/m; @po = Locale::XGettext::Text->new({package_name => 'qgoda'}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sep}Project-Id-Version: qgoda${sep}/m; samples000755000765000024 013367562357 15332 5ustar00guidostaff000000000000Locale-XGettext-0.7README.md100644000765000024 3527213367562357 17002 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples# Using Locale::XGettext From Various Programming Languages In this subdirectory you will find implementations of a very simple string extractor in a number of languages. The extractor will split its input into lines and make every non-empty line into a PO entry. All examples --- except for the [Perl example](perl/README.md) --- use the `Inline` Perl module that allows embedding code written in other languages directly into Perl code. In order to use the example scanners you usually have to do the following: sudo cpan install Inline::LANGUAGE perl -Ilib samples/LANGUAGE/xgettext-lines.pl --help perl -Ilib samples/LANGUAGE/xgettext-lines.pl README.md Replace LANGUAGE with the language you want to test. In the case of Java you may have to run the command "sudo cpan install Inline::Java::Class" (not just "Inline::Java"). If your package manager already has a prebuilt package for the `Inline` module of your choice you should give it a try. In general, installing `Inline` modules is quite challenging. Following is a list of possible candidate languages for that "Inline::*" bindings exists: * [C](C/README.md) * C++ * Guile * [Java](Java/README.md) * Lua * [Python](Python/README.md) * [Ruby](Ruby/README.md) * Tcl Some of the language names above link to a fully function example. The list is not complete, but the languages Go and JavaScript (via NodeJS) are still missing at the time of this writing. # Walk-through example for Python Let's look at a step-by-step instruction for writing an xgettext program in Python. The source code for the sample implementations for other languages will give you enough information to modify the example for your own needs. ## Installation of Inline::Python We need the module that allows calling Python from Perl (and vice versa): $ sudo cpan install Inline::Python This will install "Inline::Python". ## Implementation with a separate module The `Python` subdirectory contains a script `xgettext-lines.pl` and a Python module `PythonGettext.py`. The Perl script can be used without modification for any extractor that you want to write in Python. It will turn every method it finds in `PythonGettext.py` into a Perl method. See [Locale::XGettext(3pm)](http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm) for details about the methods you can implement. ## Minimal Implementation The minimal implementation in `PythonGettext.py` will look like this: class PythonXGettext: def __init__(self, xgettext): self.xgettext = xgettext The constructor is called with the instance of the Perl in the variable `xgettext`. Note that the Perl object is not initialzed at this point and you should not call any methods of it. Your extractor is already almost functional: $ ./xgettext-lines.pl --help Usage: xgettext-lines.pl [OPTION] [INPUTFILE]... ... It already prints out usage information. If you see an error message "Can't locate Locale/XGettext.pm in @INC ..." instead, you haven't installed the Perl module. Either install it or tell the sample script to use the source instead: $ perl -I../../lib xgettext-lines.pl --help Usage: xgettext-lines.pl [OPTION] [INPUTFILE]... Not much happens but a directory `_Inline` that contains cached information from `Inline::Python` was executed. You can safely delete this directory at any point in time. Now let's try our extractor with a real input file, for example the one that you are currently reading: $ ./xgettext-lines.pl ../README.md Can't locate object method "readFile" via package "Locale::XGettext::Python" at ../../lib/Locale/XGettext.pm line 184. The method `readFile` gets called for every input file and has to be implemented. Let's add it to `PythonGettext.py`: def readFile(self, filename): with open(filename) as f: lineno = 0 for line in f: lineno = lineno + 1 reference = "%s:%u" % (str(filename)[2:-1], ++lineno) self.xgettext.addEntry({'msgid': line, 'reference': reference}) Now try it again: $ ./xgettext-lines.pl ../README.md This time nothing should happen. Don't worry, no news is good news. A file `messages.po` was created with one PO entry per line. The other good news is: You're done! At least in many cases, this is already sufficient and you can now focus on writing a real parser for your source files. ## Implementation in one single file Note that this is only implemented in the Python example. if you want to do the same for another language, please refer to the Python source code! The Perl wrapper script `xgettext-lines.pl` reads the python code from a separate file, the Python module `PythonXGettext.py`, so that the two languages are separated cleanly. The script `xgettext-lines.py` shows another approach. It still contains Perl code at the top but the Python code is added to the bottom. The overall layout of the script looks like this: #! /usr/bin/env perl # Boilerplate Perl code. # ... use Inline Python => 'DATA' # More boilerplate Perl code. # ... __DATA__ __Python__ class PythonXGettext: def __init__(self, xgettext): self.xgettext = xgettext def readFile(self, filename): with open(filename) as f: for line in f: self.xgettext.addEntry({'msgid': line}); The line `use Inline Python => 'DATA'` has the effect that Perl, resp. the Inline module will look for the Python code to compile at the end of the file, after two lines containing the special markers `__DATA__` and `__Python__` (or `__Ruby__`, or `__Java__` for other programming languages). Instead of `__DATA__` you can also use `__END__`. It has the same effect in this particular case. The script works standalone, without a separate Python module: $ ./xgettext-lines.py ./xgettext-lines.py: no input file given Try './xgettext-lines.py --help' for more information! If `Locale::XGettext` is not yet installed, you have to specify the path to the Perl library: $ perl -I../../lib xgettext-lines.py ./xgettext-lines.py: no input file given Try './xgettext-lines.py --help' for more information! Whether you want to mix Perl and Python in one file, or keep them separate - as described above - is a matter of taste and your individual requirements. ## `addEntry()` Revisited In the example, the PO entries only contain the message id and the source reference. You can set a lot more properties though, in particular the following:
msgid_plural
A possible plural form for the entry.
keyword
The name of the keyword used, such as "gettext" or "ngettext". Users can specify automatic comments for certain keywords with the option "--keyword". You have to tell B which keyword triggered the entry.
flags
A comma-separated list of flags to add to the entry, for example "perl-brace-format, no-wrap".
See [http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm#METHODS](http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm#METHODS) or try the command `perldoc Locale::XGettext` for more information. ## Reading Strings From Other Data Sources Sometimes you want to read strings from another data source that is not a file. One option is to simply interpret the command-line arguments not as filenames but as identifiers for your data sources, for example URLs, and then change the method `readFile()` to read from that data source. Another option is to override the method `extractFromNonFiles`. This method is invoked after all input files have been read but before the output is created: def extractFromNonFiles(self): # Read, for example from a database. for string in database_records: self.xgettext.addEntry({'msgid': line}) ## Calling Perl Methods Your Python code can invoke all methods of the Perl object (that is the property `xgettext` of the Python object): self.xgettext.addEntry({'msgid': line}) Adding a new message ID is just one example. See the documentation in [http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm](http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm). for the complete interface. ## Extending the CLI When you run your extractor script with the option `--help` you see a lot of usage information from `Locale::XGettext`. The API allows you to modify the command line interface of your extractor to a certain degree. ### Describing the Expected Input If you implement the method `fileInformation()` you can describe the type of input files you expect. def fileInformation(self): return "Input files are plain text files and are converted into one PO entry\nfor every non-empty line." Look at the usage information: $ ./xgettext-lines.pl --help Usage: ./xgettext-lines.pl [OPTION] [INPUTFILE]... Extract translatable strings from given input files. Input files are plain text files and are converted into one PO entry for every non-empty line. ... Your description is now printed after the generic usage information. ### Language-specific Options In order to add your own command-line options you have to override the method `languageSpecificOptions`. See this example: def languageSpecificOptions(self): return [ [ 'test-binding', 'test_binding', ' --test-binding', 'print additional information for testing the language binding' ] ]; Print the usage description to see the effect: $ ./xgettext-lines.pl --help ... Language specific options: -a, --extract-all extract all strings -kWORD, --keyword=WORD look for WORD as an additional keyword -k, --keyword do not to use default keywords")); --flag=WORD:ARG:FLAG additional flag for strings inside the argument number ARG of keyword WORD --test-binding print additional information for testing the language binding ... Your new option `--test-binding` is printed after generic options. Custom ptions are defined as an array of arrays. Each definition has four elements: The first element (`'test-binding'`) contains the option specification. The default are binary options that do not take arguments. For a string argument you would use `'test-binding=s'`, for an integer argument `'test-binding=i'`. For a complete description please see [http://search.cpan.org/~jv/Getopt-Long/lib/Getopt/Long.pm](http://search.cpan.org/~jv/Getopt-Long/lib/Getopt/Long.pm). The next element (`'test_binding'`) is the name of the option. It is the identifier that you have to use in order to access the value of the option. See below for details. The third element (`' --test-binding'`) contains the left part of the usage description. You can use leading spaces for aligning the string with the rest of the usage description. The last element contains the description of the option in the usage description. ### Accessing Command-Line Options You access command line options with the method `option()`: self.xgettext.option('test_binding') The argument to the method is the name (the second element) from the option definition. You can access the values of all other options as well. The option name is always the bare option description with hyphens converted to underscores: self.xgettext.option('extract_all') The above would extract the value of the option `'--extract-all'`. ### Accessing Keywords And Flags Keywords and Flags are always a mixture between default settings and those specified on the command-line with `--keyword` or `--flag`. There are two flavors of retrieving the merged definitions: keywords = self.xgettext.keywords() This will a list of objects resp. hashes/associative arrays, each one having the following keys: * function: the function name (the keyword) * singular: the argument number of the singular form * plural: the argument number of the plural form or 0 * context: the argument number of the message context or 0 * comment: an automatic comment or None, undefined, nil, NULL, ... See the example source code for details how to retrieve that. Alternatively, you can also just get an array of corresponding object strings and parse them yourself: keywords = self.xgettext.keywordOptionStrings() This would produce something like: [ "gettext:1", "ngettext:1,2", "ncgettext:1c,2,3", "greet:1,\"Hello, world!\"" ] Accessing flags is almost the same. The objects returned by the method "flags()" have the properties "function", "arg" (for the argument number), "flag" for the flag ("c-format", "perl-format", ...), "no" (true for "no-c-format", "no-perl-format"), and "pass" (for "pass-c-format", "pass-perl-format"). Alternatively, you have the method "flagOptionStrings()" if you want to parse the values yourself. Under normal circumstances, you don't have to access flags. Just pass the "keyword" property with "addEntry()" and `Locale::XGettext` will process the flags automatically. ### More Modifications To the CLI By overriding certain methods you can enable or disable more options in your extractor: def canExtractAll(self): return 1 If `canExtractAll()` returns a truthy value, the option `--extract-all` is offered to the user. The default is `false`. def canKeywords(self): return 1 If `canKeywords` returns a truthy value, options for keyword specification (see below) are added to the interface. The default is `true`. def canFlags(self): return 1 If `canFlags` returns a truthy value, options for flag specification are added to the interface. The default is `true`. Note: `Locale::XGettext` does not yet support flags. ## Keyword Specification If your extractor does not honor keyword specifications, you should override the method `canKeywords()` and return `false`. If it does, you can define the default keywords for your language like this: def defaultKeywords(self): return [ 'gettext:1', 'ngettext:1,2', 'pgettext:1c,2', 'npgettext:1c,2,3' ] The return value of `defaultKeywords()` should be an array of strings suitable as arguments for the command-line option "--keyword". In the above example, the extractor should extract the first argument to the function `npgettext()` and interpret it as the message context (hence the `c` after the position), arguments 2 and 3 should be interpreted as the singular and plural form of the message. exclude-file.po100644000765000024 12313367562357 17153 0ustar00guidostaff000000000000Locale-XGettext-0.7/tmsgid "Hello, world!" msgstr "" msgctxt "override" msgid "Hello, Mars!" msgstr "" files000755000765000024 013367562357 15233 5ustar00guidostaff000000000000Locale-XGettext-0.7/textra.txt100644000765000024 3213367562357 17212 0ustar00guidostaff000000000000Locale-XGettext-0.7/t/filesHello, extraterrestrials! hello.txt100644000765000024 1613367562357 17174 0ustar00guidostaff000000000000Locale-XGettext-0.7/t/filesHello, world! join-existing.t100644000765000024 306013367562357 17244 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 5; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); $SIG{DIE} = sub { unlink 'messages.po'; }; $SIG{DIE}->(); die "could not unlink messages.po" if -e 'messages.po'; ok(Locale::XGettext::Text->new({}, 'files/hello.txt')->run->output); ok -e 'messages.po'; my @po = Locale::XGettext::Text->new({join_existing => 1}, 'files/extra.txt') ->run->po; is((@po), 3); is((scalar find_entries \@po, msgid => qq{"Hello, world!"}), 1); is((scalar find_entries \@po, msgid => qq{"Hello, extraterrestrials!"}), 1); $SIG{DIE}->(); author-critic.t100644000765000024 40313367562357 17210 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; use Test::Perl::Critic (-profile => "perlcritic.rc") x!! -e "perlcritic.rc"; all_critic_ok(); hello.txt100644000765000024 2013367562357 17251 0ustar00guidostaff000000000000Locale-XGettext-0.7/t/files2Do not extract! C000755000765000024 013367562357 15514 5ustar00guidostaff000000000000Locale-XGettext-0.7/samplesREADME.md100644000765000024 263513367562357 17141 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples/C# Message Extractor Example in C ## Installation You have to install the Perl mdoule `Inline::C`. If your package manager does not have a package for `Inline::C` you have the following options: ### CPAN Module Try first: ``` sudo cpan install Inline::C ``` If the command `cpan` cannot be found, try instead: ``` perl -MCPAN -e 'install Inline::C' ``` ### From Sources When you build the module, you should try to use the same C compiler that was used for compiling the Perl interpreter. You can use the command ```perl -V``` in order to find out how the Perl interpreter was built. #### From CPAN Go to [http://search.cpan.org/~tinita/Inline-C/](http://search.cpan.org/~tinita/Inline-C/) and click the link "Download". Then follow the usual Perl installation plethora: ``` tar xzf Inline-C-VERSION.tar.gz cd Inline-Python perl Makefile.PL make make test sudo make install ``` Note that dependencies are not automatically installed! Please read the output of ```perl Makefile.PL``` carefully! #### From Git Alternatively, you can use the latest sources from Git: ``` git clone https://github.com/ingydotnet/inline-c-pm cd Inline-C perl Makefile.PL make make test sudo make install ``` Note that dependencies are not automatically installed! Please read the output of ```perl Makefile.PL``` carefully! ## Usage The [README.md for all samples](../README.md) contains exhaustive documentation for the Python example. automatic-flags.t100644000765000024 756413367562357 17552 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 15; use Locale::XGettext::Text; BEGIN { my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; unshift @INC, '.'; } use TestLib qw(find_entries); my ($xgettext, @po, $entry); $entry = { msgid => 'Hello, %s!', msgid_plural => 'Hello, %s and %s', keyword => 'nxgettext', }; $xgettext = Locale::XGettext::Test->new({keyword => ['nxgettext:1,2'], flag => [ 'nxgettext:1:c-format', 'nxgettext:2:perl-format' ]}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2, 'expected two entries';; ok $po[1]->has_flag('c-format'), 'accumulate flags, singular'; ok $po[1]->has_flag('perl-format'), 'accumulate flags, plural'; $xgettext = Locale::XGettext::Test->new({keyword => ['nxgettext:1,2'], flag => [ 'nonxgettext:1:c-format', 'nonxgettext:2:perl-format' ]}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2, 'expected two entries'; ok !$po[1]->has_flag('c-format'), 'wrong flag keyword, singular'; ok !$po[1]->has_flag('perl-format'), 'wrong flag keyword, plural'; $xgettext = Locale::XGettext::Test->new({keyword => ['nxgettext:1,2'], flag => [ 'nxgettext:1:c-format', 'nxgettext:3:perl-format' ]}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2, 'expected two entries'; ok $po[1]->has_flag('c-format'), 'singular flag not taken'; ok !$po[1]->has_flag('perl-format'), 'wrong argument number'; $xgettext = Locale::XGettext::Test->new({keyword => ['nxgettext:1,2'], flag => [ 'nxgettext:1:pass-c-format', 'nxgettext:2:pass-perl-format' ]}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2, 'expected two entries'; ok $po[1]->has_flag('c-format'), 'pass- not ignored, singular'; ok $po[1]->has_flag('perl-format'), 'pass- not ignored, plural'; $xgettext = Locale::XGettext::Test->new({keyword => ['nxgettext:1,2'], flag => [ 'nxgettext:1:c-format', 'nxgettext:1:no-c-format' ]}); $xgettext->_feedEntry($entry); @po = $xgettext->run->po; is scalar @po, 2, 'expected two entries'; ok !$po[1]->has_flag('no-c-format'), 'conflicting arg, second one did win'; ok $po[1]->has_flag('c-format'), 'conflicting arg, first one did not win'; package-version.t100644000765000024 331313367562357 17534 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 3; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my $sep = '(?:"|\\\\n)'; my @po; @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sep}Project-Id-Version: PACKAGE VERSION${sep}/m; # --package-version is ignored if --package-name is not set. @po = Locale::XGettext::Text->new({package_version => '1.2.3'}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sep}Project-Id-Version: PACKAGE VERSION${sep}/m; @po = Locale::XGettext::Text->new({package_name => 'qgoda', package_version => '1.2.3'}, 'files/hello.txt') ->run->po; like $po[0]->msgstr, qr/${sep}Project-Id-Version: qgoda 1.2.3${sep}/m; copyright-holder.t100644000765000024 250713367562357 17745 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 2; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->comment, qr/\nCopyright \(C\) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n/; @po = Locale::XGettext::Text->new({copyright_holder => 'Copy Left'}, 'files/hello.txt')->run->po; like $po[0]->comment, qr/Copyright \(C\) YEAR Copy Left\n/m; CXGettext.c100644000765000024 4257313367562357 17732 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples/C/* * This file is in the public domain. * * Extractor example in C. * * It should show you all you need to write a typical string extractor in C. * * It is not a tutorial for writing portable C code. It may not even * compile on your platform but then you will know how to fix it. * * It is also not a tutorial for accessing the Perl API. I know * way to little about the Perl API for writing such a tutorial. In * particular, the code could leak memory. * * Last but not least, this is not a good example for writing C * code at all. */ /* "perl.h" was automatically included by Inline::C. */ #include #include #include #include /* * We inevitably have to use glue code between Perl and C here, even * if we are using Inline::C. If you are really interested, read * "perldoc perlapi" and "perldoc perlcall" for FMTYEWTK. But the * sample code should contain Cut & Paste templates for everything * that you need. Note that we use stack macros from "INLINE.h" * here that are a little bit more readable. see * http://search.cpan.org/~tinita/Inline-C/lib/Inline/C.pod#THE_INLINE_STACK_MACROS * for more details! * * All non-static C functions are in the namespace of the extractor class * and are therefore automatically methods. */ /* * Some helper functions and definitions. Note that static functions are * not visible to Perl. */ /* One entry for a PO file. */ struct po_entry { const char *msgid; const char *msgid_plural; /* These two items will be merged into a reference of the * form "FILENAME:LINENO" */ const char *filename; size_t lineno; /* If you set this to non-NULL, Locale::XGettext will add * automatic comments for you, if they had been specified * on the command-line for that particular keyword. */ const char *keyword; /* Set this to something like "c-format" or "no-c-format" * as appropriate. You can comma-separate multiple flags. */ const char *flags; /* This is a so-called automatic comment. Automatic * commands are prefixed with "#." in the PO files. * The only reason why you want to add them is actually * that it had been specified on the command-line with * "--add-comment." But in that case it is actually * easier to just specify the keyword and then Locale::XGettext * will do that automaticaslly for you, when it is * needed. */ const char *comment; /* Add more members here, when you need them. But in that case * you have to add the required code to addEntry() as well! */ }; /* The equivalent of Locale::XGettext::Util::Keyword in C. */ struct keyword { /* The name of the function. */ const char *function; /* Position of singular form. */ unsigned int singular; /* Position of plural form or 0. */ unsigned int plural; /* Position of message context argument or 0. */ unsigned int context; /* Automatic comment for that keyword or NULL. */ const char *comment; }; /* Add ENTRY to the extractor SELF. COMMENT should point to any * source code comment preceding the message but without the * comment delimiter of your language. The string is then parsed * by Locale::XGettext, especially for translator comments specified * on the command-line with "--add-comment". * * The method is just a thin wrapper against addEntry() of the * underlying Perl object. */ static void addEntry(SV *self, struct po_entry *entry, const char *comment); /* Initialize a "struct entry". The argument is not(!) the pointer * but the structure. Why would you need a pointer in the first * place? */ #define init_po_entry(entry) memset(&entry, 0, sizeof(struct po_entry)) /* Get all valid keyword definitions. That is the merge of * default keywords and those specified on the command-line. * Pass the return value to free_keywords() in order to free * all resources again. */ static struct keyword **keywords(SV *self); /* Get the value of a certain option. */ static SV *option(SV *self, const char *option); /* Free all resources associated with the set of keywords. */ static void free_keywords(struct keyword **keywords); /* Free all resources associated with one keyword. */ static void free_keyword(struct keyword *keyword); /* Retreive an unsigned integer from a hash (reference) or 0. */ static unsigned int fetch_hash_uvalue(HV *hash, const char *key); /* Retreive a string from a hash (reference). The return value * is either NULL or the string that should be free()d, when * no longer used. */ static char *fetch_hash_svalue(HV *hash, const char *key); /* * The most important method. */ void readFile(SV *self, const char *filename) { FILE *fp = fopen(filename, "r"); char *line = NULL; size_t lineno = 0; size_t linecap = 0; ssize_t linelen; struct po_entry entry; if (!fp) { croak("Unable to open open '%s': %s", filename, strerror(errno)); } while ((linelen = getline(&line, &linecap, fp)) > 0) { /* Clear the PO entry. */ init_po_entry(entry); entry.msgid = line; entry.filename = filename; entry.lineno = ++lineno; /* For a real language you should also set the keyword * for this entry. */ entry.keyword = "greet"; entry.flags = "no-perl-format, c-format"; /* In our case we don't have a comment and pass NULL * as the third argument. */ addEntry(self, &entry, NULL); } } /* All of the following methods are optional. You do not have to * implement them. */ /* This method gets called right after all input files have been * processed and before the PO entries are sorted. That means that you * can add more entries here. * * In this example we don't add any strings here but rather abuse the * method for showing advanced stuff like getting option values or * interpreting keywords. Invoke the extractor with the option * "--test-binding" in order to see this in action. */ void extractFromNonFiles(SV *self) { struct keyword **records; struct keyword **crs; struct keyword *keyword; if (!SvTRUE(option(self, "test_binding"))) return; puts("Keyword as command-line-options:"); records = crs = keywords(self); while (*crs) { keyword = *crs; printf("function: %s\n", keyword->function); if (keyword->context) printf(" context: argument #%u\n", keyword->context); else puts(" context: [none]"); if (keyword->singular) printf(" singular: argument #%u\n", keyword->singular); else puts(" singular: [none]"); if (keyword->plural) printf(" plural: argument #%u\n", keyword->plural); else puts(" plural: [none]"); if (keyword->comment) printf(" automatic comment %s\n", keyword->comment); else puts(" automatic comment: [none]"); ++crs; } free_keywords(records); /* Extracting the valid flags is left as an exercise to * the reader. File a bug report if you cannot find yourself * how to do it. */ } /* Describe the type of input files. */ char * fileInformation(SV *self) { /* For simple types like this, the return value is automatically * converted. No need to use the Perl API. */ return "\ Input files are plain text files and are converted into one PO entry\n\ for every non-empty line."; } /* Return an array with the default keywords. This is only used if the * method canKeywords() (see below) returns a truth value. For the lines * extractor you would rather NULL or an empty array. */ SV * defaultKeywords(SV *self) { AV *keywords = newAV(); av_push(keywords, newSVpv("gettext:1", 9)); av_push(keywords, newSVpv("ngettext:1,2", 12)); av_push(keywords, newSVpv("pgettext:1c,2", 13)); av_push(keywords, newSVpv("npgettext:1c,2,3", 16)); return newRV_noinc((SV *) keywords); } /* * You can add more language specific options here. It is your * responsibility that the option names do not conflict with those of the * wrapper. * * This method should actually return an array of arrays. But we * can also just return a flat list, that gets then promoted by the * Perl code. When returning multiple or complex values it is best * to return them on the Perl stack. */ void languageSpecificOptions(SV *self) { Inline_Stack_Vars; Inline_Stack_Reset; Inline_Stack_Push(sv_2mortal(newSVpv("test-binding", 0))); Inline_Stack_Push(sv_2mortal(newSVpv("test_binding", 0))); Inline_Stack_Push(sv_2mortal(newSVpv(" --test-binding", 0))); Inline_Stack_Push(sv_2mortal(newSVpv("print additional information for testing the language binding", 0))); /* Add more groups of 4 items for more options. */ Inline_Stack_Done; } /* Does the program honor the option -a, --extract-all? The default * implementation returns false. */ int canExtractAll(SV *self) { return 0; } /* Does the program honor the option -k, --keyword? The default * implementation returns true. */ int canKeywords(SV *self) { return 1; } /* Does the program honor the option --flag? The default * implementation returns true. */ int canFlags(SV *self) { return 1; } static void addEntry(SV *self, struct po_entry *entry, const char *comment) { /* When calling a Perl method we have to use the regular * macros from the Perl API, not the Inline stack * macros. */ dSP; /* Declares a local copy of the Perl stack. */ size_t reflen; char *reference = NULL; size_t num_items; /* We have to call the method "addEntry(). For that we * have to push the instance (variable "self") on the * Perl stack followed by all the arguments. * * The method has to alternative calling conventions. * We pick the simpler one, where we pass key-value * pairs, followed by one optional comment. */ /* Boilerplate Perl API code. */ ENTER; SAVETMPS; PUSHMARK(SP); /* Make space for all items on the stack. */ num_items = 3; /* The instance plus 2 for the msgid. */ if (entry->msgid_plural) num_items += 2; if (entry->filename) num_items += 2; if (entry->keyword) num_items += 2; if (entry->flags) num_items += 2; if (entry->comment) num_items += 2; if (comment) num_items += 1; EXTEND(SP, num_items); /* The first item on the stack must be the instance * that the method is called upon. */ PUSHs(self); /* The second argument to newSVpv is the length of the * string. If you pass 0 then the length is calculated * using strlen(). */ PUSHs(sv_2mortal(newSVpv("msgid", 5))); PUSHs(sv_2mortal(newSVpv(entry->msgid, 0))); if (entry->msgid_plural) { PUSHs(sv_2mortal(newSVpv("msgid_plural", 5))); PUSHs(sv_2mortal(newSVpv(entry->msgid_plural, 0))); } if (entry->filename) { reflen = strlen(entry->filename) + 3 + (size_t) floor(log10(UINT_MAX)); reference = malloc(reflen); if (!reference) croak("virtual memory exhausted"); snprintf(reference, reflen, "%s:%lu", entry->filename, (unsigned long) entry->lineno); PUSHs(sv_2mortal(newSVpv("reference", 9))); PUSHs(sv_2mortal(newSVpv(reference, 0))); } if (entry->keyword) { PUSHs(sv_2mortal(newSVpv("keyword", 7))); PUSHs(sv_2mortal(newSVpv(entry->keyword, 0))); } if (entry->flags) { PUSHs(sv_2mortal(newSVpv("flags", 5))); PUSHs(sv_2mortal(newSVpv(entry->flags, 0))); } if (entry->comment) { PUSHs(sv_2mortal(newSVpv("comment", 7))); PUSHs(sv_2mortal(newSVpv(entry->comment, 0))); } if (comment) { PUSHs(sv_2mortal(newSVpv(comment, 0))); } /* More Perl stuff. */ PUTBACK; call_method("addEntry", G_DISCARD); /* Closing bracket for Perl calling. */ FREETMPS; LEAVE; /* Done calling the Perl method. */ if (reference) free(reference); } static struct keyword ** keywords(SV *self) { SV *records; HV *keyword_hash; HE *entry; int num_keywords, i; SV *sv_key; SV *sv_val; struct keyword **retval; struct keyword *keyword; SV **keyword_entry; HV *hv; dSP; int count; /* First call the method keywords() to get a hash * with all valid keyword definitions. */ ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP, 1); PUSHs(self); PUTBACK; count = call_method("keywords", G_SCALAR); SPAGAIN; if (count != 1) croak("option() returned %d values.\n", count); records = newSVsv(POPs); PUTBACK; FREETMPS; LEAVE; if (!SvROK(records)) croak("keywords is not a reference"); keyword_hash = (HV*)SvRV(records); num_keywords = hv_iterinit(keyword_hash); size_t size = sizeof(struct keyword *); retval = calloc(sizeof(struct keyword *), 1 + num_keywords); if (!retval) croak("virtual memory exhausted"); for (i = 0; i < num_keywords; ++i) { keyword = retval[i] = malloc(sizeof *keyword); if (!keyword) croak("virtual memory exhausted"); entry = hv_iternext(keyword_hash); sv_key = hv_iterkeysv(entry); keyword->function = strdup(SvPV(sv_key, PL_na)); if (!keyword->function) croak("virtual memory exhausted"); /* The values are objects of type Locale::XGettext::Util::Keyword. * These objects have getter methods but for simplicity we * access the members directly. First we retrieve the value and * convert it into a new hash. */ sv_val = hv_iterval(keyword_hash, entry); if (!SvROK(sv_val) || SvTYPE(SvRV(sv_val)) != SVt_PVHV) croak("entry for keyword is not a hash reference"); hv = (HV*) SvRV(sv_val); keyword->singular = fetch_hash_uvalue(hv, "singular"); keyword->plural = fetch_hash_uvalue(hv, "plural"); keyword->context = fetch_hash_uvalue(hv, "context"); keyword->comment = fetch_hash_svalue(hv, "comment"); } retval[num_keywords] = (struct keyword *) NULL; return retval; } /* Get the value of a certain option. Note that the return value can be * just about anything! */ static SV * option(SV *self, const char *option) { dSP; int count; SV *retval; ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP, 2); PUSHs(self); PUSHs(sv_2mortal(newSVpv(option, 0))); PUTBACK; count = call_method("option", G_SCALAR); SPAGAIN; if (count != 1) croak("option() returned %d values.\n", count); retval = newSVsv(POPs); PUTBACK; FREETMPS; LEAVE; return retval; } static void free_keywords(struct keyword **keywords) { struct keyword **current = keywords; while (*current) { free_keyword(*current); ++current; } if (keywords) free((void *) keywords); } static void free_keyword(struct keyword *self) { if (!self) return; if (self->function) free((void *) self->function); if (self->comment) free((void *) self->comment); free((void *) self); } static unsigned int fetch_hash_uvalue(HV *hv, const char *key) { SV **value = hv_fetch(hv, key, strlen(key), 0); if (!value) return 0; return SvUV(*value); } static char * fetch_hash_svalue(HV *hv, const char *key) { SV **value = hv_fetch(hv, key, strlen(key), 0); char *retval; if (!value) return 0; retval = strdup(SvPV_nolen(*value)); if (!retval) croak("virtual memory exhausted"); return retval; } author-pod-syntax.t100644000765000024 45413367562357 20047 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Locale000755000765000024 013367562357 15633 5ustar00guidostaff000000000000Locale-XGettext-0.7/libXGettext.pm100644000765000024 7765313367562357 20147 0ustar00guidostaff000000000000Locale-XGettext-0.7/lib/Locale#! /bin/false # vim: ts=4:et # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warrant y of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # ABSTRACT: Extract Strings To PO Files package Locale::XGettext; $Locale::XGettext::VERSION = '0.7'; use strict; use Locale::TextDomain 1.20 qw(Locale-XGettext); use File::Spec; use Locale::PO 0.27; use Scalar::Util qw(reftype blessed); use Locale::Recode; use Getopt::Long 2.36 qw(GetOptionsFromArray); use Encode; use Locale::XGettext::Util::POEntries; use Locale::XGettext::Util::Keyword; use Locale::XGettext::Util::Flag; # Helper method, not exported! sub __empty($) { my ($what) = @_; return if defined $what && length $what; return 1; } sub new { my ($class, $options, @files) = @_; my $self; if (ref $class) { $self = $class; } else { $self = bless {}, $class; } $self->{__options} = $options; $self->{__comment_tag} = undef; $self->{__files} = [@files]; $self->{__exclude} = {}; if (__PACKAGE__ eq ref $self) { require Carp; Carp::croak(__x("{package} is an abstract base class and must not" . " be instantiated directly", package => __PACKAGE__)); } $options->{default_domain} = 'messages' if __empty $options->{default_domain}; $options->{from_code} = 'ASCII' if __empty $options->{default_domain}; $options->{output_dir} = '.' if __empty $options->{output_dir}; if (exists $options->{add_location}) { my $option = $options->{add_location}; if (__empty $option) { $option = 'full'; } die __"The argument to '--add-location' must be 'full', 'file', or 'never'.\n" if $option ne 'full' && $option ne 'file' && $option ne 'never'; } if (exists $options->{add_comments}) { if (!ref $options->{add_comments} && 'ARRAY' ne $options->{add_comments}) { die __"Option 'add_comments' must be an array reference.\n"; } foreach my $comment (@{$options->{add_comments}}) { $comment =~ s/^[ \t\n\f\r\013]+//; $comment = quotemeta $comment; } } $options->{from_code} = 'ASCII' if __empty $options->{from_code}; my $from_code = $options->{from_code}; my $cd = Locale::Recode->new(from => $from_code, to => 'utf-8'); if ($cd->getError) { warn __x("warning: '{from_code}' is not a valid encoding name. " . "Using ASCII as fallback.", from_code => $from_code); $options->{from_code} = 'ASCII'; } else { $options->{from_code} = Locale::Recode->resolveAlias($options->{from_code}); } $self->__readFilesFrom($options->{files_from}); if ($self->needInputFiles) { $self->__usageError(__"no input file given") if !@{$self->{__files}} && !@{$options->{files_from}}; } $self->{__keywords} = $self->__setKeywords($options->{keyword}); $self->{__flags} = $self->__setFlags($options->{flag}); if (exists $options->{exclude_file} && !ref $options->{exclude_file}) { $options->{exclude_file} = [$options->{exclude_file}]; } $self->__readExcludeFiles($options->{exclude_file}); return $self; } sub newFromArgv { my ($class, $argv) = @_; my $self; if (ref $class) { $self = $class; } else { $self = bless {}, $class; } my %options = eval { $self->__getOptions($argv) }; if ($@) { $self->__usageError($@); } $self->__displayUsage if $options{help}; if ($options{version}) { print $self->versionInformation; exit 0; } return $class->new(\%options, @$argv); } sub defaultKeywords { return []; } sub defaultFlags { return []; } sub run { my ($self) = @_; if ($self->{__run}++) { require Carp; Carp::croak(__"Attempt to re-run extractor"); } my $po = $self->{__po} = Locale::XGettext::Util::POEntries->new; if ($self->option('join_existing')) { my $output_file = $self->__outputFilename; if ('-' eq $output_file) { $self->__usageError(__"--join-existing cannot be used when output" . " is written to stdout"); } $self->readPO($output_file); } foreach my $filename (@{$self->{__files}}) { my $path = $self->resolveFilename($filename) or die __x("Error resolving file name '{filename}': {error}!\n", filename => $filename, error => $!); if ($path =~ /\.pot?$/i) { $self->readPO($path); } else { $self->readFile($path); } } $self->extractFromNonFiles; # FIXME! Sort po! if (($po->entries || $self->{__options}->{force_po}) && !$self->{__options}->{omit_header}) { $po->prepend($self->__poHeader); } foreach my $entry ($po->entries) { $self->recodeEntry($entry); } return $self; } sub extractFromNonFiles { shift } sub resolveFilename { my ($self, $filename) = @_; my $directories = $self->{__options}->{directory} || ['']; foreach my $directory (@$directories) { my $path = length $directory ? File::Spec->catfile($directory, $filename) : $filename; stat $path && return $path; } return; } sub po { shift->{__po}->entries; } sub readPO { my ($self, $path) = @_; my $entries = Locale::PO->load_file_asarray($path) or die __x("error reading '{filename}': {error}!\n", filename => $path, error => $!); foreach my $entry (@$entries) { if ('""' eq $entry->msgid && __empty $entry->dequote($entry->msgctxt)) { next; } $self->addEntry($entry); } return $self; } sub addEntry { my ($self, $entry) = @_; if (!$self->{__run}) { require Carp; # TRANSLATORS: run() is a method that should be invoked first. Carp::croak(__"Attempt to add entries before run"); } # Simplify calling from languages that do not have hashes. if (!ref $entry) { $entry = {splice @_, 1}; } my $comment = delete $entry->{automatic}; $entry = $self->__promoteEntry($entry); if (defined $comment) { # Does it contain an "xgettext:" comment? The original implementation # is quite relaxed here, even recogizing comments like "exgettext:". my $cleaned = ''; $comment =~ s{ (.*?)xgettext:(.*?(?:\n|\Z)) }{ my ($lead, $string) = ($1, $2); my $valid; my @tokens = split /[ \x09-\x0d]+/, $string; foreach my $token (@tokens) { if ($token eq 'fuzzy') { $entry->fuzzy(1); $valid = 1; } elsif ($token eq 'no-wrap') { $entry->add_flag('no-wrap'); $valid = 1; } elsif ($token eq 'wrap') { $entry->add_flag('wrap'); $valid = 1; } elsif ($token =~ /^[a-z]+-(?:format|check)$/) { $entry->add_flag($token); $valid = 1; } } $cleaned .= "${lead}xgettext:${string}" if !$valid; }exg; $cleaned .= $comment; $comment = $cleaned; my $comment_keywords = $self->option('add_comments'); if (!__empty $comment && defined $comment_keywords) { my @automatic; foreach my $keyword (@$comment_keywords) { if ($comment =~ /($keyword.*)/s) { push @automatic, $1; last; } } my $old_automatic = $entry->automatic; push @automatic, $entry->dequote($old_automatic) if !__empty $old_automatic; $entry->automatic(join "\n", @automatic) if @automatic; } } my ($msgid) = $entry->msgid; if (!__empty $msgid) { my $ctx = $entry->msgctxt; $ctx = '' if __empty $ctx; return $self if exists $self->{__exclude}->{$msgid}->{$ctx}; } $self->{__po}->add($entry); return $self; } sub keywords { my ($self) = @_; my %keywords = %{$self->{__keywords}}; return \%keywords; } sub keywordOptionStrings { my ($self) = @_; my @keywords; my $keywords = $self->keywords; foreach my $function (keys %$keywords) { push @keywords, $keywords->{$function}->dump; } return \@keywords; } sub flags { my ($self) = @_; my @flags = @{$self->{__flags}}; return \@flags; } sub flagOptionStrings { my ($self) = @_; my @flags; my $flags = $self->flags; foreach my $flag (@$flags) { push @flags, $flag->dump; } return \@flags; } sub recodeEntry { my ($self, $entry) = @_; my $from_code = $self->option('from_code'); $from_code = 'US-ASCII' if __empty $from_code; $from_code = Locale::Recode->resolveAlias($from_code); my $cd; if ($from_code ne 'US-ASCII' && $from_code ne 'UTF-8') { $cd = Locale::Recode->new(from => $from_code, to => 'utf-8'); die $cd->getError if defined $cd->getError; } my $toString = sub { my ($entry) = @_; return join '', map { defined $_ ? $_ : '' } $entry->msgid, $entry->msgid_plural, $entry->msgctxt, $entry->comment; }; if ($from_code eq 'US-ASCII') { # Check that everything is 7 bit. my $flesh = $toString->($entry); if ($flesh !~ /^[\000-\177]*$/) { die __x("Non-ASCII string at '{reference}'.\n" . " Please specify the source encoding through " . "'--from-code'.\n", reference => $entry->reference); } } elsif ($from_code eq 'UTF-8') { # Check that utf-8 is valid. require utf8; # [SIC!] my $flesh = $toString->($entry); if (!utf8::valid($flesh)) { die __x("{reference}: invalid multibyte sequence\n", reference => $entry->reference); } } else { # Convert. my $msgid = Locale::PO->dequote($entry->msgid); if (!__empty $msgid) { $cd->recode($msgid) or $self->__conversionError($entry->reference, $cd); $entry->msgid($msgid); } my $msgid_plural = Locale::PO->dequote($entry->msgid_plural); if (!__empty $msgid_plural) { $cd->recode($msgid_plural) or $self->__conversionError($entry->reference, $cd); $entry->msgid($msgid_plural); } my $msgstr = Locale::PO->dequote($entry->msgstr); if (!__empty $msgstr) { $cd->recode($msgstr) or $self->__conversionError($entry->reference, $cd); $entry->msgid($msgstr); } my $msgstr_n = Locale::PO->dequote($entry->msgstr_n); if ($msgstr_n) { my $msgstr_0 = Locale::PO->dequote($msgstr_n->{0}); $cd->recode($msgstr_0) or $self->__conversionError($entry->reference, $cd); my $msgstr_1 = Locale::PO->dequote($msgstr_n->{1}); $cd->recode($msgstr_1) or $self->__conversionError($entry->reference, $cd); $entry->msgstr_n({ 0 => $msgstr_0, 1 => $msgstr_1, }) } my $comment = $entry->comment; $cd->recode($comment) or $self->__conversionError($entry->reference, $cd); $entry->comment($comment); } return $self; } sub options { shift->{__options}; } sub option { my ($self, $key) = @_; return if !exists $self->{__options}->{$key}; return $self->{__options}->{$key}; } sub setOption { my ($self, $key, $value) = @_; $self->{__options}->{$key} = $value; return $self; } sub output { my ($self) = @_; if (!$self->{__run}) { require Carp; Carp::croak(__"Attempt to output from extractor before run"); } if (!$self->{__po}) { require Carp; Carp::croak(__"No PO data"); } return if !$self->{__po}->entries && !$self->{__options}->{force_po}; my $options = $self->{__options}; my $filename = $self->__outputFilename; open my $fh, '>', $filename or die __x("Error writing '{file}': {error}.\n", file => $filename, error => $!); foreach my $entry ($self->{__po}->entries) { my $dump = $entry->dump; # We have no idea about the encoding. Encode::_utf8_off($dump); print $fh $dump or die __x("Error writing '{file}': {error}.\n", file => $filename, error => $!); } close $fh or die __x("Error writing '{file}': {error}.\n", file => $filename, error => $!); return $self; } sub languageSpecificOptions {} # In order to simplify the code in other languages, we allow returning # a flat list instead of an array of arrays. This wrapper checks the # return value and converts it accordingly. sub __languageSpecificOptions { my ($self) = @_; my @options = $self->languageSpecificOptions; return $options[0] if @options & 0x3; # Number of items is a multiple of 4. my @retval; while (@options) { push @retval, [splice @options, 0, 4]; } return \@retval; } sub printLanguageSpecificUsage { my ($self) = @_; my $options = $self->__languageSpecificOptions; foreach my $optspec (@{$options || []}) { my ($optstring, $optvar, $usage, $description) = @$optspec; print " $usage "; my $pos = 3 + length $usage; my @description = split /[ \x09-\x0d]+/, $description; my $lineno = 0; while (@description) { my $limit = $lineno ? 31 : 29; if ($pos < $limit) { print ' ' x ($limit - $pos); $pos = $limit; } while (@description) { my $word = shift @description; print " $word"; $pos += 1 + length $word; if (@description && $pos > 77 - length $description[-1]) { ++$lineno; print "\n"; $pos = 0; last; } } } print "\n"; } return $self; } sub fileInformation {} sub bugTrackingAddress {} sub versionInformation { my ($self) = @_; my $package = ref $self; my $version; { ## no critic no strict 'refs'; my $varname = "${package}::VERSION"; $version = ${$varname}; }; $version = '' if !defined $version; $package =~ s/::/-/g; return __x('{program} ({package}) {version} Please see the source for copyright information! ', program => $self->programName, package => $package, version => $version); } sub canExtractAll { return; } sub canKeywords { shift; } sub canFlags { shift; } sub needInputFiles { shift; } sub __readExcludeFiles { my ($self, $files) = @_; return $self if !$files; foreach my $file (@$files) { my $entries = Locale::PO->load_file_asarray($file) or die __x("error reading '{filename}': {error}!\n", filename => $file, error => $!); foreach my $entry (@$entries) { my $msgid = $entry->msgid; next if __empty $msgid; my $ctx = $entry->msgctxt; $ctx = '' if __empty $ctx; $self->{__exclude}->{$msgid}->{$ctx} = $entry; } } return $self; } sub __promoteEntry { my ($self, $entry) = @_; if (!blessed $entry) { my %entry = %$entry; my $po_entry = Locale::PO->new; my $keyword = delete $entry{keyword}; if (defined $keyword) { my $keywords = $self->keywords; if (exists $keywords->{$keyword}) { my $comment = $keywords->{$keyword}->comment; $entry{automatic} = $comment if !__empty $comment; my $flags = $self->flags; my $sg_arg = $keywords->{$keyword}->singular; my $pl_arg = $keywords->{$keyword}->plural || 0; foreach my $flag (@$flags) { next if $keyword ne $flag->function; next if $flag->arg != $sg_arg && $flag->arg != $pl_arg; my $flag_name = $flag->flag; $flag_name = 'no-' . $flag_name if $flag->no; $po_entry->add_flag($flag_name); } } } my $flags = delete $entry{flags}; if (defined $flags) { my @flags = split /[ \t\r\n]*,[ \t\r\n]*/, $flags; foreach my $flag (@flags) { $po_entry->add_flag($flag) if !$po_entry->has_flag($flag); } } foreach my $method (keys %entry) { eval { $po_entry->$method($entry{$method}) }; warn __x("error calling method '{method}' with value '{value}'" . " on Locale::PO instance: {error}.\n", method => $method, value => $entry{$method}, error => $@) if $@; } $entry = $po_entry; } return $entry; } sub __conversionError { my ($self, $reference, $cd) = @_; die __x("{reference}: {conversion_error}\n", reference => $reference, conversion_error => $cd->getError); } sub __outputFilename { my ($self) = @_; my $options = $self->{__options}; if (exists $options->{output}) { if (File::Spec->file_name_is_absolute($options->{output}) || '-' eq $options->{output}) { return $options->{output}; } else { return File::Spec->catfile($options->{output_dir}, $options->{output}) } } elsif ('-' eq $options->{default_domain}) { return '-'; } else { return File::Spec->catfile($options->{output_dir}, $options->{default_domain} . '.po'); } # NOT REACHED! } sub __poHeader { my ($self) = @_; my $options = $self->{__options}; my $user_info; if ($options->{foreign_user}) { $user_info = <{copyright_holder}; $copyright = "THE PACKAGE'S COPYRIGHT HOLDER" if !defined $copyright; $user_info = <new; $entry->fuzzy(1); $entry->comment(<, YEAR. EOF $entry->msgid(''); my @fields; my $package_name = $options->{package_name}; if (defined $package_name) { my $package_version = $options->{package_version}; $package_name .= ' ' . $package_version if defined $package_version && length $package_version; } else { $package_name = 'PACKAGE VERSION' } push @fields, "Project-Id-Version: $package_name"; my $msgid_bugs_address = $options->{msgid_bugs_address}; $msgid_bugs_address = '' if !defined $msgid_bugs_address; push @fields, "Report-Msgid-Bugs-To: $msgid_bugs_address"; push @fields, 'Last-Translator: FULL NAME '; push @fields, 'Language-Team: LANGUAGE '; push @fields, 'Language: '; push @fields, 'MIME-Version: '; # We always write utf-8. push @fields, 'Content-Type: text/plain; charset=UTF-8'; push @fields, 'Content-Transfer-Encoding: 8bit'; $entry->msgstr(join "\n", @fields); return $entry; } sub __getEntriesFromFile { my ($self, $filename) = @_; open my $fh, '<', $filename or die __x("Error reading '{filename}': {error}!\n", filename => $filename, error => $!); my @entries; my $chunk = ''; my $last_lineno = 1; while (my $line = <$fh>) { if ($line =~ /^[\x09-\x0d ]*$/) { if (length $chunk) { my $entry = Locale::PO->new; chomp $chunk; $entry->msgid($chunk); $entry->reference("$filename:$last_lineno"); push @entries, $entry; } $last_lineno = $. + 1; $chunk = ''; } else { $chunk .= $line; } } if (length $chunk) { my $entry = Locale::PO->new; $entry->msgid($chunk); chomp $chunk; $entry->reference("$filename:$last_lineno"); push @entries, $entry; } return @entries; } sub __readFilesFrom { my ($self, $list) = @_; my %seen; my @files; foreach my $file (@{$self->{__files}}) { my $canonical = File::Spec->canonpath($file); push @files, $file if !$seen{$canonical}++; } # This matches the format expected by GNU xgettext. Lines where the # first non-whitespace character is a hash sign, are ignored. So are # empty lines (after whitespace stripping). All other lines are treated # as filenames with trailing (not leading!) space stripped off. foreach my $potfile (@$list) { open my $fh, '<', $potfile or die __x("Error opening '{file}': {error}!\n", file => $potfile, error => $!); while (my $file = <$fh>) { next if $file =~ /^[ \x09-\x0d]*#/; $file =~ s/[ \x09-\x0d]+$//; next if !length $file; my $canonical = File::Spec->canonpath($file); next if $seen{$canonical}++; push @files, $file; } } $self->{__files} = \@files; return $self; } sub __getOptions { my ($self, $argv) = @_; my %options; my $lang_options = $self->__languageSpecificOptions; my %lang_options; foreach my $optspec (@$lang_options) { my ($optstring, $optvar, $usage, $description) = @$optspec; $lang_options{$optstring} = \$options{$optvar}; } Getopt::Long::Configure('bundling'); $SIG{__WARN__} = sub { $SIG{__WARN__} = 'DEFAULT'; die shift; }; GetOptionsFromArray($argv, # Are always overridden by standard options. %lang_options, # Input file location: 'f|files-from=s@' => \$options{files_from}, 'D|directory=s@' => \$options{directory}, # Output file location: 'd|default-domain=s' => \$options{default_domain}, 'o|output=s' => \$options{output}, 'p|output-dir=s' => \$options{output_dir}, # Input file interpretation. 'from-code=s' => \$options{from_code}, # Operation mode: 'j|join-existing' => \$options{join_existing}, # We allow multiple files. 'x|exclude-file=s@' => \$options{exclude_file}, 'c|add-comments:s@' => \$options{add_comments}, # Language specific options: 'a|extract-all' => \$options{extract_all}, 'k|keyword:s@' => \$options{keyword}, 'flag:s@' => \$options{flag}, # Output details: 'force-po' => \$options{force_po}, 'no-location' => \$options{no_location}, 'n|add-location' => \$options{add_location}, 's|sort-output' => \$options{sort_output}, 'F|sort-by-file' => \$options{sort_by_file}, 'omit-header' => \$options{omit_header}, 'copyright-holder=s' => \$options{copyright_holder}, 'foreign-user' => \$options{foreign_user}, 'package_name=s' => \$options{package_name}, 'package_version=s' => \$options{package_version}, 'msgid-bugs-address=s' => \$options{msgid_bugs_address}, 'm|msgstr-prefix:s' => \$options{msgid_str_prefix}, 'M|msgstr-suffix:s' => \$options{msgid_str_suffix}, # Informative output. 'h|help' => \$options{help}, 'V|version' => \$options{version}, ); $SIG{__WARN__} = 'DEFAULT'; foreach my $key (keys %options) { delete $options{$key} if !defined $options{$key}; } return %options; } sub __setKeywords { my ($self, $options) = @_; my $defaults = $self->defaultKeywords || []; my $keywords = {}; foreach my $option (@$defaults, @$options) { if ('' eq $option) { $keywords = {}; next; } my $keyword; if (ref $option) { $keyword = $option; } else { $keyword = Locale::XGettext::Util::Keyword->newFromString($option); } $keywords->{$keyword->function} = $keyword; } return $keywords; } sub __setFlags { my ($self, $options) = @_; my @defaults = @{$self->defaultFlags}; my %flags; my @flags; foreach my $spec (@defaults, @$options) { my $obj = Locale::XGettext::Util::Flag->newFromString($spec) or die __x("A --flag argument doesn't have the" . " ::[pass-] syntax: {flag}", $spec); my $function = $obj->function; my $arg = $obj->arg; my $flag = $obj->flag; # First one wins. next if $flags{$function}->{$flag}->{$arg}; $flags{$function}->{$flag}->{$arg} = $obj; push @flags, $obj; } return \@flags; } sub programName { $0 } sub __displayUsage { my ($self) = @_; if ($self->needInputFiles) { print __x("Usage: {program} [OPTION] [INPUTFILE]...\n", program => $self->programName); print "\n"; print __(< $self->programName); print "\n"; print __(<fileInformation) { print "\n"; my $description = $self->fileInformation; chomp $description; print "$description\n"; } print "\n"; print __(<canExtractAll) { print __(<canKeywords) { print __(<printLanguageSpecificUsage; print "\n"; print __(<bugTrackingAddress; printf "\n"; if (defined $url) { # TRANSLATORS: The placeholder indicates the bug-reporting address # for this package. Please add _another line_ saying # "Report translation bugs to <...>\n" with the address for translation # bugs (typically your translation team's web or email address). print __x("Report bugs at <{URL}>!\n", URL => $url); } exit 0; } sub __usageError { my ($self, $message) = @_; if ($message) { $message =~ s/\s+$//; $message = __x("{program_name}: {error}\n", program_name => $self->programName, error => $message); } else { $message = ''; } die $message . __x("Try '{program_name} --help' for more information!\n", program_name => $self->programName); } 1; Locale-XGettext.pot100644000765000024 2515313367562357 20167 0ustar00guidostaff000000000000Locale-XGettext-0.7/po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Guido Flohr # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: guido.flohr@cantanea.com\n" "POT-Creation-Date: 2017-12-31 09:07+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../lib/Locale/XGettext/Text.pm:34 ../lib/Locale/XGettext.pm:770 #, perl-brace-format msgid "Error reading '{filename}': {error}!\n" msgstr "" #: ../lib/Locale/XGettext/Text.pm:63 #, perl-brace-format msgid "" "{program} (Locale-XGettext) {version}\n" "Copyright (C) {years} Cantanea EOOD (http://www.cantanea.com/).\n" "License LGPLv3+: GNU Lesser General Public Licence version 3 \n" "or later .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" "Written by Guido Flohr (http://www.guido-flohr.net/).\n" msgstr "" #: ../lib/Locale/XGettext/Text.pm:75 msgid "" "Input files are interpreted as plain text files with each paragraph being\n" "a separately translatable unit.\n" msgstr "" #: ../lib/Locale/XGettext/Util/Keyword.pm:46 #, perl-brace-format msgid "Multiple meanings for argument #{num} for function '{function}'!\n" msgstr "" #: ../lib/Locale/XGettext/Util/Keyword.pm:50 #, perl-brace-format msgid "Multiple context arguments for function '{function}'!\n" msgstr "" #: ../lib/Locale/XGettext/Util/Keyword.pm:55 #, perl-brace-format msgid "Too many forms for '{function}'!\n" msgstr "" #: ../lib/Locale/XGettext/Util/Keyword.pm:63 #, perl-brace-format msgid "Multiple automatic comments for function '{function}'!\n" msgstr "" #: ../lib/Locale/XGettext/Util/Keyword.pm:68 #, perl-brace-format msgid "Invalid argument specification '{spec}' for function '{function}'!\n" msgstr "" #: ../lib/Locale/XGettext/Util/POEntries.pm:105 msgid "conflicting plural forms" msgstr "" #: ../lib/Locale/XGettext/Util/POEntries.pm:151 #: ../lib/Locale/XGettext/Util/POEntries.pm:155 msgid "conflicting flags" msgstr "" #: ../lib/Locale/XGettext/Util/POEntries.pm:170 #, perl-brace-format msgid "" "{new_ref}: conflicts with ...\n" "{old_ref}: {msg}\n" msgstr "" #: ../lib/Locale/XGettext.pm:65 #, perl-brace-format msgid "" "{package} is an abstract base class and must not be instantiated directly" msgstr "" #: ../lib/Locale/XGettext.pm:79 msgid "The argument to '--add-location' must be 'full', 'file', or 'never'.\n" msgstr "" #: ../lib/Locale/XGettext.pm:86 msgid "Option 'add_comments' must be an array reference.\n" msgstr "" #: ../lib/Locale/XGettext.pm:101 #, perl-brace-format msgid "" "warning: '{from_code}' is not a valid encoding name. Using ASCII as " "fallback." msgstr "" #: ../lib/Locale/XGettext.pm:112 msgid "no input file given" msgstr "" #: ../lib/Locale/XGettext.pm:165 msgid "Attempt to re-run extractor" msgstr "" #: ../lib/Locale/XGettext.pm:173 msgid "--join-existing cannot be used when output is written to stdout" msgstr "" #: ../lib/Locale/XGettext.pm:181 #, perl-brace-format msgid "Error resolving file name '{filename}': {error}!\n" msgstr "" #: ../lib/Locale/XGettext.pm:229 ../lib/Locale/XGettext.pm:611 #, perl-brace-format msgid "error reading '{filename}': {error}!\n" msgstr "" #. TRANSLATORS: run() is a method that should be invoked first. #: ../lib/Locale/XGettext.pm:249 msgid "Attempt to add entries before run" msgstr "" #: ../lib/Locale/XGettext.pm:388 #, perl-brace-format msgid "" "Non-ASCII string at '{reference}'.\n" " Please specify the source encoding through '--from-code'.\n" msgstr "" #: ../lib/Locale/XGettext.pm:399 #, perl-brace-format msgid "{reference}: invalid multibyte sequence\n" msgstr "" #: ../lib/Locale/XGettext.pm:473 msgid "Attempt to output from extractor before run" msgstr "" #: ../lib/Locale/XGettext.pm:478 msgid "No PO data" msgstr "" #: ../lib/Locale/XGettext.pm:487 ../lib/Locale/XGettext.pm:492 #: ../lib/Locale/XGettext.pm:496 #, perl-brace-format msgid "Error writing '{file}': {error}.\n" msgstr "" #: ../lib/Locale/XGettext.pm:583 #, perl-brace-format msgid "" "{program} ({package}) {version}\n" "Please see the source for copyright information!\n" msgstr "" #: ../lib/Locale/XGettext.pm:666 #, perl-brace-format msgid "" "error calling method '{method}' with value '{value}' on Locale::PO instance: " "{error}.\n" msgstr "" #: ../lib/Locale/XGettext.pm:681 #, perl-brace-format msgid "{reference}: {conversion_error}\n" msgstr "" #: ../lib/Locale/XGettext.pm:819 #, perl-brace-format msgid "Error opening '{file}': {error}!\n" msgstr "" #: ../lib/Locale/XGettext.pm:947 #, perl-brace-format msgid "" "A --flag argument doesn't have the ::[pass-] syntax: " "{flag}" msgstr "" #: ../lib/Locale/XGettext.pm:970 #, perl-brace-format msgid "Usage: {program} [OPTION] [INPUTFILE]...\n" msgstr "" #: ../lib/Locale/XGettext.pm:975 msgid "Extract translatable strings from given input files.\n" msgstr "" #: ../lib/Locale/XGettext.pm:978 #, perl-brace-format msgid "Usage: {program} [OPTION]\n" msgstr "" #: ../lib/Locale/XGettext.pm:982 msgid "Extract translatable strings.\n" msgstr "" #: ../lib/Locale/XGettext.pm:996 msgid "" "Mandatory arguments to long options are mandatory for short options too.\n" "Similarly for optional arguments.\n" msgstr "" #: ../lib/Locale/XGettext.pm:1003 msgid "Input file location:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1007 msgid " INPUTFILE ... input files\n" msgstr "" #: ../lib/Locale/XGettext.pm:1011 msgid " -f, --files-from=FILE get list of input files from FILE\n" msgstr "" #: ../lib/Locale/XGettext.pm:1015 msgid "" " -D, --directory=DIRECTORY add DIRECTORY to list for input files search\n" msgstr "" #: ../lib/Locale/XGettext.pm:1019 msgid "If input file is -, standard input is read.\n" msgstr "" #: ../lib/Locale/XGettext.pm:1025 msgid "Output file location:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1029 msgid "" " -d, --default-domain=NAME use NAME.po for output (instead of messages." "po)\n" msgstr "" #: ../lib/Locale/XGettext.pm:1033 msgid " -o, --output=FILE write output to specified file\n" msgstr "" #: ../lib/Locale/XGettext.pm:1037 msgid "" " -p, --output-dir=DIR output files will be placed in directory DIR\n" msgstr "" #: ../lib/Locale/XGettext.pm:1041 msgid "If output file is -, output is written to standard output.\n" msgstr "" #: ../lib/Locale/XGettext.pm:1047 msgid "Input file interpretation:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1051 msgid " --from-code=NAME encoding of input files\n" msgstr "" #: ../lib/Locale/XGettext.pm:1054 msgid "By default the input files are assumed to be in ASCII.\n" msgstr "" #: ../lib/Locale/XGettext.pm:1060 msgid "Operation mode:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1064 msgid " -j, --join-existing join messages with existing file\n" msgstr "" #: ../lib/Locale/XGettext.pm:1068 msgid " -x, --exclude-file=FILE.po entries from FILE.po are not extracted\n" msgstr "" #: ../lib/Locale/XGettext.pm:1072 msgid "" " -cTAG, --add-comments=TAG place comment blocks starting with TAG and\n" " preceding keyword lines in output file\n" " -c, --add-comments place all comment blocks preceding keyword " "lines\n" " in output file\n" msgstr "" #: ../lib/Locale/XGettext.pm:1081 msgid "Language specific options:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1086 msgid " -a, --extract-all extract all strings\n" msgstr "" #: ../lib/Locale/XGettext.pm:1092 msgid "" " -kWORD, --keyword=WORD look for WORD as an additional keyword\n" " -k, --keyword do not to use default keywords\"));\n" " --flag=WORD:ARG:FLAG additional flag for strings inside the " "argument\n" " number ARG of keyword WORD\n" msgstr "" #: ../lib/Locale/XGettext.pm:1104 msgid "Output details:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1108 msgid " --force-po write PO file even if empty\n" msgstr "" #: ../lib/Locale/XGettext.pm:1112 msgid " --no-location do not write '#: filename:line' lines\n" msgstr "" #: ../lib/Locale/XGettext.pm:1116 msgid "" " -n, --add-location generate '#: filename:line' lines (default)\n" msgstr "" #: ../lib/Locale/XGettext.pm:1120 msgid " -s, --sort-output generate sorted output\n" msgstr "" #: ../lib/Locale/XGettext.pm:1124 msgid " -F, --sort-by-file sort output by file location\n" msgstr "" #: ../lib/Locale/XGettext.pm:1128 msgid "" " --omit-header don't write header with 'msgid \"\"' entry\n" msgstr "" #: ../lib/Locale/XGettext.pm:1132 msgid " --copyright-holder=STRING set copyright holder in output\n" msgstr "" #: ../lib/Locale/XGettext.pm:1136 msgid "" " --foreign-user omit FSF copyright in output for foreign user\n" msgstr "" #: ../lib/Locale/XGettext.pm:1140 msgid " --package-name=PACKAGE set package name in output\n" msgstr "" #: ../lib/Locale/XGettext.pm:1144 msgid " --package-version=VERSION set package version in output\n" msgstr "" #: ../lib/Locale/XGettext.pm:1148 msgid "" " --msgid-bugs-address=EMAIL@ADDRESS set report address for msgid bugs\n" msgstr "" #: ../lib/Locale/XGettext.pm:1152 msgid "" " -m[STRING], --msgstr-prefix[=STRING] use STRING or \"\" as prefix for " "msgstr\n" " values\n" msgstr "" #: ../lib/Locale/XGettext.pm:1157 msgid "" " -M[STRING], --msgstr-suffix[=STRING] use STRING or \"\" as suffix for " "msgstr\n" " values\n" msgstr "" #: ../lib/Locale/XGettext.pm:1164 msgid "Informative output:\n" msgstr "" #: ../lib/Locale/XGettext.pm:1168 msgid " -h, --help display this help and exit\n" msgstr "" #: ../lib/Locale/XGettext.pm:1172 msgid " -V, --version output version information and exit\n" msgstr "" #. TRANSLATORS: The placeholder indicates the bug-reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the address for translation #. bugs (typically your translation team's web or email address). #: ../lib/Locale/XGettext.pm:1184 #, perl-brace-format msgid "Report bugs at <{URL}>!\n" msgstr "" #: ../lib/Locale/XGettext.pm:1195 #, perl-brace-format msgid "{program_name}: {error}\n" msgstr "" #: ../lib/Locale/XGettext.pm:1201 #, perl-brace-format msgid "Try '{program_name} --help' for more information!\n" msgstr "" Java000755000765000024 013367562357 16213 5ustar00guidostaff000000000000Locale-XGettext-0.7/samplesREADME.md100644000765000024 233013367562357 17630 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples/Java# Example Extractor in Java This directory contains a sample message extractor written in Java. Interfacing Java with Perl is considerably more complicated than interfacing a scripting language with Perl. Consequently, the code you find here will probably not win a prize and the implementation has a couple of caveats. ## Installing Inline::Java Installing `Inline::Java` is a little bit different. You have to invoke `sudo cpan install Inline::Java::Class` and not just `sudo cpan install Inline::Java`. If the Java compiler cannot be found during the installation, try playing around with the environment variable `JAVA_HOME`. The location is hard-coded into the installed module. Once everything works, the environment variable is ignored. ## Possible Exceptions You can call all methods of the Perl object from inside Java but any return value but a scalar will probably throw an exception. You can prevent this by implementing wrapper classes like it is done for the keyword definitions. See the Java source file for details. ## Singleton Only one Java extractor can be instantiated from Perl at a time. This is ugly but does notr really pose a problem. If you find more problems, contact the author or open an issue.Perl000755000765000024 013367562357 16234 5ustar00guidostaff000000000000Locale-XGettext-0.7/samplesREADME.md100644000765000024 127313367562357 17656 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples/Perl# Message Extractor Example in Perl All other examples in this directory make use of the Inline module. In fact, you could do the same for Perl with "Inline::Perl". But we will follow the traditional approach. This directory contains a wrapper script "xgettext-lines.pl" and a Perl module "PerlXGettext.pm" that is a fully-functional example. Please see the source code and `perldoc Locale::XGettext` for exhaustive documentation. For an overall image, read the [description for the Python example](../README.md). The Perl example does not use a separate module for the sub class of `Locale::XGettext` because it is assumed that every Perl programmer knows how to turn it into a proper library.Ruby000755000765000024 013367562357 16253 5ustar00guidostaff000000000000Locale-XGettext-0.7/samplesREADME.md100644000765000024 534113367562357 17675 0ustar00guidostaff000000000000Locale-XGettext-0.7/samples/Ruby# Message Extractor Example in Ruby ## Installation ***Important!*** **At the time of this writing, you have to install `Inline::Ruby` from the forked Github repository [https://github.com/gflohr/Inline-Ruby](https://github.com/gflohr/Inline-Ruby)! if you are using ruby 1.9 or newer or if you are using MacPorts!** You have to install the Perl mdoule `Inline::Ruby`. If your package manager does not have a package for `Inline::Ruby` you have the following options: ### CPAN Module Try first: ``` sudo cpan install Inline::Ruby ``` If the command `cpan` cannot be found, try instead: ``` perl -MCPAN -e 'install Inline::Ruby' ``` ### From Sources When you build the module, you should try to not mix binaries from different sources. On the Mac, for example, you should use the Ruby interpreter from MacPorts (and not the one that ships with Mac OS X) if you use Perl from MacPorts. In general, installing Perl Inline modules from source is often a challenging tasks because build systems from two programming languages have to be configured correctly. #### From CPAN Go to [http://search.cpan.org/~shlomif/Inline-Ruby/](http://search.cpan.org/~shlomif/Inline-Ruby/) and click the link "Download". Then follow the usual Perl installation plethora: ``` tar xzf Inline-Ruby-VERSION.tar.gz cd Inline-Ruby perl Makefile.PL make make test sudo make install ``` Note that dependencies are not automatically installed! Please read the output of ```perl Makefile.PL``` carefully! #### From Git Alternatively, you can use the latest sources from Git: ``` git clone https://github.com/shlomif/Inline-Ruby cd Inline-Ruby perl Makefile.PL make make test sudo make install ``` Note that dependencies are not automatically installed! Please read the output of ```perlMakefile.PL``` carefully! ***Important!*** **At the time of this writing, you have to install from the forked Github repository [https://github.com/gflohr/Inline-Ruby](https://github.com/gflohr/Inline-Ruby)! if you are using ruby 1.9 or newer or if you are using MacPorts!** ## Usage The [README.md for all samples](../README.md) contains exhaustive documentation for the Python example. The Ruby example is very similar. The source code is also well-commented! Unlike `Inline::Python`, `Inline::Ruby` does not support calling Perl methods from Ruby code. But Perl closures can be exposed to Ruby as `Proc` objects. The wrapper `xgettext-lines.pl` contains some magic that makes all methods from the original API directly callable. See the source code in `RubyXGettext.rb` for more details if you are interested. As a result, the Ruby class behaves as if it was a direct subclass of the Perl module `Locale::XGettext` and can call all methods from the superclass just like a Perl subclass could do. additional.txt100644000765000024 1513367562357 20200 0ustar00guidostaff000000000000Locale-XGettext-0.7/t/filesHello, Mars! msgid-bugs-address.t100644000765000024 257513367562357 20153 0ustar00guidostaff000000000000Locale-XGettext-0.7/t#! /usr/bin/env perl # Copyright (C) 2016-2017 Guido Flohr , # all rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. use strict; use Test::More tests => 2; use Locale::XGettext::Text; my $test_dir = __FILE__; $test_dir =~ s/[-a-z0-9]+\.t$//i; chdir $test_dir or die "cannot chdir to $test_dir: $!"; my $sol = '(?:\\A|\\\\n)'; my $eol = '(?:\\E|\\\\n)'; my @po = Locale::XGettext::Text->new({}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sol}Report-Msgid-Bugs-To: ${eol}/m; @po = Locale::XGettext::Text->new({msgid_bugs_address => 'bugtracker'}, 'files/hello.txt')->run->po; like $po[0]->msgstr, qr/${sol}Report-Msgid-Bugs-To: bugtracker${eol}/m; XGettext.pod100644000765000024 4422313367562357 20300 0ustar00guidostaff000000000000Locale-XGettext-0.7/lib/Locale=head1 NAME Locale::XGettext - Extract Strings To PO Files =head1 SYNOPSIS use base 'Locale::XGettext'; =head1 DESCRIPTION B is the base class for various string extractors. These string extractors can be used as standalone programs on the command-line or as a module as a part of other software. See L for an overall picture of the software. =head1 USAGE This section describes the usage of extractors based on this library. See L and the sections following it for the API documentation! xgettext-LANG [OPTIONS] [INPUTFILE]... B will be replaced by an identifier for the language that a specific extractor was written for, for example "xgettext-txt" for plain text files or "xgettext-tt2" for templates for the Template Toolkit version 2 (see L