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.

3 comments:

Toldy Lajos said...

The v2.3.0 scratc the system after short work.

flavianopetrocchi said...

scratc the system? Is this a tentative to report a bug? If it is try to be more detailed or it is not useful for anyone.

B_I_S said...

Dear Flaviano you wrote a great program. I like it. So I made the Russian localization of JPdfBookmarks using your instructions. But some errors appeared while I trying to perform "Clean and Build". So I could not get to the end of the process. In spite of this I would like to send you my results (they didn't appear in your net folder, but I have them on my HD) in order to add russian language to your program. Please tell me how I can deliver this files to you? Feel free to e-mail me via igor-buryachenko@yandex.ru if it is still interesting for you.

With kind regards,
Igor Buryachenko (AKA B_I_S).