Return-Path: Delivered-To: apmail-incubator-jspwiki-commits-archive@locus.apache.org Received: (qmail 70388 invoked from network); 13 Feb 2008 06:27:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2008 06:27:26 -0000 Received: (qmail 70098 invoked by uid 500); 13 Feb 2008 06:27:20 -0000 Delivered-To: apmail-incubator-jspwiki-commits-archive@incubator.apache.org Received: (qmail 70081 invoked by uid 500); 13 Feb 2008 06:27:20 -0000 Mailing-List: contact jspwiki-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-commits@incubator.apache.org Received: (qmail 70072 invoked by uid 99); 13 Feb 2008 06:27:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2008 22:27:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2008 06:26:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7E4F21A9832; Tue, 12 Feb 2008 22:27:05 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r627274 - in /incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests: MissingTranslations.java SamplePlugin2.java Date: Wed, 13 Feb 2008 06:27:05 -0000 To: jspwiki-commits@incubator.apache.org From: ajaquith@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080213062705.7E4F21A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ajaquith Date: Tue Feb 12 22:27:04 2008 New Revision: 627274 URL: http://svn.apache.org/viewvc?rev=627274&view=rev Log: (empty) Added: incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/MissingTranslations.java incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/SamplePlugin2.java Added: incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/MissingTranslations.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/MissingTranslations.java?rev=627274&view=auto ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/MissingTranslations.java (added) +++ incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/MissingTranslations.java Tue Feb 12 22:27:04 2008 @@ -0,0 +1,70 @@ +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.*; + +/** + * Simple utility that shows you a sorted list of properties + * that are missing in a i18n file + * (as diff from the default en properties). + * + * @author Christoph Sauer + * + */ +public class MissingTranslations +{ + + // Change this to your settings... + static String base = "C:/workspace/JSPWiki HEAD"; + static String suffix = "de_DE"; + + public static void main(String[] args) throws IOException + { + diff ("/etc/i18n/CoreResources.properties", + "/etc/i18n/CoreResources_" + suffix + ".properties"); + + diff ("/etc/i18n/templates/default.properties", + "/etc/i18n/templates/default_" + suffix + ".properties"); + + diff ("/src/com/ecyrd/jspwiki/plugin/PluginResources.properties", + "/src/com/ecyrd/jspwiki/plugin/PluginResources_" + suffix + ".properties"); + } + + public static void diff(String en, String other) throws FileNotFoundException, IOException { + + //Standard Properties + Properties p = new Properties(); + p.load( new FileInputStream(new File(base + en)) ); + + Properties p2 = new Properties(); + p2.load( new FileInputStream(new File(base + other)) ); + + System.out.println("Missing Properties in " + other + ":"); + System.out.println("------------------------------------"); + Iterator iter = sortedNames(p).iterator(); + while(iter.hasNext()) + { + String name = (String)iter.next(); + String value = p.getProperty(name); + + if (p2.get(name) == null) { + System.out.println(name + " = " + value); + } + } + System.out.println(""); + } + + private static List sortedNames(Properties p) + { + List list = new ArrayList(); + Enumeration iter = p.propertyNames(); + while(iter.hasMoreElements()) + { + list.add(iter.nextElement()); + } + + Collections.sort(list); + return list; + } +} \ No newline at end of file Added: incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/SamplePlugin2.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/SamplePlugin2.java?rev=627274&view=auto ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/SamplePlugin2.java (added) +++ incubator/jspwiki/branches/JSPWIKI_STRIPES_BRANCH/tests/SamplePlugin2.java Tue Feb 12 22:27:04 2008 @@ -0,0 +1,26 @@ +import com.ecyrd.jspwiki.*; +import com.ecyrd.jspwiki.plugin.*; +import java.util.*; + +/** + * Implements a simple plugin that just returns its text. + *

+ * Parameters: text - text to return. + * + * @author Janne Jalkanen + */ +public class SamplePlugin2 + implements WikiPlugin +{ + public void initialize( WikiEngine engine ) + throws PluginException + { + } + + public String execute( WikiContext context, Map params ) + throws PluginException + { + return (String)params.get("text"); + } + +}