ogino's blog
Archives
« 11月 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe
Search

Links
 

Today's Page Hits: 34

« Java EE 5 API ドキュメント... | Main | VirtualBox 使ってみました »
月曜日 2 18, 2008
How should we localize GlassFish v3?
Last week, g11n@glassfish started some discussion on l10n process for GlassFish v3. If you are interested, you can refer to the emails here and of course, join the discussion. So, over the weekend I played with maven2 to evaluate things we discussed last week. Following is a note so I don't forget. For people not yet familiar with v3 modules, I recommend you to check things like V3 Engineers Guide and Adding modules first.

First, checkout v3 workspace.

$ svn checkout https://svn.dev.java.net/svn/glassfish-svn/trunk/v3
Then I picked one module, core/kernel, to test building l10n module. I created following module directory structure.

glassfish
| -- ....
`-- l10n
    |-- pom.xml
    `-- core
        |-- pom.xml
        `-- kernel
            |-- pom.xml
            |-- src
            |   `-- main
            |       `-- resources
            |-- l10n.include
            `-- l10n.exclude
pom files look like this: Note that in l10n/core/kernel/pom.xml, I'm calling ant task sync through antrun maven plugin to copy English files from base core/kernel module to the module's resources directory. I first thought of using copy but sync seemed more suitable as it deletes files deleted in base module.
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <echo message="Syncing English resource files"/>
                                <sync todir="src/main/resources">
                                    <fileset dir="../../../core/kernel/src/main/java">
                                        <includesfile name="l10n.include"/>
                                        <excludesfile name="l10n.exclude"/>
                                    </fileset>
                                </sync>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
Put 1 typical properties file in l10n.include:

com/sun/enterprise/v3/admin/LocalStrings.properties
l10n.exclude:

**/CVS/*
**/.svn/**
Now, try copying files over.
$ cd <v3 ws>/l10n/core/kernel
$  mvn generate-sources
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building GlassFish core.kernel Localization modules
[INFO]    task-segment: [generate-sources]
[INFO] ----------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] Syncing English resource files
     [sync] Copying 1 file to /Users/ogino/glassfish-svn.dev.java.net/glassfish-svn/v3/l10n/core/kernel/src/main/resources
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Feb 18 07:41:26 JST 2008
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
$ find src
....
src/main/resources/com/sun/enterprise/v3/admin/LocalStrings.properties
Looks like the file is copied! Let's localize it. (Actually just renaming it for now..)
$ cp src/main/resources/com/sun/enterprise/v3/admin/LocalStrings.properties src/main/resources/com/sun/enterprise/v3/admin/LocalStrings_ja.properties
Then build.
$ mvn install
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building GlassFish core.kernel Localization modules
[INFO]    task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] Syncing English resource files
[INFO] Executed tasks
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hk2:hk2-compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [hk2:package]
[INFO] Building jar: /Users/ogino/glassfish-svn.dev.java.net/glassfish-svn/v3/l10n/core/kernel/target/kernel-l10n-10.0-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing /Users/ogino/glassfish-svn.dev.java.net/glassfish-svn/v3/l10n/core/kernel/target/kernel-l10n-10.0-SNAPSHOT.jar to /Users/ogino/.m2/repository/org/glassfish/l10n/kernel-l10n/10.0-SNAPSHOT/kernel-l10n-10.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Mon Feb 18 07:47:16 JST 2008
[INFO] Final Memory: 12M/24M
[INFO] ------------------------------------------------------------------------
I can find kernel-l10n-10.0-SNAPSHOT.jar under the module's target directory and also in local repository.
$ ls ~/.m2/repository/org/glassfish/l10n/kernel-l10n/10.0-SNAPSHOT/
kernel-l10n-10.0-SNAPSHOT.jar
kernel-l10n-10.0-SNAPSHOT.pom
....
Above is what I'm done so far. I felt this is a simple process leveraging maven power. For example when you run mvn install in l10n directory, it builds all the submodules. Of course there are many things left to consider. Let's continue discussion in emails.
Posted at 09:56午前 2 18, 2008 by Shinya Ogino in Sun  |  Comments[0]

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed