cschneegans / unattend-generator

.NET Core library to create highly customized autounattend.xml files
https://schneegans.de/windows/unattend-generator/
MIT License
634 stars 55 forks source link

[Bug & proposal]Bugs related to language and region #36

Closed inschrift-spruch-raum closed 1 month ago

inschrift-spruch-raum commented 3 months ago

1.The home location setting seems to be overridden by Format dates, times, currency, and numbers arranging 2.Can a second preferred language be added to the unattended file image image image

cschneegans commented 2 months ago

To be honest, I probably never tested with Chinese images. There might be a more fundamental problem here.

I have downloaded the Win11_23H2_Chinese_Simplified_x64v2.iso image and created an autounattend.xml file with the settings shown in your first screenshot. Windows Setup then displays this language selection dialog:

playground-2024-08-19-00-48-31

This is not the expected behavior. Windows Setup should instead use the language settings from the autounattend.xml file. Did you also see this dialog? What image did you use? Also, please attach the autounattend.xml file that you have generated.

The unexpected behavior might be related to this log message written to the X:\Windows\Panther\setupact.log file:

Target language [zh-Hans-CN] is NOT a valid language

playground-2024-08-19-00-50-12

inschrift-spruch-raum commented 2 months ago

This is not the expected behavior. Windows Setup should instead use the language settings from the autounattend.xml file. Did you also see this dialog? What image did you use? Also, please attach the autounattend.xml file that you have generated.

Yes, I did see this window My unattended file

cschneegans commented 2 months ago

I have noticed Win11_23H2_Chinese_Simplified_x64v2.iso contains a \sources\lang.ini file with contents

[Available UI Languages]
zh-cn = 3

and Win11_23H2_Chinese_Traditional_x64v2.iso contains a \sources\lang.ini file with contents

[Available UI Languages]
zh-tw = 3

Therefore, I have replaced the UI language code zh-Hans-CN with zh-CN, and zh-Hant-CN with zh-TW via https://github.com/cschneegans/unattend-generator/commit/5a25a4f871f27816c263487352b3973a8be7d1c2. This works well in my tests, i.e. the manual language dialog does not longer appear. Thank you for bringing this to my attention.

Existing URLs that use the zh-Hans-CN or zh-Hant-CN codes will be redirected automatically – so just open the form with your previous inputs and download the autounattend.xml file again.

Please run your Windows installation with the new autounattend.xml file and check if the issue is resolved.

CodingWonders commented 2 months ago

@cschneegans, I did a test run with your changes and it looks like it works:

image

I didn't see the language selector screen

inschrift-spruch-raum commented 2 months ago

@cschneegans

Thank you for resolving the main issue, but there is another proposal here

2.Can a second preferred language be added to the unattended file

Do you have any solutions for it

cschneegans commented 2 months ago

I think the UI on this screen is somewhat misleading:

image

By clicking the Add a language button, you don't add a preferred language to Windows, you just add a language. The preference is rather established by the order of the languages.

Hence, setting your preferred language(s) is already possible in the form:

image

cschneegans commented 2 months ago

I have realized that my own form is misleading as well. I have redesigned the form to make it clearer how the 1st, 2nd and 3rd language preference are related:

image

inschrift-spruch-raum commented 2 months ago

image It seems that it still doesn't work

cschneegans commented 2 months ago

As I can't read Chinese characters, I had a hard time to even figure out that your screenshot shows the Country or region and Regional format settings. FWIW, this is what that section looks like on my computer:

image

You need to specify: • What autounattend.xml settings did you use? (You can just upload your file here.) • What was the expected result for the Country or region and Regional format settings? • What was the actual result, i.e. what Country or region and Regional format settings are shown on your screenshot?

inschrift-spruch-raum commented 2 months ago

Updated unattended file

The box above shows China

cschneegans commented 2 months ago

Using your autounattend.xml file and the Win11_23H2_Chinese_Simplified_x64v2.iso image, I get this result:

image

According to Google, 美国 is Chinese for United States, so I think the Country or region setting was applied correctly. I don't know why you are getting a different result. Please do the following:

  1. Open Windows PowerShell.
  2. Type Get-WinHomeLocation and press Enter.
  3. Type Set-WinHomeLocation -GeoId 244 and press Enter.
  4. Type Get-WinHomeLocation again and press Enter.

Copy and paste the entire output here.

inschrift-spruch-raum commented 2 months ago

I have currently identified the problem: UUP image bug or NTLite encapsulation bug

inschrift-spruch-raum commented 2 months ago

After my testing, I discovered the reason I removed PowerShell from NTLite And in autounattend.xml, it is precisely using PowerShell command Set-WinHomeLocation completes region switch But that doesn't mean I can't remove PowerShell Because I found that such code is unnecessary Actually, I only need to modify these four lines in autounattend.xml to achieve the purpose of setting the region image image

inschrift-spruch-raum commented 2 months ago

So, I need you to modify the source code so that it directly sets<SystemLocale>and<UserLocale> Instead of using PowerShell

cschneegans commented 1 month ago

I disagree. System locale, user locale and the home location are three distinct settings, and there is no XML element that sets the home location.

However, it appears that you can set the home location via the registry. Try using this .reg file in the Scripts to run whenever a user logs on for the first time section:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\International\Geo]
"Nation"="244"
"Name"="US"

This link will configure the form to use the .reg file and the settings from the autounattend.xml file you posted earlier.

inschrift-spruch-raum commented 1 month ago

I disagree. System locale, user locale and the home location are three distinct settings, and there is no XML element that sets the home location.

I think<SystemLocale>and<UserLocale>can also be optional settings for unattend-generator

inschrift-spruch-raum commented 1 month ago

A new idea Create Oobe.xml before OOBE startup Using the parameter <location> in Oobe. xml Save in Windows\System32\Oobe\Info Delete files after OOBE ends

cschneegans commented 1 month ago

Look, the autounattend.xml files created by my generator rely heavily on PowerShell, and I have no plans to change this. If you decide to remove PowerShell, you are on your own.