Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 10-14-2013, 07:40 AM   #1
Ptitprince
Member
Ptitprince began at the beginning.
 
Ptitprince's Avatar
 
Posts: 16
Karma: 10
Join Date: Dec 2012
Device: Kobo Aura
Lightbulb French translation

Hello everyone or good evening ,

First of all, thank you for your enormous work !!

I have a small proposal/question concerning the translation of the plugins of calibre in French. I make each week the translation of the innovations of calibre on Launchpad and I belong to a French-speaking forum where many users use calibre. These users do not speak english and have large difficulty of being autonomous in calibre when they use the plugins. I wondered whether there is average to help you in the translations of your plugins in French language and how we could work together if it is possible.

Yours sincerely


Ptitprince
Ptitprince is offline   Reply With Quote
Old 10-14-2013, 08:34 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You'd have to ask individual plugin authors to include their translation with their plugins and load them at initialization time. calibre itself cannot keep translations for third party plugins.

Essentially what a plugin developer has to do is create a .po file from the strings in his plugin and upload it to launchpad/transifex or whatever. Then distribute the .mo files containing the translated strings inside the plugin zip file.

If you can get some plugin authors who are willing to do that, I will be happy to add some functionality to calibre to make it easy for them to load the .mo files from the plugin zip file.
kovidgoyal is offline   Reply With Quote
Advert
Old 10-14-2013, 06:05 PM   #3
Ptitprince
Member
Ptitprince began at the beginning.
 
Ptitprince's Avatar
 
Posts: 16
Karma: 10
Join Date: Dec 2012
Device: Kobo Aura
Good evening,

Thank you for your so fast answer, I understand well that it is necessary to ask the developers to place the files necessary to the translations at the disposal. I will thus get in touch with those to start the machine .
In attachment a French translation of the assistance of Modify Epub.

Yours sincerely

Ptitprince
Attached Files
File Type: zip Modify ePub Aide FR.zip (26.7 KB, 242 views)

Last edited by Ptitprince; 10-14-2013 at 06:06 PM. Reason: add attachment ;)
Ptitprince is offline   Reply With Quote
Old 10-14-2013, 11:13 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You'll need to provide the translations as a .po or .mo file and get the author of modify epub to include that file in his plugin.
kovidgoyal is offline   Reply With Quote
Old 10-15-2013, 04:38 AM   #5
Ptitprince
Member
Ptitprince began at the beginning.
 
Ptitprince's Avatar
 
Posts: 16
Karma: 10
Join Date: Dec 2012
Device: Kobo Aura
The attachement it's only because there is an HTML file for help in the ZIP file of Modify Epub. It's a first step if it will be include in the ZIP file of Modify Epub. I'll see that with the creator of Modify Epub. I don't know how create po or mo file, do you have a link where I can learn what is it and how to create ? I search also by myself obviously
Ptitprince is offline   Reply With Quote
Advert
Old 10-15-2013, 04:49 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The plugin author has to first create a .pot file that contains all translatable sources which you can load into any translation program and a enter the translations. When you are done, the program will generate a .po file for you. You can also use web services like launchpad translations or transifex instead of a translation program to create .po files from the .pot file.
kovidgoyal is offline   Reply With Quote
Old 10-26-2013, 09:51 PM   #7
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I should have said this before...

I am quite happy to allow translation of my plugin. But, as Kovid says, it would need some support in calibre for doing this. Or suggestions on how to add it to the plugin.

Kovid: I assume you are generating the .po files from the source. I just had a very quick look and can't see anything doing this. Can you point it out?
davidfor is offline   Reply With Quote
Old 10-26-2013, 10:26 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
See setup/translations.py (it uses xgettext)
kovidgoyal is offline   Reply With Quote
Old 10-27-2013, 09:08 AM   #9
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,061
Karma: 2178845
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
I'm happy to facilitate translation of my plugin. I'm not sure when I'll have a few minutes to set it up, but since I'm using Launchpad for bugs I'll set up Launchpad Translations. I hope there's a nice way to export those translations
jgoguen is offline   Reply With Quote
Old 10-27-2013, 04:15 PM   #10
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: 6,307
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
I have a first stab at an i18n/l10n version of a plugin using my smallest plugin, SmartEject.

First, I went through and wrapped all the UI strings in _(). Then, taking what I found in calibre/utils/localization.py as inspiration, I added a l10n.py file containing:

Code:
try:
    from calibre.utils.localization import get_lang

    mofile = get_resources("l10n/messages_%s.mo"%get_lang())

    import cStringIO
    from gettext import GNUTranslations
    trans = GNUTranslations(cStringIO.StringIO(mofile))
    
    def gettext(x):
        return trans.gettext(x)

except Exception, e:
    def gettext(x):
        return x
Then in my plugin code files I added:
Code:
from calibre_plugins.smarteject.l10n import gettext as _
First, I:
  1. used pygettext.py to generate a messages.pot file from my source .py files,
  2. copied that to l10n/messages_en.po,
  3. edited that with Poedit to add "(en)" a few places for proof it worked,
  4. created .mo file and
  5. included l10n/messages_en.mo in the plugin zip file.
That version of SmartEject is posted here.

I will not be in the least surprised if I've over looked any number of additional details, but it's starting point.

Issues I've identified with this process so far:
  1. In an ideal world (for plugin in writers anyway), the functionality in l10n.py would be part of the plugin base classes and plugins would just use _() and provide .mo files in a standard directory in the plugin zip.
  2. Should the plugin name itself in the InterfaceAction and InterfaceActionBase child classes be localized? What happens to users with the plugin already installed if it changes?
  3. What's the best practice for maintaining the .po files? How do you update existing .po translations to add new UI strings?
  4. Are/Should translated versions of the plugin forums exist somewhere? Like the plugin index page?
JimmXinu is offline   Reply With Quote
Old 10-27-2013, 10:45 PM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1. Yes this will be made part of the standard calibre, however I have not yet decided exactly how. The plugins will be required to put their .mo files in a 'translations' directory named as fr.mo, de.mo etc.

Regarding automated loading of the plugins' translation files, there are several approaches, one is what you have described, the function to load the translations can become part of calibre, like get_resources()

Another is that calibre loads the translations automatically and makes them available via the global calibre _ object using _.im_self.add_fallback

The con of the first approach is that it requires a little more work in each plugin (an import statement in every .py file)

The con of the second approach is that it wont handle translation collisons very well. If the same string is translated differently in two plugins which one will win, is random.

2. Plugin names should never be translated, action_spec should contain translated strings, those are what is displayed ot the user.

3. One typically uses some kind of UI to update .po files. You can use a web service like launchpad translations or transifex, or you can just have your translators work on the ..po file directly using something like poedit and mail you the results.

4. This is somewhat harder to do and considering the main calibre website and user manual are currently untranslated, not high on my list of priorities.
kovidgoyal is offline   Reply With Quote
Old 10-28-2013, 12:44 AM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I have added the infrastructure to calibre, https://github.com/kovidgoyal/calibr...23e32c4c627900

All you need to do is
1) Mark the strings with _()
2) Put the .mo files into the translations directory, for example translations/de.mo and translations/fr.mo
3) Add load_translations() to the top of the .py files that have translatable strings

Of course, this will only work with calibre 1.9 or if you are running from source. There may well be bugs, I have only tested it with a very rudimentary plugin.

The commit I linked to above, includes some documentation on how to add translations to plugins, feel free to comment if it can be improved, clarified.
kovidgoyal is offline   Reply With Quote
Old 10-28-2013, 01:12 AM   #13
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Kovid: Thanks. That makes it "easy". Now all I have to do is go through all those strings...
davidfor is offline   Reply With Quote
Old 10-28-2013, 04:38 AM   #14
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,061
Karma: 2178845
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
Is the language tag strictly the two-letter code, or will it accept regional codes? That is, can I have fr_FR.mo and fr_CA.mo or only fr.mo?
jgoguen is offline   Reply With Quote
Old 10-28-2013, 04:50 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There's no limitation, provided that get_lang() actually returns the full code on the users system.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
M92. Translation to French, Spain, Italian and other languages. Need your Support! Booxtor Onyx Boox 99 03-18-2014 05:41 AM
Best eBook reader for reading French (English speaker learning French) eVeNtInE Which one should I buy? 13 08-24-2012 04:25 AM
Free (ADE-ePub) Harlequin.fr romance novels in translation [French Language] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 0 05-19-2012 03:20 PM
French Translation app Rickbrit Kobo Tablets 0 01-04-2012 03:38 PM
French translation dictionaries in PRS 350/650? glazwegian Sony Reader 15 01-20-2011 03:32 AM


All times are GMT -4. The time now is 06:58 PM.


MobileRead.com is a privately owned, operated and funded community.