Skip to content

Latest commit

 

History

History
400 lines (302 loc) · 32.7 KB

binary-translation.md

File metadata and controls

400 lines (302 loc) · 32.7 KB
title weight
Localization - User Interface Translation
170

Notepad++ can be "localized" to your chosen written language, so that it translates the user interface (including menu and command names, and the text in dialogs and buttons). It supports this multi-language functionality by using a localization xml file (based on the official english.xml translation) which maps the various user-interface pieces to the appropriate translation. The Notepad++ localization is chosen through the Settings > Preferences > General > Localization interface.

Creating or Editing a translation

Maybe Notepad++ doesn't currently have the language you would like to use. Or maybe, Notepad++ has been updated recently but the translation file is one or more versions behind, so some of the text isn't in your selected language. Maybe the official Notepad++ translation for a language doesn't match your particular usage of that language. Or sometimes, you just want to have some fun rewording things for your own amusement.

The process of teaching Notepad++ a new language is virtually identical to editing an existing language, and both processes are described here:

  1. Download the official copy of english.xml and save it into the <Notepad++_Install_Dir>\localization\ directory (see Configuration Files Location). You may need to create the localization\ directory first, if it doesn't already exist.
    • This will be used as the source for a new translation, and a reference when you are editing an existing language.
  2. This step depends on whether you are editing an existing language translation, or creating a new translation from scratch:
    1. For an existing translation: Download the most recent copy of the existing language translation from the localization portion of the code repository and save it into the same folder as localization\english.xml.
      • Note: If you are wanting to change the English text for your own use, please edit localization\english_customizable.xml instead of localization\english.xml, since english.xml is meant to exist as an "absolute reference" with the official names of each of the text entries.
    2. For a new translation for a language that Notepad++ doesn't already have: Copy localization\english.xml to localization\<yourlanguagename>.xml
  3. Edit localization\<yourlanguagename>.xml
    1. Make sure the initial <?xml ... ?> tag indicates encoding="utf-8".
    2. Update the <Native-Langue...> tag near the top of the file:
      • Make sure the name="___" attribute matches your language's native name. This is the name that will show up in the Preference dialog's Localization pulldown
      • Make sure the filename="___.xml" matches your language name
      • Make sure version="8.1.1" matches the most-recent Notepad++ version number. It should already match, if you downloaded the most recent english.xml as described above.
    3. Edit the name="..." attributes as appropriate for the language you are editing.
      • Note: Do not change any of the id="###" or subMenuId="xxx" attributes, as those are used to map the text in the name="..." attribute to the right piece of text in Notepad++. If you change those, the localization file will not work properly.
      • You may use XML character entities for characters. (Note: unlike HTML, XML only has 5 predefined named entities; all other characters require numeric or hexadecimal entities.)
      • If the encoding was properly set (above), you may insert Unicode characters directly.
      • When possible, keep the translated text about the same length (in characters) as the original English; this will help make sure the translation will fit in menus and dialog boxes which were designed to fit the official English text.
    4. If you are going to share your localization file with others, you must define accelerator letters for critical menu commands.
      • These accelerator letters are the letters you see underlined in menus.
        • These are used for quickly activating a menu entry from the keyboard when the menu is active.
          • For example, the File menu's New command has an accelerator of N defined in the default English localization file, so when the File menu is displayed, typing N will run that command.
        • This is separate from the keyboard shortcut used while editing.
          • For example, the File menu's New command has a default keyboard shortcut of Ctrl+N, which can be used anytime the editor section of Notepad++ is active. But if you have the File menu showing, Ctrl+N does nothing; instead, you have to use the accelerator.
          • Thus, even commands that have keyboard shortcuts should also have accelerators defined.
      • To define the accelerator character, you need to put an ampersand & before the appropriate character in your translation text.
        • Because the localization file is in XML, and & has a special meaning to XML, you need to use the string &amp; before the letter in your translation string.
        • For example, to underline the E in Super Edit, your string would need to be defined as Super &amp;Edit in the XML: <Item id="#####" name="Super &amp;Edit"/>
      • To know which commands are critical to have accelerators for, please use the official english.xml as a guide: any string that includes the &amp; notation in the official english.xml should also include the &amp; in your translation.
      • Users of Notepad++ (and any Windows application) expect menus to have these accelerator keys.
        • If you neglect to define them, or choose not to, you will be breaking the expectation of the users of your translation.
        • Further, you may be inhibiting usability for people who must use (or prefer to use) the keyboard for controlling Notepad++.
  4. To see the changes take effect, save the file, then go to Settings > Preferences > General > Localization and select <yourlanguagename> from the pulldown menu: this will copy localization\<yourlanguagename>.xml to nativeLang.xml and will immediately update the Notepad++ application to use the text from your saved XML file.
    • Note: If you do not see the right language in the pulldown, you need to make sure you put the XML file(s) in the right directory, as explained above.
    • You may actually do the process of saving the file then selecting Localization = <yourlanguagename> throughout your development of the translation, to be able to see the changes you make as you go.

Share your translation

If you have updated an existing translation to match the most recent version of Notepad++, or if you have created a translation for a new language that isn't currently available in Notepad++, you may want to request that it get added to the Notepad++ codebase, so that it will be distributed with the next version of the application. To do so, create your own fork of the codebase and make a Pull Request to ask that your translation be added to the main repository; if you do not know how to make Pull Requests, see the GitHub documentation; or you may create an issue asking for the tranlsation to be updated, and attach your XML file to the issue. Before making any Pull Request, please read and understand and follow the Rules for Contributing to Notepad++'s codebase.

Available translations