LocMsg
The LocMsg function returns a pointer to a string according to the language
settings of FAR Manager. It is an analogue of the standard
GetMsg function.
Attention!
- The LocMsg function function is not part of the standard API. The source code is available here.
char *LocMsg( struct PluginStartupInfo *psi, char *MsgName, char *Var, int Len );
Parameters
psi
Pointer to a PluginStartupInfo
structure; it is used to get RootKey and ModuleNumber variables.
MsgName
Name of the requested message.
Var
If not NULL, points to a buffer that receives the requested string.
Len
If zero, all the data is copied.
Return value
Pointer to the requested string.
Remarks
- In contrast to the GetMsg, this function does not cache data. This allows to change data dynamically (without restarting FAR Manager, etc.).
- The LocMsg function may be used to "localize" "second level" plugins.
- It considers the language setting of the current user.
- A file containing the messages should be located in the same folder, as the plugin,
and should be named as following: PluginName.msg.
It is a standard ini-file with the following structure:
[Default] //This section defines the default language section, which will be used, //if the requested section is not found. //It is an optional section, if it is absent, first section will be the //default. Language=Russian //Section names SHOULD be taken from the first line of //the corresponding .lng file: //.Language=Russian,Russian (Русский) // ^^^^^^^ // This should be the the name of the section [Russian] String1=Текст первого сообщения String2=Текст второго сообщения IsSkipNoWord=1 [English] String1=Text of the first message String2=Text of the second message IsSkipNoWord=1 //etc.
Example
BOOL IsSkipNoWord; p=LocMsg("IsSkipNoWord",NULL,1); IsSkipNoWord=(*p != '0')?TRUE:FALSE; phf=strrchr(LocMsg(temp,"String1",956),".");
See also: