Monday, July 12, 2010

Translate JPdfBookmarks

If you want you can translate jpdfbookmarks to your language, it is very easy and no programming skills are required. Here follows a short tutorial on how to add a new language.

Download Netbeans 6.9.1, should work also with other versions but 6.9.1 is the one I use for jpdfbookmarks development,  install and start it then select the menu item  Team->Subversion->Checkout, you will have the following dialog:



in the Repository URL text input insert https://jpdfbookmarks.svn.sourceforge.net/svnroot/jpdfbookmarks/trunk/ leave the user and password blank for anonymous access for the time, or contact me if you want to share your translation with the community and I will give you member access to the repository, then click next:

 


on this other dialog I usually check "Skip and checkout only its content" and select an empty folder in "Local Folder" but here you can choose what you prefer, check also "Scan for Netbeans Projects after checkout" then click Finish button, after the download is finished click on the "Open Project" button:


In the Open Projects dialog choose jpdfbookmarks_core and check the "Open Required" check box in the lower left corner, then click Open. 


In the "Projects Window" navigate to localizedText.properties element of the jpdfbookmarks_languages project and right click with your mouse on it, from the context menu select Add->Locale and choose your language identifier:


A new element will be added named localizedText_de_DE.properties (change de_DE with whatever locale you have chosen),  right click on this new element and choose Open from the context menu:


You can see there are different columns, to each Key on the first column there is a related text in each language, when you create a new Locale like we have just done, the text in the default language (English) is copied to the new one also, all you have to do is translate that text in the chosen language. I suggest to click on the Key column header to sort in alphabetical order the keys, this will be helpful when you stop and restart your work to find quickly where you left.

A note for the menu items, each menu item have a mnemonic which is just a stressed letter in the item text when you press the ALT key (I know in some systems can be another modifier) to quickly access it, so for example the key MENU_EDIT in English is "Edit" and its mnemonic MENU_EDIT_MNEMONIC in English is "E", in Italian the same key has a text "Modifica" and its mnemonic is "M", so you should choose the mnemonic also considering the other items in the same menu to avoid collisions. For the rest you should just translate the text to your language but don't hesitate to ask me for any doubt.

When you have finished just right click on jpdfbookmarks_languages project item and choose "Clean and Build".

To launch the program with the new translation we need some more steps, right click on jpdfbookmarks_core project and select "Set As Main Project", then from the same menu choose Properties:


Here from the Categories on the left choose Run, on the dialog on the right create a new configuration with the New... button, name it something like gui_german to debug the graphical user interface or apply_german or what else is meaningful to you. Main Class should not be changed from  it.flavianopetrocchi.jpdfbookamrks.JPdfBookmarks, in Arguments you can put the command line arguments you want to pass to the program, for example if you want to check the help translation put here --help, changing Working Directory  can be used to start the program where most of your pdf files are to debug command line messages. In VM Options you can pass arguments directly to the java virtual machine and this is crucial to debug languages different from the default one of your desktop, for example if your operating system default language is Italian, when you start jpdfbookmarks it will be always in Italian so to translate and debug the program in German use the options -Duser.language=de -Duser.country=DE. You can create as many configurations as you like and when you have finished click OK.



Now you can select the configuration created from the main toolbar and run the program with F6 or the toolbar button.

Once you have started the translation if you wish to share your work with others, send me a message and I will add you to the project as a translator member, once you have a user name and a password to commit your changes to the repository just right click on jpdfbookmarks_languages project and choose Subversion->Commit.

If you have any question just ask, thank you best regards.

Saturday, July 10, 2010

Debian packages

There is now a debian package available to install jpdfbookmarks. It has been created by Slavko http://debs.slavino.sk and it is surely the best way to install the program on linux debian. 
The repositories to add are:
 
deb http://debs.slavino.sk testing main non-free
deb-src http://debs.slavino.sk testing main non-free 
the signature file is at http://debs.slavino.sk/repo.asc.
 
Thank you very much Slavko and I hope others will follow your example and create packages for other distributions.

Friday, July 9, 2010

JPdfBookmars 2.3.0

Version 2.3.0 is out. The reason for the switch  from version  2.2.X to  2.3.X numbering is the presence of new features regarding  the bookmarks text  files management.
A lot of users had problems with bookmarks text files  using a different encoding from what jpdfbookmarks expected on a particular system, now you can select the character encoding to use, both in the graphical user interface and on the command line.

In GUI mode to change the character encoding select the menu Tools->Options, at the bottom of the General tab there is a field to select the encoding you wish to use for the Dump and Load actions available in the Tools menu.  This setting is preserved between different executions of the program, anyway in the list the system default encoding is indicated by the text (System Default) so that you can revert easily to the original setting when needed.

In command line mode to change the character encoding use the option --encoding (or the -e short form) followed by the encoding name, for example:


jpdfbookmarks_cli.exe --encoding UTF-8 --apply bookmarks.txt --out output.pdf input.pdf   

this will apply the bookmarks contained in the file bookmarks.txt to the input.pdf file and save the result to output.pdf and will instruct jpdfbookmarks to read the file with a UTF-8 encoding. The setting in the command line is not preserved between different executions so if you don't specify an encoding the program  always uses the system default one.

The program doesn't make any check to see if the encoding you use for reading a file is correct, it is your responsibility to match the correct encoding between a dump and an apply. If you use often a different encoding or you want to transfer bookmarks text files to different systems I suggest you to insert the encoding used in the file name to help your memory and the one of any other user of the file, for example I name bookmarks text files like bookmarks_utf8.txt or bookmarks_iso8859-1.txt.

The --out option can now be used also with the --dump option, in this case it is interpreted as the text file where to dump the bookmarks of the pdf file, while I remind you that using it with the --apply option indicates the output pdf file. If you don't specify an --out file.txt, --dump will print bookmarks to standard output so redirection is still an option to save dumps, but the --out option gives you the possibility to change the encoding when used with an --encoding option, for example:

jpdfbookmarks_cli.exe --dump --encoding UTF-32 --out bookmarks.txt input.pdf


will dump bookmarks of input.pdf to a UTF-32 encoded file named bookmarks.txt.

Another feature added is the --force option (-f short form), with this option set no warning is issued or confirmation is asked before overwriting an existing file, while without it any overwriting should require your confirmation. This is useful for batch executions of the program in a non-interactive environment, but use it with caution and backup your files because it can lead to data loss.

Some bugs also have been corrected, to name a few:
  • memory needed for reading large files have been reduced a lot using temporary files that the program writes during execution (this is totally transparent to you as a user of course, but I like that you know what happens on your computer);
  • trailing spaces could lead to a wrong interpretation of lines in previous versions, now they are removed at runtime;
  • saving large files in gui mode now runs in its own thread and there is an animated bar at the bottom indicating that the save action is taking place;
  • the bookmarks toolbar is not scrolled with bookmarks anymore.
I would like to thank all the users and programmers who have reported bugs and  have indicated a viable solution, thanks a lot.