wichert / po-xls Goto Github PK
View Code? Open in Web Editor NEWUse xls files to update translations
Use xls files to update translations
Hi, i really would like to see this on pypi. Can we do a release?
Hello, I'm trying to use your program but I run into this error :
$ po-to-xls en_GB.po
Traceback (most recent call last):
File "/usr/local/bin/po-to-xls", line 11, in <module>
load_entry_point('poxls==1.4.2', 'console_scripts', 'po-to-xls')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 564, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2662, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2316, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2322, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "build/bdist.linux-x86_64/egg/poxls/po_to_xls.py", line 6, in <module>
ImportError: No module named dump_worksheet
After some googling it seems this module is a part of : openpyxl, which I have installed :
$ sudo pip install openpyxl
Requirement already satisfied: openpyxl in /usr/local/lib/python2.7/dist-packages/openpyxl-2.5.0a3-py2.7.egg
Requirement already satisfied: et_xmlfile in /usr/local/lib/python2.7/dist-packages/et_xmlfile-1.0.1-py2.7.egg (from openpyxl)
Requirement already satisfied: jdcal in /usr/local/lib/python2.7/dist-packages/jdcal-1.3-py2.7.egg (from openpyxl)
Would you have an idea on how to solve the problem? I am Using : Debian GNU/Linux buster/sid 64-bit
ahoy there @wichert ,
first of: thank you for this tool :)
secondly: I wrote a tiny pyproject.toml for it because I like handling my venvs with poetry
. I figured maybe you're interested in it:
[tool.poetry]
name = "poxls"
version = "1.5.0"
description = "Convert between Excel and PO files"
authors = ["Wichert Akkerman <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.6"
click = "*"
polib="*"
openpyxl="*"
[tool.poetry.scripts]
po-to-xls="poxls.po_to_xls:main"
xls-to-po="poxls.xls_to_po:main"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
I skipped a bunch of the other fields because they were irrelevant for my needs but you could easily just add them (https://python-poetry.org/docs/pyproject/)
this way all I do is poetry install
and I have an extra environment (poetry shell
) where I have access to the scripts po-to-xml
and suchlike directly from within PATH
.
cheers 👋
It would be nice to allow xls-to-po
to skip processing specific sheets.
We have an use case where we use spreadsheets and formulas are used to autocomplete translations. And we would want to ignore those sheets from the export process.
I noticed that when having a duplicate (msgid), but with different context (msgctxt). The second msgid is not put in the excel sheet
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Language: nl\n"
"X-Source-Language: en\n"
"X-Qt-Contexts: true\n"
msgctxt "Context1"
msgid "test1"
msgstr "Test één"
msgctxt "Context2"
msgid "test1"
msgstr "Test twee"
When using xls-to-po
, the exported .po file does not contain the source code comments whereas po-to-xls
perfectly transfers the source code comments from PO to Excel.
I have no experience with Python, but from what I can make out from the source code, it looks to me as if ColumnHeaders.comment
was simply forgot here? I would like to submit a PR but I don't even know Python, so this is a lost cause.
Lines 64 to 66 in 24b7c5c
Many thanks for your time.
guys , thank you for this. seems like exactly what I am looking for.
so I downloaded the code, and I went to cmd on the folder. but I am probably missing one more step before I actually can run the command. (the PC doesn't identify my command).
what do I need to do in order to "install" the command into the PC?
Hi again,
you might want to add a LICENSE file to the github repo to make more obvious the code is BSD-licensed (it took me a few minutes to remember to look for the license in the setup.py file)
Hi,
Just looking at your code and installing with in my pip requirements with "git+https://github.com/wichert/[email protected]" displays "Successfully installed poxls-1.5.0" because the version hardcoded in https://github.com/wichert/po-xls/blob/master/setup.py#L4 is not up to date
Installing with "pip install poxls" displays "Successfully installed poxls-1.6.2"
I am unable to compile this as I am not a python user. The most frustrating thing is that I remember getting it work on an older Windows computer.
Is it a feasible option to provide pre-built binaries for operating systems like Windows?
Or at least a short walkthrough on how to build this?
Hello,
since this is my first ever installed python package, i think i've done something wrong on my side?
But i get this error message:
C:\Data\wap\htdocs\data\language>po-to-xls en.po
Writing catalog to sheet [------------------------------------] 1%
Traceback (most recent call last):
File "c:\data\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\data\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Data\Python27\Scripts\po-to-xls.exe\__main__.py", line 9, in <module>
File "c:\data\python27\lib\site-packages\click\core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "c:\data\python27\lib\site-packages\click\core.py", line 680, in main
rv = self.invoke(ctx)
File "c:\data\python27\lib\site-packages\click\core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\data\python27\lib\site-packages\click\core.py", line 508, in invoke
return callback(*args, **kwargs)
File "c:\data\python27\lib\site-packages\poxls\po_to_xls.py", line 119, in mai
n
sheet.append(row)
File "c:\data\python27\lib\site-packages\openpyxl\writer\write_only.py", line
185, in append
raise ValueError
ValueError
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "c:\data\python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\data\python27\lib\site-packages\openpyxl\writer\write_only.py", line
39, in _openpyxl_shutdown
os.remove(path)
WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie
von einem anderen Prozess verwendet wird: 'c:\\users\\kecmar\\appdata\\local\\te
mp\\openpyxl.ko9s6p'
Error in sys.exitfunc:
Traceback (most recent call last):
File "c:\data\python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\data\python27\lib\site-packages\openpyxl\writer\write_only.py", line
39, in _openpyxl_shutdown
os.remove(path)
WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie
von einem anderen Prozess verwendet wird: 'c:\\users\\kecmar\\appdata\\local\\te
mp\\openpyxl.ko9s6p'
The problem seems to be: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'c:\\users\\kecmar\\appdata\\local\\te mp\\openpyxl.ko9s6p'
Any ideas?
Hello Wichert, po-xls is an amazing tool, very useful for my translation projects !
Thank you for creating it !
I would like to change a few things when I convert a PO file to XLS spreadsheet.
-change the name of the spreadsheet that is created by your tool by the name of the PO file ( ex : FILE.po becomes FILE.xls)
-the tab name of the spreadsheet is currently "Translations", I want it to be "Sheet1"
-remove the column A (I don't need it)
-delete all the content of line 1
I attached a XLS file showing how your tool should work according to my changes.
FILE.xlsx
How should I proceed to make these changes ?
Currently, if convert to Excel, and converted back from a PO-file, all the comment information will disappears. I wish they could keep them all in new PO-file .
Hello Wichert ,
When I use "po-xls" by step 3, I meet a problem. The reason maybe some packages‘ version changed. Cloud you have a look or finger out my mistake?
My Steps:
Detail for Step 2:
MacBook-Pro:po-xls-master miao$ sudo python setup.py install
Password:
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating src/poxls.egg-info
writing requirements to src/poxls.egg-info/requires.txt
writing src/poxls.egg-info/PKG-INFO
writing top-level names to src/poxls.egg-info/top_level.txt
writing dependency_links to src/poxls.egg-info/dependency_links.txt
writing entry points to src/poxls.egg-info/entry_points.txt
writing manifest file 'src/poxls.egg-info/SOURCES.txt'
reading manifest file 'src/poxls.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/poxls.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.11-intel/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/poxls
copying src/poxls/__init__.py -> build/lib/poxls
copying src/poxls/po_to_xls.py -> build/lib/poxls
copying src/poxls/xls_to_po.py -> build/lib/poxls
creating build/bdist.macosx-10.11-intel
creating build/bdist.macosx-10.11-intel/egg
creating build/bdist.macosx-10.11-intel/egg/poxls
copying build/lib/poxls/__init__.py -> build/bdist.macosx-10.11-intel/egg/poxls
copying build/lib/poxls/po_to_xls.py -> build/bdist.macosx-10.11-intel/egg/poxls
copying build/lib/poxls/xls_to_po.py -> build/bdist.macosx-10.11-intel/egg/poxls
byte-compiling build/bdist.macosx-10.11-intel/egg/poxls/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/poxls/po_to_xls.py to po_to_xls.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/poxls/xls_to_po.py to xls_to_po.pyc
creating build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/PKG-INFO -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/SOURCES.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/dependency_links.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/entry_points.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/requires.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/top_level.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying src/poxls.egg-info/zip-safe -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
creating dist
creating 'dist/poxls-1.4.0.dev.0-py2.7.egg' and adding 'build/bdist.macosx-10.11-intel/egg' to it
removing 'build/bdist.macosx-10.11-intel/egg' (and everything under it)
Processing poxls-1.4.0.dev.0-py2.7.egg
Copying poxls-1.4.0.dev.0-py2.7.egg to /Library/Python/2.7/site-packages
Adding poxls 1.4.0.dev.0 to easy-install.pth file
Installing po-to-xls script to /usr/local/bin
Installing xls-to-po script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/poxls-1.4.0.dev.0-py2.7.egg
Processing dependencies for poxls==1.4.0.dev.0
Searching for openpyxl
Reading https://pypi.python.org/simple/openpyxl/
Best match: openpyxl 2.4.0
Downloading https://pypi.python.org/packages/7e/75/9bb309f80e4f75d139ecc55e9edf65c5844336b5a84966a609267255f961/openpyxl-2.4.0.tar.gz#md5=e3376d1fce0681fd0b4047ab89218af4
Processing openpyxl-2.4.0.tar.gz
Writing /tmp/easy_install-_d4MeS/openpyxl-2.4.0/setup.cfg
Running openpyxl-2.4.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_d4MeS/openpyxl-2.4.0/egg-dist-tmp-WRGDKC
no previously-included directories found matching 'openpyxl/tests'
no previously-included directories found matching 'openpyxl/sample'
no previously-included directories found matching 'openpyxl/benchmarks'
no previously-included directories found matching 'openpyxl/develop'
warning: no previously-included files matching 'test_*.py' found under directory 'openpyxl'
warning: no previously-included files matching 'tests/*.py' found under directory 'openpyxl'
zip_safe flag not set; analyzing archive contents...
openpyxl.__init__: module references __file__
Adding openpyxl 2.4.0 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/openpyxl-2.4.0-py2.7.egg
Searching for polib
Reading https://pypi.python.org/simple/polib/
Best match: polib 1.0.7
Downloading https://pypi.python.org/packages/45/1e/ba9e219d8dafc535075d5824148f64617db781821ba2d1e08a6a10210194/polib-1.0.7.tar.gz#md5=94ed30c8a4d38c6d1026c1d4881bf84f
Processing polib-1.0.7.tar.gz
Writing /tmp/easy_install-WutjYc/polib-1.0.7/setup.cfg
Running polib-1.0.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-WutjYc/polib-1.0.7/egg-dist-tmp-hJCzGW
no previously-included directories found matching 'docs/_build'
zip_safe flag not set; analyzing archive contents...
Adding polib 1.0.7 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/polib-1.0.7-py2.7.egg
Searching for click
Reading https://pypi.python.org/simple/click/
Best match: click 6.6
Downloading https://pypi.python.org/packages/7a/00/c14926d8232b36b08218067bcd5853caefb4737cda3f0a47437151344792/click-6.6.tar.gz#md5=d0b09582123605220ad6977175f3e51d
Processing click-6.6.tar.gz
Writing /tmp/easy_install-Sjk0sE/click-6.6/setup.cfg
Running click-6.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Sjk0sE/click-6.6/egg-dist-tmp-AXyLPk
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
zip_safe flag not set; analyzing archive contents...
click.core: module references __file__
Adding click 6.6 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/click-6.6-py2.7.egg
Searching for et-xmlfile
Reading https://pypi.python.org/simple/et_xmlfile/
Best match: et-xmlfile 1.0.1
Downloading https://pypi.python.org/packages/22/28/a99c42aea746e18382ad9fb36f64c1c1f04216f41797f2f0fa567da11388/et_xmlfile-1.0.1.tar.gz#md5=f47940fd9d556375420b2e276476cfaf
Processing et_xmlfile-1.0.1.tar.gz
Writing /tmp/easy_install-7GKwyg/et_xmlfile-1.0.1/setup.cfg
Running et_xmlfile-1.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7GKwyg/et_xmlfile-1.0.1/egg-dist-tmp-PfMIfv
zip_safe flag not set; analyzing archive contents...
et_xmlfile.tests.common_imports: module references __file__
Adding et-xmlfile 1.0.1 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/et_xmlfile-1.0.1-py2.7.egg
Searching for jdcal
Reading https://pypi.python.org/simple/jdcal/
Best match: jdcal 1.3
Downloading https://pypi.python.org/packages/9b/fa/40beb2aa43a13f740dd5be367a10a03270043787833409c61b79e69f1dfd/jdcal-1.3.tar.gz#md5=885ba61d28992f26acffec131bd2a17e
Processing jdcal-1.3.tar.gz
Writing /tmp/easy_install-NfaHhV/jdcal-1.3/setup.cfg
Running jdcal-1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-NfaHhV/jdcal-1.3/egg-dist-tmp-K5nvgv
zip_safe flag not set; analyzing archive contents...
Adding jdcal 1.3 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/jdcal-1.3-py2.7.egg
Finished processing dependencies for poxls==1.4.0.dev.0
Detail for Step 3:
MacBook-Pro:po-xls-master miao$ po-to-xls django.po
Traceback (most recent call last):
File "/usr/local/bin/po-to-xls", line 9, in <module>
load_entry_point('poxls==1.4.0.dev.0', 'console_scripts', 'po-to-xls')()
File "/Library/Python/2.7/site-packages/click-6.6-py2.7.egg/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click-6.6-py2.7.egg/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/Library/Python/2.7/site-packages/click-6.6-py2.7.egg/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/2.7/site-packages/click-6.6-py2.7.egg/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "build/bdist.macosx-10.11-intel/egg/poxls/po_to_xls.py", line 63, in main
TypeError: __init__() got an unexpected keyword argument 'guess_types'
MacBook-Pro:po-xls-master miao$ pip freeze
altgraph==0.10.2
bdist-mpkg==0.5.0
bonjour-py==0.3
click==6.6
et-xmlfile==1.0.1
jdcal==1.3
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
numpy==1.8.0rc1
openpyxl==2.4.0
polib==1.0.7
poxls==1.4.0.dev0
py2app==0.7.3
pyobjc-core==2.5.1
pyobjc-framework-Accounts==2.5.1
pyobjc-framework-AddressBook==2.5.1
pyobjc-framework-AppleScriptKit==2.5.1
pyobjc-framework-AppleScriptObjC==2.5.1
pyobjc-framework-Automator==2.5.1
pyobjc-framework-CFNetwork==2.5.1
pyobjc-framework-Cocoa==2.5.1
pyobjc-framework-Collaboration==2.5.1
pyobjc-framework-CoreData==2.5.1
pyobjc-framework-CoreLocation==2.5.1
pyobjc-framework-CoreText==2.5.1
pyobjc-framework-DictionaryServices==2.5.1
pyobjc-framework-EventKit==2.5.1
pyobjc-framework-ExceptionHandling==2.5.1
pyobjc-framework-FSEvents==2.5.1
pyobjc-framework-InputMethodKit==2.5.1
pyobjc-framework-InstallerPlugins==2.5.1
pyobjc-framework-InstantMessage==2.5.1
pyobjc-framework-LatentSemanticMapping==2.5.1
pyobjc-framework-LaunchServices==2.5.1
pyobjc-framework-Message==2.5.1
pyobjc-framework-OpenDirectory==2.5.1
pyobjc-framework-PreferencePanes==2.5.1
pyobjc-framework-PubSub==2.5.1
pyobjc-framework-QTKit==2.5.1
pyobjc-framework-Quartz==2.5.1
pyobjc-framework-ScreenSaver==2.5.1
pyobjc-framework-ScriptingBridge==2.5.1
pyobjc-framework-SearchKit==2.5.1
pyobjc-framework-ServiceManagement==2.5.1
pyobjc-framework-Social==2.5.1
pyobjc-framework-SyncServices==2.5.1
pyobjc-framework-SystemConfiguration==2.5.1
pyobjc-framework-WebKit==2.5.1
pyOpenSSL==0.13.1
pyparsing==2.0.1
python-dateutil==1.5
pytz==2013.7
scipy==0.13.0b1
selenium==3.0.0b2
six==1.4.1
xattr==0.6.4
xlrd==1.0.0
xlwt==1.0.0
zope.interface==4.1.1
MacBook-Pro:po-xls-master miao$ python --version
Python 2.7.10
Thanks,
Peng
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.