Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 65512 invoked from network); 27 Jul 2006 12:15:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jul 2006 12:15:45 -0000 Received: (qmail 90009 invoked by uid 500); 27 Jul 2006 12:15:41 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 89964 invoked by uid 500); 27 Jul 2006 12:15:41 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 89953 invoked by uid 99); 27 Jul 2006 12:15:41 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 05:15:41 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of t.p.ellison@gmail.com designates 64.233.182.188 as permitted sender) Received: from [64.233.182.188] (HELO nf-out-0910.google.com) (64.233.182.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 05:15:40 -0700 Received: by nf-out-0910.google.com with SMTP id x4so139945nfb for ; Thu, 27 Jul 2006 05:15:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=V/WqoNLbPbVeTOC+dHoht6KdO+7bVTp8l7IgEGqolFHW0xrAKXK5vCpzDCsjfGk9ZGb0AWxzwH1eBi1SlGRhxmWPr7b/BQfFJkL+/Di9J37ekh/qcIoLoSpL+P1fbDy+qvHzP3rjm5pA/TBTIeHFvxqjwSDsJCHU6XF4wW72Awo= Received: by 10.48.142.14 with SMTP id p14mr1685290nfd; Thu, 27 Jul 2006 05:15:19 -0700 (PDT) Received: from ?9.20.183.72? ( [195.212.29.83]) by mx.gmail.com with ESMTP id c10sm2241991nfb.2006.07.27.05.15.18; Thu, 27 Jul 2006 05:15:18 -0700 (PDT) Message-ID: <44C8AE2A.8000807@gmail.com> Date: Thu, 27 Jul 2006 13:14:34 +0100 From: Tim Ellison User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [classlib]strings externalization References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ilya Okomin wrote: > Hi falks! > > I would like to open discussion about the way to extract messages for > internationalization from the source files (as the continuation of the > [classlib]internationalization thread [1]). > > The task is to scan modules source files, find exception messages, > extract > them into the resource bundle and replace these messages in the source > files with corresponding Messages.getString() call by key parameter > from the > resource bundle. > > I see three ways to solve this task: > 1) Do it manually - the less attractive because of the huge amount of > manual > work. > 2) Use Eclipse externalization tool. This tool provide us a > possibility to > scan source files and to check strings you would like to externalize. > Sounds > reasonable except several issues: > > - At first, there is a manual work to choose from the source files > only messages related to exceptions throwing and avoid duplication of > messages at list in one class file.(however, this work is much more > easier > than one mentioned at 1) point:)) > - Eclipse tool creates resource bundle with messages and Messages > class to get access to this resources in every package. Also this tool > suggests to use .id as the key of the message. In our > previous > discussion [1] it was decided to use .id as the key and > keep all > messages in one resource file per module. Good news: during processing > source file with Eclipse tool we can set the same resource file for all > source files from the module and every time set the prefix of key > names to > the module name, also our Messages class implementation can be used > after > adding corresponding import statement into a source. Bad news: > following > this way of processing sources one can see that there is no tracking > system > for key indices numeration, in case of mistakes there can be generated > different messages with the same keys!! > - And at last, Eclipse tool processes only separated strings. > And according to the discussion [1] these messages with arguments > supposed > to be converted to strings with places for substitution by > parameters being > arguments in Messages.getString() method. E.g. code: > > int param; > ... > NullPointerException("foo " + param + " bar"); > > supposed to be formatted as > > NullPointerException(Messages.getString(".1", param)); > > where ".1=foo {0} bar" in the resource bundle. > I have an optitmistic thought that there are not so many messages with > parameters to process them manually after the rest of work with just > strings > is done. > > 3)Write own parser that will do all implement tasks automatic. In my > opinion > it's quite a non-trivial task, only if there is no tools that resolves > similar tasks. > > The 2) approach seems to me more reasonable, despite some manual work. > Parser will help us to easily update bundles and sources after future > changes, but it will be not so easy to implement it. > > Any thoughts on this topic? > > Tim, if I'm not mistaken you dealt with strings externalization for SQL > module, it would be interesting to hear anything about the way you'd > chosen. I did a combination of (1) and (2) as you describe above. I also found that the Eclipse externalization tool was inadequate in a number of areas, including creating duplicate keys and not dealing with parameterized messages properly -- so I had to go and fix up the code manually. The other reason we will need some manual intervention is that there is plenty of code that throws exceptions without any message describing the problem, and of course the tooling won't help there. So once we have the basic framework in place for the message handling I think it will require a large manual effort to get all the strings that we want externalized properly. Luckily it is not technically complex work and it is a task that we can easily do in parallel across the modules. Regards, Tim > > [1] > http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200607.mbox/%3cc79906b30607100414j7e135b50tc4d725c0df740673@mail.gmail.com%3e > > --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org