Bug 732576

Summary: Show proper warning message when pushing unsupported locales, instead of "Unexpected error"
Product: [Retired] Zanata Reporter: Ding-Yi Chen <dchen>
Component: Component-PythonClientAssignee: James Ni <jni>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.4-RCCC: sflaniga, zanata-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-04 02:58:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ding-Yi Chen 2011-08-23 01:13:56 UTC
Description of problem:
When pushing message with message context, zanata-python-client producing following error:
warning: encountered msgctxt; not currently supported

warning: encountered msgctxt; not currently supported

warning: encountered msgctxt; not currently supported

error: Unexpected Status, failed to push


Version-Release number of selected component (if applicable):
commit 488aac595d9168f5ec227e595dd3b9f53dbd2fc5

1.2.5-20-g8462


How reproducible:
Always

Steps to Reproduce:
1. git clone git://github.com/definite/ibus-chewing.git
2. cd ibus-chewing/po
3. Generate ibus-chewing.pot by:
xgettext --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 -s --package-name=ibus-chewing --package-version=master -o ibus-chewing.pot ../src/*.c ../src/*.go

4. Edit following as zanata.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<config xmlns="http://zanata.org/namespace/config/">

    <url>http://flies-devel.englab.bne.redhat.com/zanata-test/</url>

    <project>IBusChewing</project>

    <project-version>master</project-version>

    <locales>

        <locale map-from="zh_CN">zh-Hans</locale>

        <locale map-from="zh_TW">zh-Hant</locale>
    </locales>

</config>

5. zanata push --project-type=gettext

Actual results:
Error messages:
warning: encountered msgctxt; not currently supported
warning: encountered msgctxt; not currently supported
warning: encountered msgctxt; not currently supported
error: Unexpected Status, failed to push

Expected results:
Successfully pushed but with warning.

Comment 1 Ding-Yi Chen 2011-08-23 01:38:59 UTC
Sorry, the trailing 'b' was missing in the step 3,
so the revised step 3 is:

3. xgettext --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2
--keyword=NC_:1c,2 -s --package-name=ibus-chewing --package-version=master -o
ibus-chewing.pot ../src/*.c ../src/*.gob

Comment 2 Ding-Yi Chen 2011-08-23 02:05:48 UTC
Hmm, now it seems pushing successfully. :-/

I will put needinfo to myself until either it reappears or it disappears for one month.

Comment 3 Ding-Yi Chen 2011-09-20 07:13:08 UTC
Aha, this "bug" is actually not about msgctxt, but caused by unsupported locale.

That is, this bug occurs when zanata.xml contains following:
<locale map-from="zh_TW">zh-Hant</locale>
<locale map-from="zh_CN">zh-Hans</locale>

but server instead supports "zh-Hant-TW" and "zh-Hans-CN".

So this bug is actually for pushing unsupported locales.

Description of problem:
Pushing translation in unsupported locale caused following error: 
Unexpected Status, failed to push translation to zanata server.

User can have better clue if a warning message looks like
"Locale XXX is not supported by Zanata server, skip pushing."

Version-Release number of selected component (if applicable):
1.3.0


How reproducible:
Always

Steps to Reproduce:
1. git clone git://github.com/definite/ibus-chewing.git
2. cd ibus-chewing/po
3. Generate ibus-chewing.pot by:
xgettext --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2
--keyword=NC_:1c,2 -s --package-name=ibus-chewing --package-version=master -o
ibus-chewing.pot ../src/*.c ../src/*.go

4. Edit following as zanata.xml, make sure the locales are invalid, such like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
    <url>http://flies-devel.englab.bne.redhat.com/zanata-test/</url>
    <project>IBusChewing</project>
    <project-version>master</project-version>
    <locales>
        <locale map-from="zh_CN">zh-HS</locale>
        <locale map-from="zh_TW">zh-HT</locale>
    </locales>
</config>

5. zanata push --project-type=gettext

Actual results:
Error messages:
"Unexpected Status, failed to push translation to zanata server."

Expected results:
Warning messages:
"Locale XXX is not supported by Zanata server, skip pushing."

Comment 4 James Ni 2011-09-20 07:32:06 UTC
Hi,
I have modified error message in commit 067b184 several days ago, sorry i didn't announce that, please use the latest code on git-hub to verify it.

Actually, the error message returned from server is "Locale XXX is not enabled on this server. Please contact admin.", so i display this message to user directly, and even you gave a wrong locale name that never exist, like --lang=blabla, the sever still return a error message for "Locale blabla is not enabled on this server. Please contact admin." 

Also, warning message for msgctxt still there: "warning: encountered msgctxt; not currently supported" still there, i use fedora 14 to test.

Comment 5 Ding-Yi Chen 2011-09-20 23:15:39 UTC
Since we do currently support msgctxt yet, so the warning message 
"warning: encountered msgctxt; not currently supported" is acceptable.

Comment 6 Ding-Yi Chen 2011-09-21 00:32:05 UTC
VERIFIED with commit 2c477843248a4a7ba03840c341824b856c433e0a

Comment 7 Sean Flanigan 2011-10-28 08:19:42 UTC
That commit doesn't seem to exist: https://github.com/zanata/zanata-python-client/commit/2c477843248a4a7ba03840c341824b856c433e0a

Did this fix make it into 1.3.1?

Comment 8 James Ni 2011-11-01 08:04:23 UTC
Hi Sean,

Sorry, the commit for this issue should be 067b184, you can find it at:
https://github.com/zanata/zanata-python-client/commit/067b184f88fcf7592380d9cf8b56017c48bda31f

This issue have not included in 1.3.1, i will included it in upcoming 1.3.2, i will close it when i 1.3.2 is released.

Thanks