10-14-2013, 07:40 AM | #1 |
Member
Posts: 16
Karma: 10
Join Date: Dec 2012
Device: Kobo Aura
|
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 |
10-14-2013, 08:34 AM | #2 |
creator of calibre
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. |
Advert | |
|
10-14-2013, 06:05 PM | #3 |
Member
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 Last edited by Ptitprince; 10-14-2013 at 06:06 PM. Reason: add attachment ;) |
10-14-2013, 11:13 PM | #4 |
creator of calibre
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.
|
10-15-2013, 04:38 AM | #5 |
Member
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
|
Advert | |
|
10-15-2013, 04:49 AM | #6 |
creator of calibre
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.
|
10-26-2013, 09:51 PM | #7 |
Grand Sorcerer
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? |
10-26-2013, 10:26 PM | #8 |
creator of calibre
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
See setup/translations.py (it uses xgettext)
|
10-27-2013, 09:08 AM | #9 |
Generally Awesome Person
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
|
10-27-2013, 04:15 PM | #10 |
Plugin Developer
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 Code:
from calibre_plugins.smarteject.l10n import gettext as _
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:
|
10-27-2013, 10:45 PM | #11 |
creator of calibre
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. |
10-28-2013, 12:44 AM | #12 |
creator of calibre
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. |
10-28-2013, 01:12 AM | #13 |
Grand Sorcerer
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...
|
10-28-2013, 04:38 AM | #14 |
Generally Awesome Person
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?
|
10-28-2013, 04:50 AM | #15 |
creator of calibre
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.
|
Thread Tools | Search this Thread |
|
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 |