How to identify language settings

Post Reply
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

How to identify language settings

Post by holger_b »

Currently, I am writing an application which, among other things that it does, creates default views and subsets. Can anyone think of a trick to identify a databases' language settings so I can decide how to name them? They are in the cfg file, I know, but we can not be sure the cfg file will always be in the same subdirectory.

One idea that came to my mind was, I could scan tm1server.log for certain key words. Or I might scan the <dimension>}subs and <cube>}vues directories to see what I find there.

Any smarter suggestions maybe?

Thank you
Holger
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: How to identify language settings

Post by Wim Gielis »

A lookup cube with manual input...
How often does this information change ?
Is it worth that kind of programming ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

Re: How to identify language settings

Post by holger_b »

That's just my perfectionist manner :-) Would be nice to make it work for all my clients automatically. I guess I will make it an input parameter.
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: How to identify language settings

Post by Wim Gielis »

holger_b wrote:That's just my perfectionist manner :-) Would be nice to make it work for all my clients automatically.
Then I am like you I guess :-)
holger_b wrote:I guess I will make it an input parameter.
That's better in my opinion. I also have a generic process to create default subsets and level 0 subsets in dimensions.
As you might know, 'Default' is not always 'Default' in TM1 in all user interface languages. See my article: http://users.skynet.be/fa436118/wim/tm1 ... ges_EN.htm

Hence, a Language parameter which is set to ENG in case of wrong input by the user of the process (me :-) )
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

Re: How to identify language settings

Post by holger_b »

Very interesting, thank you!

The reason why I am playing around with this is of course that I want to create views that will open instantly, well, as a default, when the user clicks on the dimension. Unfortunately this does not work in a German environment unless its name is "Standard" instead of "Default". Actually it would help if "Default" worked in any language and we could have kind of an alias that would display the name in the respective language - but that sounds like much overhead for a small benefit.

We may have to wait until all those local languages will have vanished, as a side-effect to the blessings of globalization.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: How to identify language settings

Post by rmackenzie »

holger_b wrote:They are in the cfg file, I know, but we can not be sure the cfg file will always be in the same subdirectory.
You can quickly grab a config setting from the tm1s.cfg as long as you know the name of the Windows service running the TM1 instance, and then use this Powershell script:

Code: Select all

$service_name = $args[0]
$target_property = $args[1]
$reg_key = 'HKLM:\SYSTEM\CurrentControlSet\services\' + $service_name
$config_location = (Get-ItemProperty -Path $reg_key -name ConfigPath).ConfigPath
$config_file = $config_location + '\tm1s.cfg'

$content = Get-Content $config_file
foreach ($line in $content) {
  if ($line -like '*=*') {
    $config_item = $line -split '='
    if ($config_item[0] -eq $target_property) {
      Write-Host $config_item[1]
    }
  }
}
Which can be called from cmd:

Code: Select all

PowerShell.exe "d:\get_tm1_config.ps1" 'planning sample' 'Language'
Which would then output e.g. eng, esp, fin, etc.
Robin Mackenzie
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

Re: How to identify language settings

Post by holger_b »

Ha!! That's exactly the type of code I had in mind. Thank you, rmackenzie!

Seems this will also help me to set up an automated list of all TM1 databases across all servers together with the ports they are using, which the other day someone suggested to set up in Excel (*shivers with disgust*)
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: How to identify language settings

Post by Wim Gielis »

That's interesting Robin, I have never coded in PowerShell before.

But then the Windows service name is the input to TM1, rather than the language. I don't know if I buy that idea.
If the TI process is also to be executed by a non-IT (minded) person, entering a language abbreviation will be easier than a Windows service name.

As to the registry key: would that change from one TM1 version to another ?
Obviously, without IBM communicating this change (if any, I am just asking)
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply