Ok,

I use NT station so my scripts examples are for windows.
There are two general types of a dictionary changes:
1) It is necessary to add translations for a new language <lng> to my
dictionary, i.e. to create a new messages_<lng>.xml file.
2) It is necessary to change/add some translations for already used languages in
a dictionary (as well as in messages_<lng>.xml files).

In both cases some common dictionary.xml with format of simple_dict.xml is used
as a source for messages_<lng>.xml files creation.
Then

in the case (1):

1. addnewlang.cmd (command line "addnewlang.cml <lng>") is used to create a
template for new langauge translations (dictionary_<lng>.xml):

@echo off
SET CLASSPATH=.;..\WEB-INF\lib\xalan-2.2.0.jar;..\WEB-INF\lib\xerces-1.4.4.jar
set lng=%1
set keep=-PARAM keep-lang en
if "%lng%"=="" set keep=
if "%lng%"=="" set lng=en
set dic=%2
if "%dic%"=="" set dic=dictionary
java org.apache.xalan.xslt.Process -IN %dic%.xml -XSL merge.xsl -OUT
%dic%_%lng%.xml -PARAM mode keys -PARAM new-lang %lng% %keep%
@echo on

2. Then the created dictionary_<lng>.xml file is modifyed so that it contains
translations for all the keys.
3. The common dictionary.xml file is updated by merge.cmd (command line
"merge.cmd <lng>") to include the new language translations from
dictionary_<lng>.xml:

@echo off
SET CLASSPATH=.;..\WEB-INF\lib\xalan-2.2.0.jar;..\WEB-INF\lib\xerces-1.4.4.jar
set lng=%1
if "%lng%"=="" set lng=en
set dic=%2
if "%dic%"=="" set dic=dictionary
if EXIST %dic%.xml goto ok1
echo Error: %dic%.xml doesn't exist.
goto error
:ok1
if EXIST %dic%_%lng%.xml goto ok2
echo Error: %dic%_%lng%.xml doesn't exist.
goto error
:ok2
java org.apache.xalan.xslt.Process -IN %dic%.xml -XSL merge.xsl -OUT
%dic%_new.xml -PARAM mode merge -PARAM new-lang %lng% -PARAM new-dict
%dic%_%lng%.xml

if NOT %ERRORLEVEL%==0 exit 1
if EXIST %dic%_old.xml del %dic%_old.xml
move %dic%.xml %dic%_old.xml
move %dic%_new.xml %dic%.xml
goto end

:error
echo Usage: merge.cmd [lng [dic]]
echo        where
echo        lng - language code, "en" by default
echo        dic - base of dictionary file name, "dictionary" by default.
:end
@echo on

4. The line "call makemes <new_lng>" is appended to a makeallmess.cmd. Then
messages files are updated by running makeallmess.cmd, where makemes.cmd is:

@echo off
SET CLASSPATH=.;..\WEB-INF\lib\xalan-2.2.0.jar;..\WEB-INF\lib\xerces-1.4.4.jar
set lng=%1
set mes=messages
if NOT "%lng%"=="" set mes=messages_%lng%
if "%lng%"=="" set lng=en
set dic=%2
if "%dic%"=="" set dic=dictionary
java org.apache.xalan.xslt.Process -IN %dic%.xml -XSL convert.xsl -OUT %mes%.xml
-PARAM lang %lng%
@echo on

=========================================

in the case (2):
1. The common dictionary.xml is edited to change/add translations.
2. makeallmess.cmd is used to update messages files.


Note:
1) All the stuff is located in a sub-folder of a <cocoon based app folder>.
2) After any changes it is necessary to restart the server to get updated
translations for a client.

Best regards.
Roman


Konstantin Piroumian wrote:

> Hi Roman,
>
> >
> > I just have to say, that I've used all your stuff (merge.xsl, convert.xsl,
> > simple_dict.xml) and now I'm using convert.xsl in my *.cmd when I update a
> > dictionary.
>
> Ok, I will keep them. Maybe will move to a better place than, say somewhere
> to /tools or so...
>
> Could you describe the workflow process you are using for i18n stuff? It'll
> be useful for others and maybe I'll add it to docs.
>
> --
> Konstantin
>
> >
> > Thank you.
> > Roman
> >
> > Konstantin Piroumian wrote:
> >
> > > From: "Horst Rutter" <[EMAIL PROTECTED]>
> > >
> > > > Sorry for not mentioning..
> > > > Yes, this is portuguese, but I don't want to mislead anybody, because
> I am
> > > not.
> > > > The translation was provided by my wife who speaks native Portuguese.
> > >
> > > Fine! The only question I ask is: would you support your translation in
> > > future? Sometimes I need minor changes and cannot get a person for
> > > translating the needed text (e.g. Polish translation is left unsupported
> > > now).
> > >
> > > >
> > > > Send me your (latest) version of simple_dict.xml unless it's in cvs
> and I
> > > fill in the blanks.
> > >
> > > Hope to commit all the stuff today and will let you know when it's
> ready.
> > > You'll need to update only the messages_pt.xml.
> > >
> > > >
> > > > As far as providing simple_dict_pt.xml..
> > > > The reason I did this is I thought you are supposed to:
> > > > Maintain a master dictionary that keeps growing (simple_dict.xml in
> this
> > > case)
> > > > and then whenever you add a new locale or make corrections,
> > > > extract out simple_dict_xx.xml using merge.xsl. (the "template")
> > > > Make the changes and merge back into the big one.
> > > > Then use convert.xsl to generate the resource bundle messages_xx.xml
> used
> > > by Cocoon.
> > > > This is what I concluded based on whatever documentation there was.
> > > > ;(
> > >
> > > That could be reasonable to keep translations in sync, but I've never
> used
> > > it that way.
> > > >
> > > > So how is this supposed to work now?
> > >
> > > Now, as only messages_xx.xml are used, I've created a stylesheet that
> > > transforms the source file, say simple.xml, into messages_xx.xml
> converting
> > > all the <i18n:text> and <i18n:param> tags into <message key="..." />.
> > >
> > > > you edit simple_dict.xml and then use convert.xsl to regenerate the
> > > message catalog for the locale in question?
> > > > That's it?
> > >
> > > No, I don't touch the simple_dict.xml anymore. Moreover, I was going to
> > > remove all the legacy stuff (merge.xsl, convert.xsl, simple_dict.xml)
> from
> > > CVS, but it seems that I have to rethink it.
> > >
> > > Never thought that somebody went so far as using those stylesheets ;)
> > >
> > > Konstantin
> > >
> > > >
> > > > Horst
> > > >
> > > > ----- Original Message -----
> > > > From: "Konstantin Piroumian" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, April 23, 2002 4:50 AM
> > > > Subject: Re: special characters for i18n
> > > >
> > > >
> > > > >
> > > > > Hi!
> > > > >
> > > > > Thanks for sending this. I guess that this is Portuguese?
> > > > > Could you also translate this line: "Portuguese translation was made
> by
> > > > > <your-name /> [<your-email />]" and the country name of Portugal?
> > > > >
> > > > > Btw, the simple_dict_pt.xml is in the old dictionary format and it's
> not
> > > > > supported any more. Why do you use it?
> > > > >
> > > > > --
> > > > > Konstantin Piroumian
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > > > Thanks,
> > > > > > All very useful information.
> > > > > > Still the solution to my problem was that I (blind me!) did not
> > > realize
> > > > > > that the stupid MS WordPad writes UTF-16.
> > > > > > Now I am aware of saving my files in UTF-8 (with MS Notepad) and
> voila
> > > > > > here goes another extension for the i18n sample.
> > > > > > (gotta move over to Debian one of these days..)
> > > > > >
> > > > > > For anyone of the commiters who cares I have attached
> > > simple_dict_pt.xml
> > > > > > and messages_pt.xml
> > > > > > (Was not sure if I should direct this directly to Konstantin
> > > Piroumian)
> > > > > >
> > > > > > Horst
> > > > > >
> > > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > Please check that your question has not already been answered in the
> > > > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > > > >
> > > > > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail: <[EMAIL PROTECTED]>
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > Please check that your question has not already been answered in the
> > > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > > >
> > > > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > > > For additional commands, e-mail: <[EMAIL PROTECTED]>
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to