Coder Social home page Coder Social logo

poautofill's Introduction

poautofill

Script to automatically translate a given po file. It currently only uses https://deepl.com but should be extended to use other sources.

It only translates empty translations, and mark them as fuzzy so you can easily spot them for mandatory review.

This project is not aimed to automatically translate files for use in production, more to give some material for translators while translating offline, like missing vocabulary.

Usage:

poautofill any_file.po
# processes any_file.po

poautofill -h
# displays help
  • Free software: MIT license

Contributing

Don't forget to test locally:

$ pip install -e .[dev]
$ detox

poautofill's People

Contributors

julienpalard avatar christophenan avatar deronnax avatar

Stargazers

Mansour Mahboubi avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

poautofill's Issues

poautofill does not write content if stopped

If interrupted, poautofill breaks out of mainloop and po.write() never get executed, and all the received translated text is lost. Which is a problem because poautofill takes a lot of time on the average python .po file

JSONDecodeError on cpython library/os.po

$ poautofill library/os.po
Traceback (most recent call last):
  File "/usr/local/bin/poautofill", line 11, in <module>
    sys.exit(fill_pos())
  File "/Users/mdupuy/Library/Python/3.7/lib/python/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/mdupuy/Library/Python/3.7/lib/python/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/mdupuy/Library/Python/3.7/lib/python/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/mdupuy/Library/Python/3.7/lib/python/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/poautofill/poautofill.py", line 71, in fill_pos
    fill_po(po_file, verbose, target_lang)
  File "/usr/local/lib/python3.7/site-packages/poautofill/poautofill.py", line 55, in fill_po
    entry.msgstr = deepl(entry.msgid, target_lang)
  File "/usr/local/lib/python3.7/site-packages/poautofill/poautofill.py", line 35, in deepl
    "id": 36,
  File "/Users/mdupuy/Library/Python/3.7/lib/python/site-packages/requests/models.py", line 896, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.