[zanata-users] Zanata Java properties file workflow

Patrick Huang pahuang at redhat.com
Mon Apr 27 00:37:34 UTC 2015


Hi Jasper,

Zanata cli couldn't find your translation file because it will expect it to be at "src/main/resources/MessageResources_nl_NL.properties"(trans-dir, plus source document relative path to src-dir, plus source document name, plus locale, plus file extension). But yours is at "src/main/resources/nl/serviceplanet/firkraag/ziggo/view/messages/MessageResources_nl_NL.properties". Therefore it couldn't find it.

There is a in depth example in http://zanata.org/help/cli-configuration/ under "Translation files mapping rules". Not that you need to use file mapping rules but the concept is the same.

To fix it you just need to change your <trans-dir> in zanata.xml to "src/main/resources/nl/serviceplanet/firkraag/ziggo/view/messages/" assuming it will always go to that directory. If later on you change your package name or structure in your code you will need to update trans-dir as well.

Regards
Patrick Huang
Senior Software Engineer
Engineering - Internationalisation
Red Hat

----- Original Message -----
> From: "Jasper Siepkes" <siepkes at serviceplanet.nl>
> To: "Patrick Huang" <pahuang at redhat.com>
> Cc: "Zanata User Mailinglist" <zanata-users at redhat.com>
> Sent: Friday, April 24, 2015 4:49:40 PM
> Subject: Re: [zanata-users] Zanata Java properties file workflow
> 
> Hi Patrick,
> 
> Thanks for taking the time to help me! I double checked everything but it
> still
> isn't working (maybe i'm missing something).
> 
> My zanata.xml:
> ----8<--------------------
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <config xmlns="http://zanata.org/namespace/config/">
>   <url>https://translate.serviceplanet.nl/</url>
>   <project>firkraag-ziggo-consumer</project>
>   <project-version>master</project-version>
>   <project-type>utf8properties</project-type>
> 
>   <src-dir>src/main/strings/</src-dir>
>   <trans-dir>src/main/resources/</trans-dir>
> 
>   <locales>
>     <locale>nl-NL</locale>
>   </locales>
> 
> </config>
> ----8<--------------------
> 
> The source file and previously generated target file:
> ----8<--------------------
> $ ls -las src/main/strings/
> total 76
>  0 drwxrwxr-x 2 siepkes siepkes    40 Apr 23 11:57 .
>  0 drwxrwxr-x 7 siepkes siepkes    73 Apr 23 11:57 ..
> 76 -rw-rw-r-- 1 siepkes siepkes 77784 Apr 23 11:57
> MessageResources.properties
> 
> $ ls -als src/main/resources/nl/serviceplanet/firkraag/ziggo/view/messages/
> total 76
>  0 drwxrwxr-x 2 siepkes siepkes    46 Apr 23 11:57 .
>  0 drwxrwxr-x 3 siepkes siepkes    21 Apr 23 11:57 ..
> 76 -rw-rw-r-- 1 siepkes siepkes 77715 Apr 23 11:57
> MessageResources_nl_NL.properties
> ----8<--------------------
> 
> Running zanata-cli:
> ----8<--------------------
> [siepkes at ws0080 ziggo.consumer]$ ~/Programs/zanata-cli-3.6.0/bin/zanata-cli
> push
> --push-type both --src-lang nl-NL
> [INFO] Loading project config from zanata.xml
> [INFO] Loading user config from /home/siepkes/.config/zanata.ini
> [INFO] client API version: 3.4.1, server API version: 3.6.0
> [WARN] client API version is 3.4.1, but server API version is 3.6.0
> [INFO] Server: https://translate.serviceplanet.nl/
> [INFO] Project: firkraag-ziggo-consumer
> [INFO] Version: master
> [INFO] Username: siepkes
> [INFO] Project type: utf8properties
> [INFO] Source language: nl-NL
> [INFO] Copy previous translations: true
> [INFO] Merge type: AUTO
> [INFO] Enable modules: false
> [INFO] Include patterns:
> [INFO] Exclude patterns:
> [INFO] Case sensitive: true
> [INFO] Default excludes: true
> [INFO] Exclude locale filenames: true
> [INFO] Pushing source and target documents
> [INFO] Locales to push: [nl-NL]
> [INFO] Current directory:
> /home/siepkes/git/sp-projects/firkraag/ziggo.consumer
> [INFO] Source directory (originals): src/main/strings
> [INFO] Target base directory (translations): src/main/resources
> [INFO] Found source documents:
> [INFO]            MessageResources
> [WARN] pushType set to 'Both': existing translations on server may be
> overwritten/deleted
> This will overwrite existing documents AND TRANSLATIONS on the server, and
> delete obsolete documents.
> 
> Are you sure (y/n)? y
> [INFO] pushing source doc [name=MessageResources size=375] to server
> Done in 0 secs
> [INFO] Running Copy Trans for MessageResources
> ----8<--------------------
> 
> In the portal the source document shows up but the translation for nl-NL
> contains no translated values, only keys.
> 
> The resources files don't really contain any sensitive data, just a lot of
> text.
> But I prefer them not lingering around on the nets so i'll send them to you
> directly.
> 
> Kind regards,
> 
> Jasper
> 
> > Op 24 april 2015 om 7:58 schreef Patrick Huang <pahuang at redhat.com>:
> > 
> > Hi Jasper,
> > 
> > I just did a test case on my local machine and your use case should be
> > supported (and it works for me).
> > My project structure:
> > ./zanata.xml
> > ./src/messages.properties
> > ./resources/messages_en_US.properties
> > 
> > content of my zanata.xml:
> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > 
> >  http://localhost:8080/zanata/
> >  jasper
> >  <project-version>master</project-version>
> >  <project-type>utf8properties</project-type>
> > 
> >  <src-dir>src</src-dir>
> >  <trans-dir>resources</trans-dir>
> > 
> >  en-US
> > 
> > After I run: zanata-cli push --push-type both --src-lang en-US
> > I got:
> > [INFO] Loading project config from zanata.xml
> > [INFO] Loading user config from /home/pahuang/.config/zanata.ini
> > [INFO] client API version: 3.4.1, server API version: 3.7.0-SNAPSHOT
> > [WARN] client API version is 3.4.1, but server API version is
> > 3.7.0-SNAPSHOT
> > [INFO] Server: http://localhost:8080/zanata/
> > [INFO] Project: jasper
> > [INFO] Version: master
> > [INFO] Username: admin
> > [INFO] Project type: utf8properties
> > [INFO] Source language: en-US
> > [INFO] Copy previous translations: true
> > [INFO] Merge type: AUTO
> > [INFO] Enable modules: false
> > [INFO] Include patterns:
> > [INFO] Exclude patterns:
> > [INFO] Case sensitive: true
> > [INFO] Default excludes: true
> > [INFO] Exclude locale filenames: true
> > [INFO] Pushing source and target documents
> > [INFO] Locales to push: [en-US]
> > [INFO] Current directory: /home/pahuang/work/test/jasper
> > [INFO] Source directory (originals): src
> > [INFO] Target base directory (translations): resources
> > [INFO] Found source documents:
> > [INFO] messages
> > [WARN] pushType set to 'Both': existing translations on server may be
> > overwritten/deleted
> > This will overwrite existing documents AND TRANSLATIONS on the server, and
> > delete obsolete documents.
> > 
> > Are you sure (y/n)? y
> > [INFO] pushing source doc [name=messages size=2] to server
> > Done in 1 secs
> > [INFO] Pushing target doc [name=messages size=2 client-locale=en-US] to
> > server
> > [locale=en-US]
> > Done in 0 secs
> > [INFO] Running Copy Trans for messages
> > Done in 0 secs
> > 
> > The client version I used is 3.4.0 (latest is 3.6.0). Server version is our
> > current master but it shouldn't matter. Make sure when you push
> > translation,
> > you see a log message like "[INFO] Pushing target doc [name=...". If not,
> > you
> > will need to double check your console output and compare then to your
> > project
> > file structure and make sure it is correct. e.g. from my output,
> > [INFO] Current directory: /home/pahuang/work/test/jasper
> > [INFO] Source directory (originals): src
> > [INFO] Target base directory (translations): resources
> > This tells me it would expect to find a translation file at
> > /home/pahuang/work/test/jasper/resources/messages_en_US.properties
> > (combination of current dir and target base dir, then source document name
> > plus locale).
> > 
> > If you still couldn't get it to work, you can send me your files (with
> > sensitive information removed) and I can see what I can do. Hope this
> > helps.
> > 
> > Regards,
> > Patrick Huang
> > Senior Software Engineer
> > Engineering - Internationalisation
> > Red Hat
> > 
> > ----- Original Message -----
> > > From: "Jasper Siepkes" <siepkes at serviceplanet.nl>
> > > To: "Patrick Huang" <pahuang at redhat.com>
> > > Cc: "Zanata User Mailinglist" <zanata-users at redhat.com>
> > > Sent: Thursday, April 23, 2015 5:30:59 PM
> > > Subject: Re: [zanata-users] Zanata Java properties file workflow
> > > 
> > > Hi Patrick,
> > > 
> > > The reason is because we (the "programmers") created the source resource
> > > file
> > > "MessageResources.properties" (which also happens to be in nl-NL).
> > > However
> > > all
> > > the text in the application needs to be maintained by other people. The
> > > reason
> > > that our source language nl-NL also needs to come from Zanata is that we
> > > programmers make all kinds of horrible spelling and grammar mistakes,
> > > even
> > > in
> > > our first language. The highest grade I ever got for Dutch was a 6 (out
> > > of
> > > 10
> > > ;-)...
> > > 
> > > I realize this maybe not standard usage of Zanata but what would be the
> > > best
> > > way
> > > to proceed? Create an empty source file with only keys and no translation
> > > values
> > > and push that to Zanata? The translation upload from our source file
> > > would
> > > only
> > > be one time then. After which we would just remove all the translation
> > > values
> > > from it.
> > > 
> > > We don't have any trouble with translation files in other languages; The
> > > normal
> > > Zanata workflow works fine with that.
> > > 
> > > Kind regards,
> > > 
> > > Jasper
> > > 
> > > > Op 23 april 2015 om 2:32 schreef Patrick Huang <pahuang at redhat.com>:
> > > > 
> > > > Hi Jasper,
> > > > 
> > > > Glad you like it.
> > > > 
> > > > Without going into much debugging details, it seems odd that you have a
> > > > source
> > > > using nl-NL and a target using nl-Nl as well. If they are the same,
> > > > nothing
> > > > need to be translated. Do you have another sample translation file that
> > > > is
> > > > in
> > > > other languages? Meanwhile I will try to see if I can reproduce the
> > > > issue
> > > > locally.
> > > > 
> > > > Regards,
> > > > Patrick Huang
> > > > Senior Software Engineer
> > > > Engineering - Internationalisation
> > > > Red Hat
> > > > 
> > > > ----- Original Message -----
> > > > > From: "Jasper Siepkes" <siepkes at serviceplanet.nl>
> > > > > To: "Zanata User Mailinglist" <zanata-users at redhat.com>
> > > > > Sent: Wednesday, April 22, 2015 6:48:45 PM
> > > > > Subject: [zanata-users] Zanata Java properties file workflow
> > > > > 
> > > > > Hi all,
> > > > > 
> > > > > I've been playing around with Zanata and I really like it! I've got
> > > > > the
> > > > > hang
> > > > > of
> > > > > most of the basics but one thing eludes me:
> > > > > 
> > > > > Let say I have a "MessageResources.properties" file which I consider
> > > > > the
> > > > > translation source. The base language of this file is Dutch (nl-NL).
> > > > > 
> > > > > So my layout is like this:
> > > > > 
> > > > > Source translation file: src/main/string/MessageResources.properties
> > > > > Sample target translation file:
> > > > > src/main/resources/MessageResources_nl_NL.properties
> > > > > 
> > > > > My zanata.xml is configured as follows:
> > > > > 
> > > > > ----8<-------------------------------
> > > > > https://internal.foo.bar/
> > > > > foo-project
> > > > > <project-version>master</project-version>
> > > > > <project-type>utf8properties</project-type>
> > > > > 
> > > > > <src-dir>src/main/strings/</src-dir>
> > > > > <trans-dir>src/main/resources/</trans-dir>
> > > > > 
> > > > > 
> > > > > nl-NL
> > > > > 
> > > > > ----8<-------------------------------
> > > > > 
> > > > > Now when I run:
> > > > > $ zanata-cli push --src-lang nl-NL
> > > > > $ zanata-cli push --push-type trans --src-lang nl-NL
> > > > > 
> > > > > I would expect that the keys and translations get added to zanata.
> > > > > However
> > > > > all
> > > > > the keys (and document) get added to Zanata but none of the
> > > > > translations
> > > > > are
> > > > > there. Am I making some kind of error in my thinking in the way I
> > > > > should
> > > > > work
> > > > > with Zanata or is this a bug?
> > > > > 
> > > > > Kind regards,
> > > > > 
> > > > > Jasper
> > > > > 
> > > > > _______________________________________________
> > > > > zanata-users mailing list
> > > > > zanata-users at redhat.com
> > > > > https://www.redhat.com/mailman/listinfo/zanata-users
> > > > >
> > > 
> > > >
> > >
> 
> >
> 




More information about the zanata-users mailing list