Bug 736898 - RFE: As a translator, I want to push translations using maven client to Zanata so that I can do offline translation
Summary: RFE: As a translator, I want to push translations using maven client to Zanat...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Logic
Version: 1.6-SNAPSHOT
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 1.6-beta-1
Assignee: Carlos Munoz
QA Contact: Joyce Chang
URL:
Whiteboard:
Depends On: 742083
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-09 02:45 UTC by Sean Flanigan
Modified: 2013-03-04 03:19 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause Translators cannot currently push translations using zanata client. Consequence Only project maintainer or admin can push translations but not translators so offline translation is not possible. Change Translators can now push translations for individual locales with the -Dzanata.locales option. (example usage: -Dzanata.locales=en,es-ES,en-US). The specified locales must be a subset of those present in zanata.xml, and may be the mapped locale or the "local" locale. Also, the -Dzanata.pushTrans option is now deprecated and is replaced by -Dzanata.pushType which can take the following values: source = Push source documents only (This is the default value when not specified) trans = Push translations only both = Push both source documents and translations If the now deprectated pushTrans option is used, it will be equivalent to using -Dzanata.pushType=both Result Offline translation can be done with zanata client.
Story Points: ---
Clone Of:
: 816805 (view as bug list)
Environment:
Last Closed: 2012-06-22 00:58:16 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 725319 None None None Never
Red Hat Bugzilla 816805 None None None Never

Internal Links: 725319 736819 816805

Description Sean Flanigan 2011-09-09 02:45:18 UTC
This is related to bug 725319, but uses the command line instead of the web UI, and should be a lot easier to implement.

The zanata push command has two problems when used for offline translation:
1. only allowed to admin or project maintainers, not translators
2. the client pushes source text (POT files), not just translations (PO)

(Plus a lot of translators will prefer a UI, but that's a separate issue.)

We can fix #1 by changing the security rules on the server, to allow 'translator' role to push translations (but not source).

We can fix #2 by adding another option to the Maven/Python clients, eg --push-trans-only

Comment 1 Ding-Yi Chen 2011-09-09 03:38:04 UTC
So the use case will be:

Admin/project maintainer:
1. Push pot files only
2. Push pot files and po files.
3. Push po files only.

Translator:
1. Push po files only.

Comment 2 sandeep shedmake 2011-09-16 06:15:10 UTC
(In reply to comment #0)

> The zanata push command has two problems when used for offline translation:
> 1. only allowed to admin or project maintainers, not translators
> 2. the client pushes source text (POT files), not just translations (PO)
> 

My fas name (i.e. sandeeps) is added as additional maintainer for translation project: https://translate.zanata.org/zanata/project/view/subscription-manager

$zanata pull --project-type gettext subscription-manager ; 
still doesn't fetch *.pot file. 

Thereby, $zanata push --push-trans mr.po ; doesn't work for me. 
zanata push exits with following error: 

Can not find source folder, please specify the source folder with '--srcdir' or 'dir' option


In above context:
1) How to get the source string OR *.pot file via zanata pull command ?
2) How to execute zanata push command ?


Additionally, i looked into http://zanata.org/docs/html-single/index.html but couldn't get much help.

Comment 3 Sean Flanigan 2011-09-16 06:42:34 UTC
1.

You can't get the POT file from Zanata.  You'll need to get it from the original source tree.  

Note: it's very important to make sure you import the latest POT file.  If you import an older POT file, you may accidentally remove strings which had previously been uploaded.  This is why POT upload is for project maintainers.  Unfortunately, it doesn't make it suitable for offline translation.


2.

I think in your case you may have specified a --srcdir which did exist, but contained no POT files.  It's a misleading error message in this case, but it should be improved in the next release.

Comment 4 sandeep shedmake 2011-09-19 04:15:32 UTC
(In reply to comment #3)
> 1.
> 
> You can't get the POT file from Zanata.  You'll need to get it from the
> original source tree.  
> 

Done. I got the POT file from original source tree.

> Note: it's very important to make sure you import the latest POT file.  If you
> import an older POT file, you may accidentally remove strings which had
> previously been uploaded.  This is why POT upload is for project maintainers. 
> Unfortunately, it doesn't make it suitable for offline translation.
> 

Yes, I am sure that I have latest POT file.  
Accordingly, I have translations 'mr.po' merged with latest POT file.

I have 'zanata push' privileges for 
https://translate.zanata.org/zanata/project/view/subscription-manager .

What is the zanata push command to import 'mr.po' to server ? 



Also, to import 'mr.po' do i need to configure 'zanata.xml' file located in the po directory in following manner:

[sshedmak@dhcp193-69 po]$ cat zanata.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
    <url>https://translate.zanata.org/zanata/</url> 
    <project>subscription-manager</project> 
    <project-version>0.96.X</project-version>
    <locales>
        <locale>mr</locale>
    </locales>
</config>

Comment 5 Sean Flanigan 2011-09-19 05:57:59 UTC
Check "zanata push -h" for help, but something like this should work:
 - zanata push --srcdir . --transdir . --push-trans --project-type gettext

Your zanata.xml looks okay to me.

Comment 6 sandeep shedmake 2011-09-19 06:41:16 UTC
(In reply to comment #5)
> Check "zanata push -h" for help, but something like this should work:
>  - zanata push --srcdir . --transdir . --push-trans --project-type gettext
>

Sean,

Yes, zanata push now works for me.
 
> Your zanata.xml looks okay to me.

Thanks for verifying it.


~/Sandeep

Comment 7 Sean Flanigan 2011-10-07 00:37:20 UTC
Once we resolve bug 742083 we should modify the security rules so that only translators in a given language team can upload translations for that locale.

Comment 8 sandeep shedmake 2012-03-13 05:52:22 UTC
(In reply to comment #7)
> Once we resolve bug 742083 we should modify the security rules so that only
> translators in a given language team can upload translations for that locale.

With Zanata version 1.5.0 (20120304-2134) release, is there a change in situation now so that only translators in a given language team can upload translations for that locale ?

Comment 9 James Ni 2012-04-20 02:52:37 UTC
Hi,

I just add this feature to python client, please retrieve the latest source code from git-hub and verify it. The command is "zanata push --project-type=podir --push-trans-only" for publican project. And "zanata push --project-type=gettext --push-trans-only" for software project. (Or specify project-type in zanata.xml). You can also use --transdir to specify the path of translation. 

Thanks

Comment 10 Joyce Chang 2012-04-20 06:18:21 UTC
Hi James,
I have tested it but didn't seemed to work for me, can you help look into it?

thanks,

zanata python client version: 1.3.4-18-gb3e6
test machine :http://zanata-empire.lab.eng.bne.redhat.com:8080

step 1:login in as username "test"  being a translator 
step 2:go to the folder where pot file is lcoated
step 3:open a terminal, issue:home/jochang/zanata-python-client/zanata push --project-type=gettext --push-trans-only  --url=http://zanata-empire.lab.eng.bne.redhat.com:8080/


expected result:pot file pushed successfully

actual result:
Loading zanata project config from: /home/jochang/test/ibus-chewing/zanata.xml
Overriding url of server with command line option
Loading zanata user config from: /home/jochang/.config/zanata.ini
zanata server: http://zanata-empire.lab.eng.bne.redhat.com:8080
zanata python client version: 1.3.4-18-gb3e6, zanata server API version: 1.6.0-alpha-2-SNAPSHOT
Project: IBusChewing
Version: master
Username: test
Source language: en-US
Copy previous translations:True
merge option set to value auto

Pushing zh_CN translation for IBusChewing to server:

Pushing the content of /home/jochang/test/ibus-chewing/po/ibus-chewing.pot to server:
error: This operation is not authorized, please check username and apikey

additional info:
zanata.xml


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
    <url></url>
    <project>IBusChewing</project>
    <project-type>gettext</project-type>
    <project-version>master</project-version>
    <locales>
        <locale map-from="zh_CN">zh-Hans</locale>
    </locales>
</config>




I have cross-checked where my username and apikey actually matched but same error still returned so i log in as admin and tested it again with modified username and apikey in Zanata.ini to be matched on test machine, please see result as below:

Loading zanata project config from: /home/jochang/test/ibus-chewing/zanata.xml
Overriding url of server with command line option
Loading zanata user config from: /home/jochang/.config/zanata.ini
zanata server: http://zanata-empire.lab.eng.bne.redhat.com:8080
zanata python client version: 1.3.4-18-gb3e6, zanata server API version: 1.6.0-alpha-2-SNAPSHOT
Project: IBusChewing
Version: master
Username: admin
Source language: en-US
Copy previous translations:True
merge option set to value auto

Pushing zh_CN translation for IBusChewing to server:

Pushing the content of /home/jochang/test/ibus-chewing/po/ibus-chewing.pot to server:
error: Unexpected Status, failed to push translation to zanata server

Comment 11 James Ni 2012-04-23 03:09:05 UTC
Hi Joyce,

Thanks for your testing, i make some commit to git-hub to fix these issues. Please check out the latest source code to test. 

I think currently translator still could not push translations to server, but project maintainer could. I have test on my local machine, it is ok for project maintainer to push translation to server. I think the security rules will be modified soon.

By the way, the client will give a error message and stop processing if there is no source files on server.

Comment 12 Joyce Chang 2012-04-24 00:28:59 UTC
verified with Zanata python client version: 1.3.4-21-g1594

test case:
project maintainer push translation to sever 

actions:
step 1:login in as "test", being a project maintainer
step 2:go to the folder where pot/po files are lcoated
step 3: open a terminal, issue command:home/jochang/zanata-python-client/zanata push --push-trans

expected result:
Successfully pushed translation to the Zanata server

actual result:
Pushing the content of /home/jochang/test/ibus-chewing/po/ibus-chewing.pot to server:
Successfully updated template po/ibus-chewing on the server
Pushing zh-TW translation for po/ibus-chewing to server:
Successfully pushed translation /home/jochang/test/ibus-chewing/po/zh_TW.po to the Zanata server
Pushing zh_CN translation for po/ibus-chewing to server:
Successfully pushed translation /home/jochang/test/ibus-chewing/po/zh_CN.po to the Zanata server

Comment 13 Sean Flanigan 2012-04-24 06:12:36 UTC
We still need to implement the change to the security rules, so that translators can upload without becoming project maintainers.

Comment 14 Carlos Munoz 2012-04-26 06:07:24 UTC
Changed the security rules so that translators can both upload their PO files from the GUI, or push translations using the clients.

See:
https://github.com/zanata/zanata/commit/ce9ad1956fc34aafd8452004ab735741a1986e0e

Comment 15 Carlos Munoz 2012-04-30 23:45:20 UTC
Translators can now push translations for individual locales with the -Dzanata.locales option. (example usage: -Dzanata.locales=en,es-ES,en-US). The specified locales must be a subset of those present in zanata.xml, and may be the mapped locale or the "local" locale.

Also, the -Dzanata.pushTrans option is now deprecated and is replaced by -Dzanata.pushType which can take the following values:

source = Push source documents only (This is the default value when not specified)
trans = Push translations only
both = Push both source documents and translations

If the pushTrans option is used, it will be equivalent to using -Dzanata.pushType=both

See also:
https://github.com/zanata/zanata-client/commit/8c9762f5e302ea0918950ce427fa78bb0a4c5029
https://github.com/zanata/zanata-client/commit/9a4be04b300a302cec489fb29738974838281040
https://github.com/zanata/zanata/commit/bad3aadd1eecfcb7de3dc4fd75424942755ef6ff
https://github.com/zanata/zanata/commit/5d4b170c97a91eac795f5ec37ee767caaeb9140a

Comment 16 Joyce Chang 2012-05-02 05:20:42 UTC
verified with maven client 1.6.0-alpha-3-SNAPSHOT

Comment 17 Patrick Huang 2012-06-06 01:27:55 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
Translator can push translations using zanata client.

Consequence
Only project maintainer or admin can push translations but not translators so offline translation is not possible.

Change
Translators can now push translations for individual locales with the -Dzanata.locales option. (example usage: -Dzanata.locales=en,es-ES,en-US). The specified locales must be a subset of those present in zanata.xml, and may be the mapped locale or the "local" locale.

Also, the -Dzanata.pushTrans option is now deprecated and is replaced by -Dzanata.pushType which can take the following values:

source = Push source documents only (This is the default value when not specified)
trans = Push translations only
both = Push both source documents and translations

If the pushTrans option is used, it will be equivalent to using -Dzanata.pushType=both

Result
Offline translation can be done with zanata client.

Comment 18 Carlos Munoz 2012-06-06 01:38:32 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,5 +1,5 @@
 Cause
-Translator can push translations using zanata client.
+Translators cannot currently push translations using zanata client.
 
 Consequence
 Only project maintainer or admin can push translations but not translators so offline translation is not possible.
@@ -13,7 +13,7 @@
 trans = Push translations only
 both = Push both source documents and translations
 
-If the pushTrans option is used, it will be equivalent to using -Dzanata.pushType=both
+If the now deprectated pushTrans option is used, it will be equivalent to using -Dzanata.pushType=both
 
 Result
 Offline translation can be done with zanata client.


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