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-28-2013, 11:38 AM   #16
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: 654
Karma: 2018502
Join Date: Jan 2013
Location: New Brunswick, Canada
Device: Kobo Glo
Quote:
Originally Posted by kovidgoyal View Post
3) Add load_translations() to the top of the .py files that have translatable strings
I'm not familiar with adding functions to namespaces, does the addition in zipplugin.py line 174 mean I can call load_translations() without importing anything?
jgoguen is offline   Reply With Quote
Old 10-28-2013, 12:02 PM   #17
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: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
yes, just like you call get_resources() or get_icons()
kovidgoyal is offline   Reply With Quote
Old 10-29-2013, 02:42 PM   #18
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.
 
Posts: 1,717
Karma: 509671
Join Date: Dec 2011
Location: Midwest USA
Device: Nook STR w/Glowlight, Kindle 3g, Droid
Quote:
Originally Posted by kovidgoyal View Post
I have added the infrastructure to calibre...
Excellent.

Quote:
Originally Posted by kovidgoyal View Post
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
Simple enough. Calling load_translations() from each file isn't really an inconvenience, IMO.

It does, however, need to be wrapped with a try/except or a calibre version number check if a plugin still wants to support earlier versions.
Code:
# pulls in translation files for _() strings
try:
    load_translations()
except:
    pass # load_translations() added in calibre 1.9
Quote:
Originally Posted by kovidgoyal View Post
2. Plugin names should never be translated, action_spec should contain translated strings, those are what is displayed ot the user.
Okay. I see that the InterfaceActionBase.name parameter has be left untranslated for calibre to match up with the right plugin on the website. That (untranslated) plugin name is shown in to the user in Preferences -> Plugins and Get Plugins lists.

The description on the Preferences -> Plugins comes from InterfaceActionBase.description and can be translated. But the desc on the Get Plugins list isn't. I assume it--and the name--are coming from a web server with the plugin list.

I don't expect anything to be done about this right now, I just wanted to clarify that there are places the user will see the untranslated name.
JimmXinu is offline   Reply With Quote
Old 10-29-2013, 10:04 PM   #19
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: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you are using try:/except: dont use a bare except: , use

Code:
try:
   load_translations()
except NameError:
   pass
instead.
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, Freebies, and Resources (No Self-Promotion) 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 09:23 AM.


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