11
votes

I am writing code which sends a mail to users. The mail text contains a date. While the date is calculated correctly, the date is displayed in English, even though all users have German language Windows OS and have German set as their language in the Notes preferences. Here is my code:

Set dt = New NotesDateTime(doc.GetItemValue("abc")(0))          
dts = Format$(dt.LSLocalTime, "dddd, dd. MMMM yyyy")
mailText = replaceSubstring(mailText, "Datum", dts, True)

In the mail the date appears as, for example,

Wednesday, 09. December 2015

when it should appear as

Mittwoch, 09. Dezember 2015

The code is executed after a user clicks a button in the Notes Client. Not all mails have this problem but I can't detect any error in the OS and Notes preferences settings of the users who have experienced this. How can I get this date to appear in German rather than English?

3
Thanks, but my question, although similar, is not a duplicate as the default regional setting in use in the LOCAL client should be useduser1358852
did you tried creating a date Field in your form, specify Custom Show All, and try getting the value as text : uidoc.FieldGetText( fieldName )Emmanuel Gleizer
@nempoBu4 - No, it isn't. The OP isn't wondering why English isn't magically becoming German at the recipient's end. The mail is generated locally on a machine with German regional settings; the OP can't see any local settings (either at the OS level or in Notes) that would cause the date string to generated in English rather than German. It must, however, be the case that something set locally is causing the English string to come from Format$; the question is where to look.Stan Rogers
@nempoBu4 - That's obviously not the case if the problem only exists on a subset of workstations.Stan Rogers

3 Answers

2
votes

I often have similar problems at sensitive clients where PCs are restricted.

My answer here is not precise, it is just meant to guide you:

Basically, the Format of the Lotus Notes Client function does the following:

  1. It tries to read the user's locale settings. ("locale", not "local") These are stored in the registry under HKEY_CURRENT_USER\Control Panel\International.

  2. If step 1 fails, then the function reads the so-called DefaultFallback. This is stored under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages. If you look closely, you find for German the DefaultFallBack "English"

  3. If step 2 also fails, then the function uses the so-called Neutral Language, which is always English and which is hard-coded in the API.

In normal environments, step 1 always succeeds. However, in sensitive areas, it might happen that the registry is over-secured and that these data is either not stored in the registry, or that the client has insuffient privileges to access it. And then, the default fallback of english is used.

Also, not to forget, there come the Roaming Profiles and the Default Profiles, which also might have a cross-influence!

At last, there are multiple ways how to access the registry. Therefore, it might happen that Excel succeeds in step 1 and formats the date correctly, while Lotus Notes gets an error and uses the default fallback.

In Windows, there exists a horrible complex API for access of the international settings. This has grown for more than 20 years! In the MSDN reference, you find all these functions under the keywords "locale", "international" and "MUI" (Multilingual User Interface), this might help you further.

0
votes

Check the registry, and make sure not only

HKEY_USERS\Control Panel\International

is set to german, but also

HKEY_USERS.DEFAULT\Control Panel\International

i think this is an old known issue with notes.

0
votes

I solved this by using a LotusScript function to translate the dates, still can't find out why the problem occurs in the first place