Package org.fedorahosted.tennera.jgettext

Examples of org.fedorahosted.tennera.jgettext.Message


        List<String> found = new ArrayList<String>(translations.length);

        // Assert that all the given translations are present
        while (messageParser.hasNext()) {
            Message message = messageParser.next();

            if (!message.isHeader()) {
                // Find the message id in the array given to check
                int foundAt = 0;
                while (foundAt < translations.length) {
                    // Message Id found
                    if (message.getMsgid().equals(translations[foundAt])) {
                        found.add(message.getMsgid());
                        // Translation does not match
                        if (!message.getMsgstr().equals(
                                translations[foundAt + 1])) {
                            throw new AssertionError(
                                    "Expected translation for mssgid '"
                                            + message.getMsgid() + "' "
                                            + "is: '"
                                            + translations[foundAt + 1] + "'. "
                                            + "Instead got '"
                                            + message.getMsgstr() + "'");
                        }
                    }

                    foundAt += 2;
                }
View Full Code Here


    private static void assertPoFileCorrect(String poFileContents) {
        MessageStreamParser messageParser =
                new MessageStreamParser(new StringReader(poFileContents));

        while (messageParser.hasNext()) {
            Message message = messageParser.next();

            if (message.isHeader()) {
                // assert that expected headers are present (with values if
                // needed)
                assertThat(message.getMsgstr(), containsString("MIME-Version:"));
                assertThat(message.getMsgstr(), containsString("Content-Type:"));
                assertThat(message.getMsgstr(),
                        containsString("Content-Transfer-Encoding:"));
                assertThat(message.getMsgstr(),
                        containsString("Last-Translator:"));
                assertThat(message.getMsgstr(),
                        containsString("PO-Revision-Date:"));
                assertThat(message.getMsgstr(),
                        containsString("Language-Team:"));
                assertThat(message.getMsgstr(),
                        containsString("X-Generator: Zanata")); // Generator is
                                                                // Zanata
                assertThat(message.getMsgstr(), containsString("Plural-Forms:"));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.fedorahosted.tennera.jgettext.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.