Page 1 of 1
How to identify language settings
Posted: Mon Jul 06, 2015 6:50 am
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
Re: How to identify language settings
Posted: Mon Jul 06, 2015 7:30 am
by Wim Gielis
A lookup cube with manual input...
How often does this information change ?
Is it worth that kind of programming ?
Re: How to identify language settings
Posted: Mon Jul 06, 2015 8:55 am
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.
Re: How to identify language settings
Posted: Mon Jul 06, 2015 10:48 am
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

)
Re: How to identify language settings
Posted: Mon Jul 06, 2015 12:07 pm
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.
Re: How to identify language settings
Posted: Mon Jul 06, 2015 12:21 pm
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.
Re: How to identify language settings
Posted: Mon Jul 06, 2015 12:55 pm
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*)
Re: How to identify language settings
Posted: Mon Jul 06, 2015 2:03 pm
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)