View Single Post
Old 08-31-2017, 07:54 AM   #324
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,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Beta - Enable translations

As promised, here is a beta of the plugin which allows translations. To do this, I have had to go through the code and find all text that should needs to be translatable. Then I wrap the text in a function to replace the text with the translated text. In doing this, I have probably made some mistakes. I have probably missed something that should be translated, and made the change for something that shouldn't be translated. Hopefully I haven't missed to many.

As yet, there are no translations. For anyone who is interested in doing this, the default language file in the plugin and attached to the post separately. To do the translations, I recommend using POEdit. This is a free tool that seems pretty easy to use. To do the translation:
  1. Rename the file to your language code. This is a two letter code such as "es" for Spanish.
  2. Open the file in POEdit.
  3. Set the language. There will either be a button at the top to do this, or choose from the menu, "Catalog" and then "Properties"
  4. Translate each "Source Text" by selecting it in the list. The text will displayed at the bottom with another field to enter the translation.
  5. As you add a translation, this will be displayed in the list on the right-hand side.
  6. If the text contains anything that looks like "{0}", this is a placeholder for a value and will be filled when the plugin is running. All of these need to be in the text.
  7. When finished, save the file and post it here for me to add to the plugin.

If you want to test the translation:
  1. While editing the file in POEdit, use "File", "Compile to MO" to generate the mo file.
  2. Unzip the plugin file.
  3. Put the mo file in the "translations" directory.
  4. Rezip all the files into a new plugin.
  5. Install the new plugin from the Plugins page of the calibre preferences using the "Load plugin from file" button.
  6. Set the calibre language to the language of the translation you have produced.
  7. Restart calibre.
  8. Test the plugin and tell me how much I have missed.

That should do it. If there are any problems, please report them here.
Attached Files
File Type: zip Annotations-beta.zip (662.6 KB, 405 views)
File Type: zip annotations-translations-default.zip (2.5 KB, 415 views)
davidfor is offline   Reply With Quote