Red Hat Bugzilla – Bug 727386
zanata po push does not assume working directory
Last modified: 2014-10-19 18:59:14 EDT
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.124 Safari/534.30
When I run zanata po push in a directory with a .pot file, the python client complains that it can't find the source folder.
I have to run
zanata po push --srcdir .
It should assume .
Steps to Reproduce:
1. Run "zanata po push" in a folder containing zanata.xml and "something.pot"
get an error "error: Can not find source folder, please specify the source folder with '--srcdir' option"
It should assume "--srcdir ." by default
Thanks, actually i assume that user running command in folder containing zanata.xml and a folder named po which contain "something.pot" and "something.po". I agree with you, it should assume "--srcdir ." by default. I will change source code.
Actually, to keeps backwards compatibility, we need to keep --srcdir's default as "./po" in 'zanata po push'.
However, we should change the default for --srcdir in the new generic command 'zanata push' to be ".", ie current directory. The same goes for --transdir and for the new command 'zanata pull'.
Keep the current behaviour, add searching the current working directory if it is not found in a ./po directory.
So it would behave the as expected for existing users who are used to the previous behaviour, and would also work for people who put the zanata.xml file in the same directory as the .pot file.
That would be forwards-compatible as well, because the new zanata push could replicate that search pattern.
I think it would help a lot if the helptext mentioned the default value for each option, especially for --srcdir. If we do that, describing even a simple search algorithm becomes a pain. (And even simple search algorithms add a little complexity, and need testing.)
Also it wouldn't really make sense for a generic push/pull to look at a directory named "po", since it's supposed to be generic. Eventually it will be pushing and pulling other file formats, not just gettext.
We do plan to deprecate the old publican/po push/pull before much longer.
I have modified source code for srcdir processing in commit 4ea63b:
1)First, checking the '.', if finding pot files, then srcdir point to '.'.
2)Then, if can not find pot files under current path, check the pot/po folder under current path, if finding pot files, then srcdir point to pot/po folder
3)At last, if can not find pot files in both case, give a error to user that can not find the source files.
For --transdir, the default value is '.' for the command 'zanata pull'.
For 'zanata po push', i assume transdir default value is equal to srcdir value, because normally they are in the same folder for the software project. For 'zanata publican push', i set transdir default value to '.'
I have test these on my local machine, it seems working fine.
James, what you've done is fine for "zanata po push", but the generic "zanata push" should look only in $srcdir, NOT in $srcdir/po.
The reason for this is to be symmetrical with "zanata pull", which defaults to current directory when writing.
Thus, "zanata push" will push from "." by default, and "zanata pull" will pull to "." by default.
I am trying to push po file to publican-ug on zanata web site.
I copy Italian config xml file in my directory. I done:
$ zanata pull --lang it --project-type podir
I copied my translated file and trying to push the translation to zanata website I have got every times:
error: Can not find source folder, please specify the source folder with '--srcdir' or 'dir' option
exactly explained in the first comment.
$ rpm -q zanata-python-client
Could you provides an rpm update? Thank you.
This bug is about the "po push" command, which is deprecated in favour of the generic "push" command. http://www.redhat.com/mailman/listinfo/zanata-users is probably the best place to discuss this, but...
Unfortunately, the Zanata server currently doesn't allow translators to push PO files from the command line, only project maintainers (and only together with the POT files).
The current command-line push feature is designed to allow project maintainers to push the source language (English) and import any *pre-existing* translations. New translation work should be done in Zanata's web editor.
Thanks Sean for your reply. I hope you can upgrade the zanata server. Sometime for translators are easiest to translate locally and then push their po files...
I have modified source code base on Sean's comment, "zanata push" will push from "." by default, and "zanata pull" will pull to "." by default. This change is included in version 1.3.4 of zanata-python-client.
Please use "yum install zanata-python-client --enablerepo=updates-testing" to install and test the new version
VERIFIED with 1.3.4