View Single Post
Old 08-23-2014, 09:45 AM   #33
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,024
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by kovidgoyal View Post
transifex has a command line client that might be able to do it. It will probably download all .po file and then you can use msgfmt --statistics to filter out those without translations.
I've been using their 'tx' command tool to semi-automatically pull translations for my plugins. First I setup a .tx/config file in the plugin source directory I run my script from:

Code:
[main]
host = https://www.transifex.com

[calibre-plugins.fanfictiondownloader]
file_filter = translations/<lang>.po
source_lang = en
type = PO
Then I have a dos/windows batch file I run:

Code:
set PYTHONIOENCODING=UTF-8
c:\Python27\tx.exe pull --minimum-perc=90 -f -a

cd translations
for %%f in (*.po) do (
    "C:\Program Files (x86)\Calibre2\calibre-debug.exe" -c "from calibre.translations.msgfmt import main; main()" %%~nf
)

cd ..
That specifies only languages that are 90% or more complete and uses calibre to convert them to .mo files. I have different config files and translation directories for each plugin.

Since I also setup Transifix to automatically update from the .pot files in my source repositories, that's all I need to do, aside from check for new translations periodically.
JimmXinu is offline   Reply With Quote