get currently in use catalog

Discuss any general programming issues here
Post Reply
ilbarbax
Posts: 140
Joined: Thu Apr 01, 2010 6:41 pm

get currently in use catalog

Post 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.
plouf
Posts: 533
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: get currently in use catalog

Post 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?
Christos
ilbarbax
Posts: 140
Joined: Thu Apr 01, 2010 6:41 pm

Re: get currently in use catalog

Post 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?
plouf
Posts: 533
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: get currently in use catalog

Post 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 :)
Christos
ilbarbax
Posts: 140
Joined: Thu Apr 01, 2010 6:41 pm

Re: get currently in use catalog

Post 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 :)
User avatar
airsoftsoftwair
Posts: 5575
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: get currently in use catalog

Post 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.
Post Reply