Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscore in String Id in wxl breaks localization #1398

Closed
thenextman opened this issue Dec 12, 2023 · 4 comments
Closed

Underscore in String Id in wxl breaks localization #1398

thenextman opened this issue Dec 12, 2023 · 4 comments

Comments

@thenextman
Copy link

Using the latest packages (WixSharp 1.24.0, WixSharp.bin 1.24.0, WixSharp.wix.bin 3.14.0.1) and the managed WinForms UI.

I'm trying to use a wxl from an existing WiX project to localize my setup, but notice it's not working quite right.

Consider this .wxl:

<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" Codepage="1252" Language="1033" xmlns="http://schemas.microsoft.com/wix/2006/localization">
	<String Id="TestName">TheNextman</String>
	<String Id="Test_Name2">TheNextman2</String>
	<String Id="TestName3">TheNextman3</String>
</WixLocalization>

Now add three labels to a form with the relevant text: [TestName], [Test_Name2] and [TestName3].

When you run the project, note that only TestName is localized, the other labels keep their placeholders.

If you move or remove Test_Name2, you'll see that it won't localize and breaks subsequent string localization in the wxl file. Removing the underscore is sufficient to fix the problem.

@thenextman
Copy link
Author

Actually, it's not quite right and I'm not sure what's going on.

With this in my wxl:

	<String Id="TestName">TheNextman</String>
	<String Id="TestNameX">TheNextman2</String>
	<String Id="TestNameXX">TheNextman3</String>

And three labels with text value TestName, TestNameX and TestNameXX; only the first is localized.

It's quite possible I'm doing something wrong, but I'm not sure what....

@oleg-shilo
Copy link
Owner

Hi Richard, I suspect that it might be some fault in the localization algorithm.

Can you please do a quick test to help me? Can you change the order of those strings in the wxl? IE make TestNameXX the first entry in the file.

@thenextman
Copy link
Author

Hi @oleg-shilo; I made a quick test with re-ordering the strings and yes - it is the first one in the file that gets picked up. The others do not. So there is an issue, although my original report was not quite accurate.

Thank you for the prompt attention!

@oleg-shilo
Copy link
Owner

Great. Txs.
Making it into a defect.
Will have a look at it tonight.

@oleg-shilo oleg-shilo added the bug label Dec 12, 2023
oleg-shilo added a commit that referenced this issue Dec 14, 2023
- #1363: Shortcut to Dir/Folder
- #1398: Underscore in String Id in wxl breaks localization
- reverted experimental change for x86 bitness of WixSharp.UI. Now it's back to AnyCPU but SilentUI BA will no longer work. It's acceptable as it's better to set x86 on the user codebase (e.g. custom BA) than on generic lib (WixSharp.UI) and put bitness pressure on all users of this lib.
- `WarnOnOutputPathCollision` changed from Warning to Error (continuation of #1384).
- Extended cascading `Project.Platform` to `RegistrySearch` (triggered by #1390 discussion).
oleg-shilo added a commit that referenced this issue Dec 14, 2023
- #1363: Shortcut to Dir/Folder
- #1398: Underscore in String Id in wxl breaks localization
- reverted experimental change for x86 bitness of WixSharp.UI. Now it's back to AnyCPU but SilentUI BA will no longer work. It's acceptable as it's better to set x86 on the user codebase (e.g. custom BA) than on generic lib (WixSharp.UI) and put bitness pressure on all users of this lib.
- `WarnOnOutputPathCollision` changed from Warning to Error (continuation of #1384).
- Extended cascading `Project.Platform` to `RegistrySearch` (triggered by #1390 discussion).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants