Skip to content

Localization

Zufu Liu edited this page Sep 11, 2019 · 59 revisions

Localization Step

  • Read how to Build Notepad2 and metapath.
  • Read the document for Resource Files.
  • Change language LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US to target language.
  • DON'T change the code page (#pragma code_page(65001)) to target code page like #pragma code_page(1252). The file MUST be saved in UTF-8 (without BOM). Some notes:
    • Visual C++'s rc.exe supports ANSI, UTF-8 (without BOM), UTF-16LE (with BOM), while GCC's windres.exe supports ANSI, UTF-8 (with or without BOM). For portable reason, it's not suggested to save file in ANSI encoding.
    • When building with MSYS2's Clang with LTO, resource files MUST been compiled (by windres.exe) with --output-format=res flag.
  • Enable NP2_GET_LEXER_STYLE_NAME_FROM_RES (in EditLexer.h), add string table for lexers and strings.
  • Add string table for lexers name in Style_GetCurrentLexerName() function (in Styles.c).
  • Optionally, you can enable NP2_ENABLE_CUSTOMIZE_TOOLBAR_LABELS (in Notepad2.c and metapath.c), but I think it's not useful for localized program.
  • After translated all strings, build and test each program, ensure translated strings not been truncated. You may need to re-translate those long string or adjust UI control's width.
  • Fix bugs you found. It's better to make a issue when you find a bug.

Format Specifiers

String like %d or %s are format specifiers, don't translate them. Exchange order of format specifiers will need to change corresponding code that use the string, otherwise program may crash or produce undesired result.

Locale Dependent

  • Localization for Arabic and Hebrew may need re-layout all dialogs.
  • Enable some locale-dependent settings by default. e.g.:
    • Localization Korean may change default caret style to line width 2 instead of line width 1.
    • Localization for Arabic and Hebrew need add code to automatically enable bidirectional or RTL layout.

Available Localization

After you localized Notepad2 and/or metapath, you can make a new issue to add link for you localization to here and in readme.md.

Clone this wiki locally