Forum Discussion

Adrian_Dierssen's avatar
Adrian_Dierssen
Copper Contributor
Jun 24, 2022

Language dependent files in VFS

The only way to change the language of WinRAR from English to another is to copy the language files *.lng into the program directory. I have packed the *.lng files in a MSIX Modification Package whi...
  • Adrian_Dierssen's avatar
    Adrian_Dierssen
    Jun 25, 2022

    TIMOTHY_MANGAN 
    Hello Timothy,

    first of all thank you very much for the quick feedback.

    It is a pity that it does not work with modification packages in a bundle.

    I have now solved it via the PSF FileRedirection for all "*.lng" files and a Powershell start script.
    The Powershell script detects the user language on startup and copies the required language files from %MsixPackageRoot% to the fileredirection %MsixWritablePackageRoot% .


    For all those who may come across this post and also want to package WinRAR multilingual, i have created it as follows:

    1. Create a folder "Language" in the already captured WinRAR MSIX package.
    2. Create the needed ISO Language Code subfolders and copy the corresponding "*.lng" language files from WinRAR (WinRAR Languages) into the subfolders. 



      3. Add PSF to the MSIX package and configure Powershell start script “UserSettings.ps1” and FileRedirection for the "*.lng" files


      PSF "config.json"

     

     

    {
        "applications": [
            {
    			"id": "PSFLAUNCHEROne",
    			"executable": "VFS\\ProgramFilesX64\\WinRAR\\WinRAR.exe",
    			"arguments": "",
    			"workingDirectory": "VFS\\ProgramFilesX64\\WinRAR",
    			"scriptExecutionMode": "-ExecutionPolicy ByPass",
    			"startScript": {
    				"waitForScriptToFinish": true,
    				"timeout": 30000,
    				"runOnce": true,
    				"showWindow": false,
    				"scriptPath": "%MsixPackageRoot%\\VFS\\ProgramFilesX64\\WinRAR\\UserSettings.ps1",
    				"scriptArguments": "'%MsixPackageRoot%' '%MsixWritablePackageRoot%'",
    				"runInVirtualEnvironment": true
    			}
            }
        ],
        "processes": [
            {
                "executable": "WinRAR",
                "fixups": [
                    {
                        "dll": "VFS\\ProgramFilesX64\\WinRAR\\FileRedirectionFixup64.dll",
                        "config": {
                            "redirectedPaths": {
                                "packageRelative": [
                                    {
                                        "base": "VFS/ProgramFilesX64/WinRAR/",
                                        "patterns": [
                                            ".*\\.lng"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        ]
    }

     


     "UserSettings.ps1"

     

    Param
    (
        [Parameter(Mandatory=$false)]
        $MsixPackageRoot,
    
        [Parameter(Mandatory=$false)]
        $MsixWritablePackageRoot 
    )
        
    #Create MSIX Fileredirection folder
    $Destination = New-Item "$MsixWritablePackageRoot\vfs\programfilesx64\winrar" -ItemType Directory -Force
    
    #Copy Winrar *.lng Files to MSIX Fileredirection folder
    Copy-Item -Path "$MsixPackageRoot\VFS\ProgramFilesX64\WinRAR\Languages\$((Get-UICulture).Name)\*" -Destination $Destination -Force -ErrorAction SilentlyContinue

     

     

Resources