Bug 1096494 - dtd import export support using Zanata Client (Maven)
Summary: dtd import export support using Zanata Client (Maven)
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Maven
Version: 3.3
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Damian Jansen
QA Contact: Zanata-QA Mailling List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-11 08:14 UTC by Ankit Patel
Modified: 2015-07-29 02:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-29 02:10:52 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1098351 0 unspecified CLOSED srcDir option on command line does not override the configured srcDir option 2021-02-22 00:41:40 UTC

Internal Links: 1098351

Description Ankit Patel 2014-05-11 08:14:40 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Build Identifier: 

Hello,

I have been involved with Mozilla Localization from quite long time now and would like to use Zanata for translating Mozilla Firefox.

Mozilla Firefox has well mix of dtds and properties files for translations. So far, I have been able to use utf8properties very well using client, but support for dtds on client side is still not enabled.

This is important when you deal with bunch of dtd files, not just few files!

If we can support dtds at the client side as well, I think one another major open source project is covered and ready to be captured.

Reproducible: Always

Actual Results:  
dtds aren't supported at the client side

Expected Results:  
dtds should be supported at the client side as well (not just UI)

Comment 1 Carlos Munoz 2014-05-12 06:03:52 UTC
Ankit, we already support the DTD format via the Okapi framework. You should be able to use the Zanata clients to push/pull this type of files. Bear in mind your project needs to be of 'File' type when setting it up.

You can look at the following link for a bit more info about this:
https://github.com/zanata/zanata-server/wiki/Project-Types

Comment 2 Ankit Patel 2014-05-12 06:24:05 UTC
(In reply to Carlos Munoz from comment #1)
> Ankit, we already support the DTD format via the Okapi framework. You should
> be able to use the Zanata clients to push/pull this type of files. Bear in
> mind your project needs to be of 'File' type when setting it up.
> 
> You can look at the following link for a bit more info about this:
> https://github.com/zanata/zanata-server/wiki/Project-Types

It says,

"No Selection allows the upload of all file types other than .properties and .xml via the Website GUI, but will prevent the use of Zanata CLI clients."

Comment 3 Carlos Munoz 2014-05-12 06:30:51 UTC
The paragraph below that sentence is the key one. It talks about the 'File' project type, which is the one you should use for dtd files. That one fully supports the clients.

Comment 4 Ankit Patel 2014-05-12 07:22:28 UTC
(In reply to Carlos Munoz from comment #3)
> The paragraph below that sentence is the key one. It talks about the 'File'
> project type, which is the one you should use for dtd files. That one fully
> supports the clients.

Hi Carlos,

I have just tried, push/pull using Maven client. It's behaviour is not as expected.

If you try to push translations from client side, it assume translations as source too!

------------------------
[ankit@ankit testing]$ mvn -B zanata:push -Dzanata.pushType=both
[INFO] Scanning for projects...
...[snip]
...
[INFO] Found source documents:
[INFO]            browser.dtd
[INFO]            gu/browser.dtd
[WARNING] pushType set to 'Both': existing translations on server may be overwritten/deleted
[INFO] pushing source document [browser.dtd] to server
[INFO]     transmitting file [/home/ankit/testing/browser.dtd] as single chunk
Done in 2 secs
[INFO] pushing gu translation of browser.dtd
[INFO]     transmitting file [/home/ankit/testing/gu/browser.dtd] as single chunk
Done in 9 secs
[INFO] pushing source document [gu/browser.dtd] to server
[INFO]     transmitting file [/home/ankit/testing/gu/browser.dtd] as single chunk
Done in 3 secs
[WARNING] No translation file found for locale gu mapped by null. Expected at /home/ankit/testing/gu/gu/browser.dtd
...
...[/snip]

Comment 5 David Mason 2014-05-12 23:43:15 UTC
(In reply to Ankit Patel from comment #4)
> I have just tried, push/pull using Maven client. It's behaviour is not as
> expected.
> 
> If you try to push translations from client side, it assume translations as
> source too!

The requirement for 'File' project type at the moment is that the source directory and translation directory must be completely separate - they cannot be the same directory or one nested within the other.

This is due to the difficulty of automatically distinguishing source from translations when we cannot assume a specific directory structure as in the other project types. In the future we intend to provide a more sophisticated system for identifying source and translations, but that is not on the immediate development horizon.

Comment 6 David Mason 2014-05-12 23:54:06 UTC
(In reply to David Mason from comment #5)
> The requirement for 'File' project type at the moment is that the source
> directory and translation directory must be completely separate - they
> cannot be the same directory or one nested within the other.

Note that a workaround at the moment to avoid changing project structure would be to add a before-push command to zanata.xml that will copy source and translation files to separate temporary directories, and an after-push command to clean them up. Similar for pull.

This can be done using command hooks: https://github.com/zanata/zanata-server/wiki/Client-Command-Hooks

e.g. something like this in zanata.xml may work:

<hooks>
  <hook command="push">
      <before>mkdir -p build/source</before>
      <before>cp browser.dtd build/source</before>
      <before>mkdir -p build/trans</before>
      <before>cp -r gu build/trans</before>
      <after>rm -rf build</after>
  </hook>
</hooks>

(you would need to set your source and translation directories to match build/source and build/trans created in the commands)

Comment 7 Ankit Patel 2014-05-13 18:17:04 UTC
(In reply to David Mason from comment #6)
> (In reply to David Mason from comment #5)
> > The requirement for 'File' project type at the moment is that the source
> > directory and translation directory must be completely separate - they
> > cannot be the same directory or one nested within the other.
> 
> Note that a workaround at the moment to avoid changing project structure
> would be to add a before-push command to zanata.xml that will copy source
> and translation files to separate temporary directories, and an after-push
> command to clean them up. Similar for pull.
> 
> This can be done using command hooks:
> https://github.com/zanata/zanata-server/wiki/Client-Command-Hooks
> 
> e.g. something like this in zanata.xml may work:
> 
> <hooks>
>   <hook command="push">
>       <before>mkdir -p build/source</before>
>       <before>cp browser.dtd build/source</before>
>       <before>mkdir -p build/trans</before>
>       <before>cp -r gu build/trans</before>
>       <after>rm -rf build</after>
>   </hook>
> </hooks>
> 
> (you would need to set your source and translation directories to match
> build/source and build/trans created in the commands)

Sorry, but not working as I was expecting!

Comment 8 David Mason 2014-05-14 00:47:54 UTC
(In reply to Ankit Patel from comment #7)
> (In reply to David Mason from comment #6)
> > (In reply to David Mason from comment #5)
> > > The requirement for 'File' project type at the moment is that the source
> > > directory and translation directory must be completely separate - they
> > > cannot be the same directory or one nested within the other.
> > 
> > Note that a workaround at the moment to avoid changing project structure
> > would be to add a before-push command to zanata.xml that will copy source
> > and translation files to separate temporary directories, and an after-push
> > command to clean them up. Similar for pull.
> > 
> > This can be done using command hooks:
> > https://github.com/zanata/zanata-server/wiki/Client-Command-Hooks
> > 
> > e.g. something like this in zanata.xml may work:
> > 
> > <hooks>
> >   <hook command="push">
> >       <before>mkdir -p build/source</before>
> >       <before>cp browser.dtd build/source</before>
> >       <before>mkdir -p build/trans</before>
> >       <before>cp -r gu build/trans</before>
> >       <after>rm -rf build</after>
> >   </hook>
> > </hooks>
> > 
> > (you would need to set your source and translation directories to match
> > build/source and build/trans created in the commands)
> 
> Sorry, but not working as I was expecting!

Can you provide details about what you were expecting and about what happened? I've tried tried this set of command hooks on my machine with zanata cli client and it behaves as I expect (it is a slightly older client, but command hooks have not changed since):

Contents of zanata.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
  <url>http://localhost:8080/zanata/</url>
  <project>html-test</project>
  <project-version>6</project-version>
  <project-type>file</project-type>

  <hooks>
    <hook command="push">
        <before>mkdir -p build/source</before>
        <before>cp test.txt build/source</before>
        <before>mkdir -p build/trans</before>
        <before>cp -r de build/trans</before>
        <after>rm -rf build</after>
    </hook>
  </hooks>

  <locales>
    <locale>de</locale>
  </locales>
</config>


Command output:

[damason@damason test]$ zanata-cli push -s build/source -t build/trans --file-types txt
[INFO] Loading project config from zanata.xml
[INFO] Loading user config from /home/damason/.config/zanata.ini
[INFO] client API version: 3.3.1-SNAPSHOT, server API version: 3.3.1-SNAPSHOT
[WARN] client API SCM id is git-api-3.3.0-15-g47c404d, but server API SCM id is unknown
[INFO] [Running command]$ mkdir -p build/source
[INFO]     Completed with exit value: 0
[INFO] [Running command]$ cp test.txt build/source
[INFO]     Completed with exit value: 0
[INFO] [Running command]$ mkdir -p build/trans
[INFO]     Completed with exit value: 0
[INFO] [Running command]$ cp -r de build/trans
[INFO]     Completed with exit value: 0
[INFO] Server: http://localhost:8080/zanata/
[INFO] Project: html-test
[INFO] Version: 6
[INFO] Username: admin
[INFO] Project type: file
[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 documents only
[INFO] Current directory: /tmp/hookly
[INFO] Source directory (originals): build/source
[WARN] Using EXPERIMENTAL project type 'file'.
[WARN] Obsolete document removal is not yet implemented, no documents will be removed from the server.
[INFO] Found source documents:
[INFO]            test.txt
This will overwrite existing documents on the server.

Are you sure (y/n)? y
[INFO] pushing source document [test.txt] to server
[INFO]     transmitting file [/tmp/hookly/build/source/test.txt] as single chunk
Done in 0 secs
[INFO] [Running command]$ rm -rf build
[INFO]     Completed with exit value: 0

Comment 9 David Mason 2014-05-14 00:51:29 UTC
(In reply to David Mason from comment #8)

This is what I had on the filesystem when I ran the command (it is the same before and after running the command):

[damason@damason test]$ ls *
test.txt  zanata.xml

de:
test.txt

Comment 10 Ankit Patel 2014-05-15 13:40:02 UTC
Thanks David for actively looking into this.

Here's what I have gone through.

http://pastebin.test.redhat.com/209244

Comment 11 David Mason 2014-05-15 22:47:09 UTC
(In reply to Ankit Patel from comment #10)
> Thanks David for actively looking into this.
> 
> Here's what I have gone through.
> 
> http://pastebin.test.redhat.com/209244

It looks like your issue is caused by the source directory from the command line not properly overriding the value from pom.xml:

  <configuration>
    <srcDir>.</srcDir>
  </configuration>

You may get it working if you change this from '.' to 'build/source' or just remove it so it doesn't override the command line option.


I've created a separate bug report for the command line option not taking precedence: https://bugzilla.redhat.com/show_bug.cgi?id=1098351

Comment 12 Zanata Migrator 2015-07-29 02:10:52 UTC
Migrated; check JIRA for bug status: http://zanata.atlassian.net/browse/ZNTA-140


Note You need to log in before you can comment on or make changes to this bug.