Discussion:
[wpkg-users] Set variable according to Registry entry
w***@retepsamoht.de
2017-12-20 14:42:04 UTC
Permalink
Hi everybody

I need to deploy a software to English and German Windows systems, which
works flawlessly until German users also want to use the English version
of said software.

Since these cases are few, I thought about introducing a new environment
variable to determine the correct language, but I have troubles
understanding how the "switch" would work.

Here's the language selection part of my package.

<!-- Default language de --> <variable name="PKG_LANG" value="de"/>

<!-- Overwrite if lcid is en -->
<variable name="PKG_LANG" value="en" lcid="409,809,c09,2809,1009,2409,3c09,4009,3c09,4009,3809,1809,2009,4409,1409,3409,4809,1c09,2c09,3009"/>

<check type="registry" condition="equals" path="|HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment|\USERLANG" value="en" > <variable name="PKG_LANG" value="en"/> </check> As far as I
understand, PKG_LANG should be assigned the value "en" when the USERLANG
env var is found and set to "en". The logs show that the registry Key
exists and has the correct value but PKG_LANG still stays on "de". Any
hints are appreciated. Thanks Tom
Stefan Pendl
2017-12-20 22:21:44 UTC
Permalink
Post by w***@retepsamoht.de
<check type="registry" condition="equals" path="|HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment|\USERLANG" value="en" <variable name="PKG_LANG" value="en"/>
</check>
The problem is that the check is a sub-node of the variable node. In
addition there is a simpler way to check the value of an environment
variable. I also think that the pipe characters are incorrectly used.

I would check it this way:
<!-- code starts (watch for line wraps) -->
<variable name="PKG_LANG" value="en">
<condition>
<check type="host" condition="environment" value="USERLANG=^en$" />
</condition>
</variable>
<!-- code ends -->

See the change log for further descriptions and the extended host
matching wiki page.
--
*Stefan P.*

Top-posting:
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Loading...