Java properties L10N support

Ivo Hinkelmann <[email protected]> Wed, 23 Jun 2010 14:12:12 +0200
Newsgroups gmane.comp.openoffice.devel.tools
Message-ID <[email protected]>
Hi folks,


Short version:
The L10N process now support java properties. If you want exclude your 
properties file please mark it at the beginning of the file with a "# 
x-no-translate" . If you want your java properties files to be merged 
during the build set the PACKAGE variable and add all your properties 
files into the L10NPROPERTYFILES variable in the makefile.

Long Version:
There is now java properties support starting from DEV300 m84 
(#i112091#). The L10N process will now take care of everything in the 
sources named "*.properties" thus if you want to exclude your properties 
file then please add a marker "# x-no-translate" direct below of the the 
copyright text. The parser stops as soon as this marker is found. I did 
that already for all properties files found so far in DEV300 m82 
(#i112445#) . If you introduce a new one please add such a marker if you 
want to exclude it. Side note, just properties files that are checked in 
are taken , nothing in the output trees nor in any zips.

If you want your files be localized e.g. for extensions there is 
makefile support (#i112394#):
L10NPROPERTYFILES:=$(CLASSDIR)/$(PACKAGE)/myfile.properties

Please note that it is mandatory that the properties files must reside 
beside the makefile.mk, to set the $(PACKAGE) variable and they have to 
go into $(CLASSDIR). Ause might generalize this in the future if there 
is a need.

e.g.
PACKAGE = com$/sun$/star$/report$/function$/metadata
L10NPROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties
-> 
unxlngx6.pro/class/com/sun/star/report/function/metadata/category.properties

see the example for further details.



There is some kind of magic in the parser in the way how it detect and 
name the output files. We basically have two different kinds of java 
properties. The real ones and those that only look like but that are not 
due to historical reasons

Those that the parser will recognize as real ones are ( case sensitive! ):

mypropfile_en_us.properties
mypropfile.properties

Those will appear localized in the output tree like
mypropfile_de.properties
mypropfile_pt.properties
mypropfile_pt_br.properties

The "other" ones are created by the basic dialog editor and they enforce 
a different nameing scheme:
mypropfile_en_US.properties

Those will appear localized in the output tree like:
mypropfile_de_DE.properties
mypropfile_pt_PT.properties
mypropfile_pt_BR.properties



I propose to create all real new java property using the form without 
any language code, e.g. "mypropfile.properties" for en-US

RE dislikes to see:
- Please don't check in any translated files like 
mypropfile_de.properties, mypropfile_fr.properties etc
- Please don't check in duplicated properties files ( e.g. both 
mypropfile.properties and mypropfile_en_us.properties)
- Please don't check in any strange names like "my properties 
file.properties" or "mypropfile.pRoPeRtIeS" or 
"mypropfile_EN_us.properties" etc
- Please don't forget to mark any new files that end with ".properties" 
that should not be part of the L10N process


Example session:

 >pwd
reportbuilder/java/com/sun/star/report/function/metadata

 >echo $WITH_LANG
de pt pt-BR

 >cat makefile.mk
[..]
PRJ    = ..$/..$/..$/..$/..$/..$/..
PRJNAME = reportbuilder
TARGET= rpt_java_css_metadata
PACKAGE = com$/sun$/star$/report$/function$/metadata

# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
#----- compile .java files -----------------------------------------
[..]

L10NPROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \
          $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \
          $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_us.properties

# --- Targets ------------------------------------------------------
.INCLUDE :  target.mk

 >dmake

Writing to:
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Author-Function_de_DE.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Author-Function_pt_BR.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Author-Function_pt_PT.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Author-Function_en_US.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Author-Function_fr_FR.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Title-Function_de.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Title-Function_pt_br.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Title-Function_pt.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Title-Function_en_us.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/Title-Function_fr.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/category_de.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/category_pt_br.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/category_pt.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/category.properties
../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/category_fr.properties

Cheers,
Ivo