What determines the value of $$$DefaultLanguage (used for localization) for a new Caché installation?

Primary tabs

Is the default language (i.e., $$$DefaultLanguage, which is used as the basis for localization with $$$Text/etc. at compile time) always "en" for new Caché installations, or could it be different? How is this determined? I don't see an option to select a language during Caché installation.

Also, is there a supported/preferred API for setting the default language? Looking at %occMessages.inc, one option would be:

Set $$$DefaultLanguageNode = "en"

But I'd expect there to be a classmethod for this somewhere (and haven't managed to find it yet).

Background: My team is concerned about what might happen to the ^CacheMsg global if application code is compiled on other systems (possibly with different settings?) and messages are added as a result. I'm guessing there isn't a huge risk here, because compilation doesn't overwrite ^CacheMsg; the worst that could happen is that a "localized" value in the wrong language ends up in the global as an initial value. (I think this would still be a problem, in our case.)

UPDATE: My initial statement about compilation not overwriting ^CacheMsg is wrong. If a value is changed in the dictionary in the default language, compilation will fail with an error like:

ERROR: test.MAC(3) : MPP5646 : ##expression failed with an error: $ze=<ZDUPL>macroText+48^%occMessages

This is because it looks the same as a hash collision.

  • 0
  • 0
  • 214
  • 3
  • 0

Comments

The first time a message is added to a domain by $$$Text, $$$SessionLanguage is used:
http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?...

$$$SessionLanguage is determined by locale of current process, that is by default is the same as locale of Caché instance
http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?...

Default locale for Caché instance is determined during installation based on OS locale. For example, on English Windows that has Russian in Regional Settings, Caché is installed with locale rusw (ruw8 for 8-bit installation). You can change locale after installation. There is no option to select locale during installation.

You can change current session language with ##class(%MessageDictionary).SetSessionLanguage("ru")

ClassMethod way to set a language for a session is:

Do ##class(%MessageDictionary).SetSessionLanguage(lang)

The interesting case would be $$$Text("englishtext") macros getting compiled on a new instance under a session in other language. Under these conditions the ^CacheMsg global would be written with "englishtext" values under session language. Which would be set as a default language for this domain (Messages in $$$Text are presumed to be written in domain default language, unless specified otherwise).

To prevent that set domain default language or change  session language before the compilation.

As far as I remember importing message dictionary does not set default language for the domain itself.