Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 41015 invoked from network); 27 Jul 2006 10:53:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jul 2006 10:53:36 -0000 Received: (qmail 45845 invoked by uid 500); 27 Jul 2006 10:53:33 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 45576 invoked by uid 500); 27 Jul 2006 10:53:32 -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 45565 invoked by uid 99); 27 Jul 2006 10:53:32 -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 03:53:32 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ilya.okomin@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 03:53:31 -0700 Received: by ug-out-1314.google.com with SMTP id u40so188849ugc for ; Thu, 27 Jul 2006 03:53:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=NbVQwPMe2FZ9rwlN4Mu6HVEFXdy+MmWd7tZKzAfvv0RScJ0pqXI8VMyGY8cAaQAS+Su1nD3p+xYShX5zmNe99IXGBAZcjHypox0vdNkTv1Cv0MvM7/vaEwzSGEQv2YAq+U4wrUGccQ2jZ7h/5EJhBrk4oPy+zgQ7KbG5hvMYLZU= Received: by 10.67.100.17 with SMTP id c17mr7025138ugm; Thu, 27 Jul 2006 03:53:10 -0700 (PDT) Received: by 10.66.250.11 with HTTP; Thu, 27 Jul 2006 03:53:10 -0700 (PDT) Message-ID: Date: Thu, 27 Jul 2006 14:53:10 +0400 From: "Ilya Okomin" To: harmony-dev@incubator.apache.org Subject: [classlib]strings externalization MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_273507_18637784.1153997590325" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_273507_18637784.1153997590325 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. [1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200607.mbox/%3cc79906b30607100414j7e135b50tc4d725c0df740673@mail.gmail.com%3e -- -- Ilya Okomin Intel Middleware Products Division ------=_Part_273507_18637784.1153997590325--