Netbeans Platform i18n and localization

August 4th, 2007 | by Tonny Kohar |

Netbeans Platform allows the application to be localized, the only problem is that it is not quite clear on the documentation, especially how to override the localization for Netbeans default menu eg: File, Edit, Windows, etc

Note: The is based on Netbeans 5.5.1

So to localize Netbeans Platform default menu, you could do the following

  • Edit the layer.xml file
    <filesystem>
        ....
        <folder name="Menu">
            <folder name="File">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Edit">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="View">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Insert">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Modify">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Tools">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Window">
                <attr name="SystemFileSystem.localizingBundle" 
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
            <folder name="Help">
                <attr name="SystemFileSystem.localizingBundle"
                    stringvalue="kiyut.sketsa.Bundle"/>
            </folder>
        </folder>
        ....
    </filesystem>
  • In the localized bundle properties, add this
    Menu/File=File_i18n
    Menu/View=View_i18n
    Menu/Insert=Insert_i18n
    ....

Tags: , ,

  1. 6 Responses to “Netbeans Platform i18n and localization”

  2. By krishna on Dec 27, 2007 | Reply

    Hi,

    Thanks for such a wonderful post. But It provides me only basic idea. Could please post an article which will explain the same on NetBeans 6.0. I am trying to implement language branding to the top menu items of Netbeans RCP Application.

    Thanks in Advance

  3. By Tonny Kohar on Dec 28, 2007 | Reply

    As far as I know, the methods above is works for both Netbeans 5.5 and Netbeans 6.0.

    note: this is not the proper way for localize Netbeans RCP, it is only provides quick hack for RCP application that only use minimal set of default Netbeans Menu. Bigger RCP Application should follow the Netbeans Location Project as below

    Proper localization should be following Netbeans Localization Project. Please see

    http://translatedfiles.netbeans.org/
    http://translatedfiles.netbeans.org/index-platform.html
    http://translatedfiles.netbeans.org/index-l10n.html

  4. By Dimitri on Feb 19, 2008 | Reply

    Wonderful,

    I’ve used it too.
    The question is what could be done for submenu items?

    How can they be translated in “localized bundle properties” without edition of layer.xml?

    In other words could
    be applied to subfolder in layer.xml? Or they should be repeted for all subfolders (submenus)?

    Thans.
    Dimi

  5. By Tonny Kohar on Feb 19, 2008 | Reply

    @Dimitri

    The trick is basically come in 2 version
    – If the localization is defined in layer.xml, then you can use this trick
    – if the localization is not defined in layer.xml, then you could use this branding trick

  6. By Thomas on Sep 11, 2009 | Reply

    Is there a decent editor for the i18n files?

  7. By Tonny Kohar on Sep 14, 2009 | Reply

    @Thomas

    We usually just using Netbeans IDE for the localization property file. However, you might be interested on OmegaT for i18n editor

You must be logged in to post a comment.