01-18-2011, 04:53 PM | #1 |
Connoisseur
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? |
01-18-2011, 04:59 PM | #2 |
creator of calibre
Posts: 44,759
Karma: 24967300
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 |
Advert | |
|
01-19-2011, 05:37 AM | #3 |
Connoisseur
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.
|
01-19-2011, 06:07 AM | #4 |
Connoisseur
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 |
01-19-2011, 12:00 PM | #5 |
creator of calibre
Posts: 44,759
Karma: 24967300
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 -*- |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Translating indie authors | Kumabjorn | General Discussions | 19 | 06-22-2012 05:58 AM |
New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 01:11 PM |
Translating long/complex strings | Jellby | Calibre | 12 | 08-10-2009 05:36 PM |
Translating MR stories | Verencat | Lounge | 11 | 05-31-2009 01:00 PM |
Translating entire pages | RickyMaveety | Lounge | 3 | 02-10-2009 01:31 PM |