Page 1 of 1

get currently in use catalog

Posted: Tue Sep 03, 2024 3:07 pm
by ilbarbax
how can I get the currently used catalog of my script (name and path)?
The functions getcountryinfo, getlanguageinfo, getlocaleinfo, getsystemcountry and getsystemlanguage do not seems to return the info as I would need.

Re: get currently in use catalog

Posted: Tue Sep 03, 2024 5:09 pm
by plouf
You cant know what catalog is used. Except you personal track of what catalog you have open via OpenCatalog()

As for the rest command , what info wyou expected to get?

Re: get currently in use catalog

Posted: Wed Sep 04, 2024 4:37 pm
by ilbarbax
I know how to use opencatalog, the problem is that I want to store some other small files theat need translation as well in the directory of the catalog, then at least i would need to know the path of the curret opened catalog if any has been detected or otherwise I can use the default files.
Opencatalog does not return the result of the action taken.
I could assume the path as

t = GetLanguageInfo(GetSystemLanguage())
then
"<current-directory>/Catalogs/"..t.Name it shoul return, for example, <current-directory>/Catalogs/german/MyProgram.catalog but if the catalog has been saved as deutsch rather then german? how can I detect it?

Re: get currently in use catalog

Posted: Wed Sep 04, 2024 5:28 pm
by plouf
i think you are trying to get locale name aka greek.catalog

Code: Select all

LocaleName =GetLanguageInfo(GetSystemLanguage()).Name
DebugPrint(LocaleName)
the above code should provide locale default name, path is as explained in manual of OpenCatalog()
so OpenCatalog("MyProgram.catalog") in me, will open
<current-directory>/Catalogs/greek/MyProgram.catalog
an idea is to have as first String in your file locale so
; First line declare your languan
greek
;
blah blah line 2
;
blah blah blah line 3
therefore by checking first catalog string, you get languange and also can check if is correctly loaded, since string will be empty otherwise.
this offcourse is vulnerable to human mistakes but.. its an idea!

check also SpawnPPC who did a similiral thing https://forums.hollywood-mal.com/viewto ... 990#p20990

p.s.
your last question about deutch/german ,
practically all shall use international eka german, (the one system returns)
also there is NO savecatalog so, someone manualy shall save it.
so there is no bulletproof way to check what catalog has opened (request in wihlist)

a possible workaround would be to check using Exists() if the international directory name exist, then make a change, and reload to see if it there, otherwise delete newlly created file, i know its complicated but
as final note you may use , OpenFile() and not OpenCatalog() , you have more control, and catalog is not that compilcated to interpret yourself :)

Re: get currently in use catalog

Posted: Thu Sep 05, 2024 9:52 am
by ilbarbax
...so there is no bulletproof way to check what catalog has opened (request in wihlist)


That exactely the point i'm arguing.
Having hundreads languages supported with the possible double name it is difficult to handle an exists function for each of them.

An Andrea's fix would be appreciated :)

Re: get currently in use catalog

Posted: Tue Sep 10, 2024 7:39 pm
by airsoftsoftwair
I agree that it could be useful to find out the language of the currently used catalog. I'll see what I can do.

Re: get currently in use catalog

Posted: Sun May 11, 2025 7:23 pm
by airsoftsoftwair
Decided against implementing this now because it doesn't make much sense because the language of the catalog (if one can be opened) of course will always be identical to the system's language which you can already find out using GetSystemLanguage().