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 01-18-2011, 03:53 PM   #1
silentguy
Connoisseur
silentguy doesn't littersilentguy doesn't littersilentguy doesn't litter
 
Posts: 88
Karma: 200
Join Date: Nov 2010
Location: Dortmund, Germany
Device: Kindle Paperwhite (10. Generation)
Translating my plugin?

Hi!
I've written an oyo plugin a while ago to manage covers and I got bored today so I thought I'd try to figure out if there's a way to add a german translation to the plugin, seeing how it's mostly used in germany.
I see how you mark strings as translatable but I'm not sure if there is any ability in place to add to the existing translation list, so I thought I'd just ask.
Is there?
silentguy is offline   Reply With Quote
Old 01-18-2011, 03:59 PM   #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,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, translations only work with code that is part of the calibre codebase.

You can easily check the value of the users interface language and use the appropriate strings yourself.

from calibre.utils.localization import get_lang
kovidgoyal is offline   Reply With Quote
Advert
Old 01-19-2011, 04:37 AM   #3
silentguy
Connoisseur
silentguy doesn't littersilentguy doesn't littersilentguy doesn't litter
 
Posts: 88
Karma: 200
Join Date: Nov 2010
Location: Dortmund, Germany
Device: Kindle Paperwhite (10. Generation)
Thanks, that worked fine, but now I have an encoding problem. I want to use äöü in my plugin text, but I have not found the proper setting yet. If I leave it encoded as ANSI it tells me I did not declare the proper encoding (I don't know where) and if I save it as UTF8 without BOM it loads but does not display the umlauts correctly.
silentguy is offline   Reply With Quote
Old 01-19-2011, 05:07 AM   #4
silentguy
Connoisseur
silentguy doesn't littersilentguy doesn't littersilentguy doesn't litter
 
Posts: 88
Karma: 200
Join Date: Nov 2010
Location: Dortmund, Germany
Device: Kindle Paperwhite (10. Generation)
Okay, I found out how to declare encoding, but it's still wonky. It seems the plugin config dialog does not display utf8. So I encoded it as ISO-8859-1, which works for me, but if other ppl install it via plugin installation, the umlauts get killed again, it seems like there is an automatic utf8 conversion or something.
I just rephrased the two sentences I had, but I thought I should at least mention it
silentguy is offline   Reply With Quote
Old 01-19-2011, 11:00 AM   #5
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,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You should escape non ascii strings, to be safe. So the string äöü becomes u'\xe4\xf6\xfc'.

Or if you want to use unescaped strings, use a coding declaration, like

# -*- coding: utf-8 -*-
kovidgoyal is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Translating indie authors Kumabjorn General Discussions 19 06-22-2012 04:58 AM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM
Translating long/complex strings Jellby Calibre 12 08-10-2009 04:36 PM
Translating MR stories Verencat Lounge 11 05-31-2009 12:00 PM
Translating entire pages RickyMaveety Lounge 3 02-10-2009 12:31 PM


All times are GMT -4. The time now is 05:42 PM.


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