Lotus Notes / LotusScript - How to set date in German rather than English?
Asked Answered
G

3

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?

Geanticlinal answered 9/12, 2015 at 12:35 Comment(12)
duplicate of my question see #24178711Kizzee
Thanks, but my question, although similar, is not a duplicate as the default regional setting in use in the LOCAL client should be usedGeanticlinal
did you tried creating a date Field in your form, specify Custom Show All, and try getting the value as text : uidoc.FieldGetText( fieldName )Kizzee
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.Semitrailer
@Semitrailer - 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.Serafina
@StanRogers The problem is that Format$ always returns english regadless of regional settings.Semitrailer
@Semitrailer - That's obviously not the case if the problem only exists on a subset of workstations.Serafina
Thanks Stan, you have precisely described my problem. The issue is still open, I am wondering what could be causing this.Geanticlinal
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...Leanto
@TorstenLink it has been said that one some PC it works and on other - not.Mavismavra
Yes, and if operating system and Notes are the same, then it might be the user rights that are different...Leanto
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.Geanticlinal
D
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.

Doubletongue answered 21/12, 2015 at 23:6 Comment(4)
Thanks, I have not yet definitively solved this issue but I will go with this answer.Geanticlinal
@TonyGuiheen Thank you! Please write about your progress on that.Doubletongue
In the end, I fixed this by adding a new LotusScript function to "correct" the date. It is not the ideal way but I just could not find any other.Geanticlinal
@TonyGuiheen Nice to hear from you again. Well after all, you have a found a solution! As you say, it's not perfect, but then, such is the world ;)Doubletongue
F
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.

Fries answered 22/12, 2015 at 4:10 Comment(0)
G
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

Geanticlinal answered 8/2, 2016 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.