Notepad++ automatic language configuration

Copper Contributor

To make Notepad++ start automatically in the user's language, it is necessary to copy the corresponding language file from the installation directory
"...\VFS\ProgramFilesX64\Notepad++\localization" to the user directory "...\Roaming\Notepad++" with the target name "nativeLang.xml".


For the MSIX packaging i achieved this by using the PSF Powershell start script:

PSF "config.json"

 

 

{
  "enableReportError": true,
  "applications": [
    {
      "id": "PSFLAUNCHEROne",
      "executable": "VFS\\ProgramFilesX64\\Notepad++\\notepad++.exe",
      "arguments": "",
      "workingDirectory": "VFS\\ProgramFilesX64\\Notepad++",
      "scriptExecutionMode": "-ExecutionPolicy ByPass",
      "startScript": {
        "waitForScriptToFinish": true,
        "timeout": 30000,
        "runOnce": true,
        "showWindow": false,
        "scriptPath": "%MsixPackageRoot%\\VFS\\ProgramFilesX64\\Notepad++\\UserSettings.ps1",
        "scriptArguments": "'%MsixPackageRoot%' '%MsixWritablePackageRoot%'",
        "runInVirtualEnvironment": true
      }
    }
  ]
}

 

 

 

"UserSettings.ps1"

 

 

Param
(
    [Parameter(Mandatory=$false)]
    $MsixPackageRoot,

    [Parameter(Mandatory=$false)]
    $MsixWritablePackageRoot 
)
    
$path = "Roaming\Notepad++"
  
# Create MSIX AppData path               
$path = New-Item -type directory -path "$(($MsixWritablePackageRoot -split 'Local\\M')[0])$path" -Force 
    
# Get Language
switch ((Get-UICulture).Name)
{
    'de-DE' { $Language = 'german' }
    'es-ES' { $Language = 'spanish' }
    'it-IT' { $Language = 'italian' }
    'ko-KR' { $Language = 'korean' }
    Default { $Language = 'english' }
}

# Set Language
Copy-Item -Path "$MsixPackageRoot\VFS\ProgramFilesX64\Notepad++\localization\$Language.xml" -Destination "$path\nativeLang.xml" -Force

 

 


The switch in the Powershell script can be easily extended if additional languages are needed.

If the user language is not considered by the switch, english is automatically configured as fallback.

1 Reply

Hi Adrian,

Thank you for your contribution to the community.