-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couple issues with Web2py converter #3254
Comments
I see something similar using python-translate version 2.0.0-1 in Debian stable. When trying to use web2py2po and po2web2py with the translations in https://github.com/OneZoom/OZtree , the tools fail to work. First, trying to create a po file fail like this:
Next, after using my own tool to convert from .py to .py, converting
Is the web2py handling completely broken? |
Looking at the gist, this seem to be the relevant change: --- /usr/lib/python2.7/dist-packages/translate/convert/web2py2po.py 2017-01-27 20:51:52.000000000 +0100
+++ web2py2po.py 2018-12-18 08:44:51.392384401 +0100
@@ -46,7 +46,7 @@
targetheader.addnote("extracted from web2py", "developer")
for source_str in mydict.keys():
- target_str = mydict[source_str]
+ target_str = mydict[source_str].decode('utf-8')
if target_str == source_str:
# a convention with new (untranslated) web2py files
target_str = u''
@@ -59,7 +59,7 @@
return self.mypofile
-def convertpy(inputfile, outputfile, encoding="UTF-8"):
+def convertpy(inputfile, outputfile, encoding="UTF-8", **kwargs):
new_pofile = po.pofile()
convertor = web2py2po(new_pofile) |
My issue is also reported to Debian as https://bugs.debian.org/916745 . Note, my testing show that the patch help. I also patched the "mydict = eval(inputfile.read())" line to "mydict = eval(inputfile.read().decode('utf-8'))" to avoid a python warning about not being able to compare two strings. |
Not quite sure the tests are working yet. Fixes translate#3254
The #3838 pull request also try to fix this issue. |
Any hope to have this problem fixed in master? |
I am happy to discover that the issue is fixed in Debian (in version 2.3.1-3), at least. I tested the new version there today, and it seem to work well. I hope it will get fixed up stream too, soon. |
This makefile allow the web2py translations to be maintained as gettext po files to make easier for translators. These rules assume the en-us.py file is generated from source and contain every translatable string in the application. It further ignore the default.py and plural-*.py files, because I do not know how to best handle them as po files. Too migrate once from py to po files, run this: make migrate oztree.pot pofiles clean To generate py files for use when building, run make To see translation status, run make stats You need a version of Translation Toolkit where translate/translate#3254 is fixed, for example the version from Debian. Related to issue OneZoom#138.
Is this code no longer mantained. There seem to be no response from any maintainer for four years? |
Fixed with code from PR #3838 landed in master. |
I just tried using the Web2py converter and it seems to have a couple of issues:
In any case, I have made a couple changes and now it works, at least for me - but since I haven't done any proper testing, I don't feel like creating an actual pull request. On the other hand, maybe somebody else can take advantage of this, so here's a gist with the changes I made to web2py2po.py
https://gist.github.com/pgcd/52338762bdcb4728cd39
The text was updated successfully, but these errors were encountered: