11

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?

Tony Guiheen
  • 932
  • 1
  • 12
  • 42
  • 1
    duplicate of my question see http://stackoverflow.com/questions/24178211/how-to-specify-months-language-cultureinfo-in-lotusscript-format-now-dd-mm – Emmanuel Gleizer Dec 09 '15 at 14:01
  • 1
    Thanks, but my question, although similar, is not a duplicate as the default regional setting in use in the LOCAL client should be used – Tony Guiheen Dec 09 '15 at 14:59
  • 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 Dec 09 '15 at 21:33
  • You are generating text which has the formatted date inserted to it and sending this text by mail. The generated text at the recipient is the same as at the sender side. If your text contains some characters in english like `The date was Wednesday, 09. December 2015`, it will not be translated automatically to german. You need to generate the text in german on your side and send this text to recipient. So, Emmanuel Gleizer is right in saying that your question is a duplicate. – nempoBu4 Dec 10 '15 at 05:09
  • 2
    @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 Dec 11 '15 at 02:33
  • @StanRogers The problem is that `Format$` always returns english regadless of regional settings. – nempoBu4 Dec 11 '15 at 03:49
  • 1
    @nempoBu4 - That's obviously *not* the case if the problem only exists on a subset of workstations. – Stan Rogers Dec 11 '15 at 13:50
  • Thanks Stan, you have precisely described my problem. The issue is still open, I am wondering what could be causing this. – Tony Guiheen Dec 14 '15 at 08:05
  • I had similar problems with Notes not reading correctly the timezone from the operating system. That was due to restrictions of the users access... I only had that on Citrix- Servers, but maybe this is your problem: Try to start Lotus Notes with elevated access and see, if then the format is correct... – Torsten Link Dec 15 '15 at 15:21
  • @TorstenLink it has been said that one some PC it works and on other - not. – Dmytro Pastovenskyi Dec 15 '15 at 18:40
  • Yes, and if operating system and Notes are the same, then it might be the user rights that are different... – Torsten Link Dec 16 '15 at 05:44
  • Some extra info: This problem occured AFTER an "upgrade" of the Lotus Notes application. Only the Lotus Notes database code was changed, no changes were made to user rights. I really want to solve this WITHOUT changing the code. This problem occurs at a "sensitive" customer and any code changes require lots of bureaucracy. – Tony Guiheen Dec 16 '15 at 10:08

3 Answers3

2

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.

SQL Police
  • 3,679
  • 1
  • 18
  • 47
0

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.

Aganju
  • 5,994
  • 1
  • 9
  • 22
0

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

Tony Guiheen
  • 932
  • 1
  • 12
  • 42