How to add MUI support for a language

A quick description, how to add support for a MUI language.

Preparation

Clone a complete source code sub-directory (e.g. language\np3_en_uk)
and change names according to new language code (LCID string) to support.

  • Notepad3\language\np3_xx_yy\…

Adjust contents for compiling this sub-project according to new file names:

  • Notepad3\language\np3_xx_yy\np3_xx_yy.vcxproj
  • Notepad3\language\np3_xx_yy\np3_xx_yy.vcxproj.filters
  • Notepad3\language\np3_xx_yy\np3_xx_yy.rc

Especially the directory paths in <PostBuildEvent> of np3_xx_yy.vcxproj project file!

No need to adjust the contents of:

  • Notepad3\language\np3_xx_yy\dllmain.cpp</li>
  • Notepad3\language\np3_xx_yy\np3_xx_yy.cpp
  • Notepad3\language\np3_xx_yy\resource.h
  • Notepad3\language\np3_xx_yy\stdafx.cpp
  • Notepad3\language\np3_xx_yy\stdafx.h
  • Notepad3\language\np3_xx_yy\targetver.h

Non language sub-directory related files:

(to make Notepad3 aware of new language)

  • Notepad3\Notepad3.sln  (add new lng project)
    • make new project depending on project np3_en_us
    • change Culture of project (PropertiesResources)
    • according to new language (all Configurations and Platforms)
    • Replace all occurrences of cloned Culture definition within all new language .rc files:
/////////////////////////////////////////////////////////////////////////////
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
…
#endif    // English (United Kingdom) resources
///////////////////////////////////////////////////////////////////////////// 
  • by corresponding new language definitions, e.g.:
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
…
#endif    // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
  • Notepad3\src\Notepad3.c:
    • add new code (xx-YY) to: static WCHAR* const  g_tchAvailableLanguages = L"af-ZA de-DE ... xx-YY ";
    • add corresponding ID to: static LANGID const  g_iAvailableLanguages[] = { 1078, 1031, …, nnnn };
    • Increase LNG_AVAILABLE_COUNT

Translate all strings in Resource-Files

Mandatory:

  • Notepad3\language\np3_xx_yy\menu_xx_yy.rc
  • Notepad3\language\np3_xx_yy\strings_xx_yy.rc
  • Notepad3\language\np3_xx_yy\dialogs_xx_yy.rc

Minor important:

  • Notepad3\language\np3_xx_yy\encode_xx_yy.rc
  • Notepad3\language\np3_xx_yy\lexer_xx_yy.rc

Hints:

  • Notepad3\language\np3_xx_yy\menu_xx_yy.rc: don’t change corresponding Accelerator-Key descriptions (e.g. Ctrl+Alt+A)
  • Notepad3\language\np3_xx_yy\strings_xx_yy.rc: preserve placeholders (e.g. %s), they are context dependent and replaced at run-time
  • Notepad3\language\np3_xx_yy\dialogs_xx_yy.rc: some dialogs/boxes may need a width adaption, caused by longer strings:
    • Dialog definition: nameID DIALOGEX x, y, width, height. If adjusting width here, please adjust width of nameID in GUIDELINES DESIGNINFO part at the end of dialogs_xx_yy.rc accordingly (RIGHTMARGIN, width – 7 pt)!
    • Text definition: LTEXT text, id, x, y, width, height. Don’t change id – as for all resource items!
    • Button text: PUSHBUTTON text, id, x, y, width, height. If width change is needed, a x re-positioning maybe needed too !

Enjoy your new language

If the new language is different to your Operating-System language, set: Notepad.ini: [Settings2] PreferedLanguageLocaleName=xx-YY

Sharing is Caring!