SOLVED

Language dependent files in VFS

Copper Contributor

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 which works fine with manual installation.

Is it possible to create a MSIX bundle which installs WinRAR and the corresponding language modification package depending on the OS language ?

3 Replies

I don't think so. Bundles do not cause dependencies to be installed.

best response confirmed by TIMOTHY_MANGAN (MVP)
Solution

@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. 

    Adrian_Dierssen_0-1656160714345.png

    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

 

 

@Adrian_Dierssen 

Awesome. Thanks for sharing.

 

Feel free to also share here at this community site for sharing application preparation info: http://github.com/TimMangan/App-Info
We already have an entry for WinRar without the language concerns, so you can edit the docs that exist.

1 best response

Accepted Solutions
best response confirmed by TIMOTHY_MANGAN (MVP)
Solution

@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. 

    Adrian_Dierssen_0-1656160714345.png

    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

 

 

View solution in original post