../pvss.htm menu.gif basics.gif

getNoOfLangs()

Gets the number of languages currently available.

Synopsis

int getNoOfLangs();

Parameters

Parameters

Meaning

none

-

Return value

If successful, the function returns the number of languages or in the event of an error, -1.

Description

Returns the number of languages currently configured in the project.

IconExample

This example demonstrates the majority of the functions that are connected with Multi-language capability. In the example, the project languages are German, English and Spanish. The langString ls contains the user-defined language names, for example, "English".  A direct assignment by index operator [ ] is not allowed, only one dyn_string with the appropriate entries can be assigned. The only way of changing individual elements is by using the function setLangString, for example, for corrections (in the example "German" replaces "French"). As an option, the entry can also be made using the editor with the function langEditor. Further on in the example, miscellaneous information relating to the language settings in the Log viewer is outputted.

main()

{

int i,id,idx,anz,t;

langString ls;

dyn_string d;

d[1]="English"; // These strings are used for

d[2]="French"; // "configuring" the

d[3]="Spanish"; // langEditor

ls=d; // assignment of a dyn_string is allowed

setLangString(ls,2,"German"); // single assignment

langEditor(ls); // start the editor

no=getNoOfLangs(); // number of languages

DebugN("Number:",no);

t= getParamLang(); // configuration language

DebugN("Para:",ls[t]); // Name of the para language

t=getMetaLang(); // meta language

DebugN("Meta:",ls[t]);

t=getActiveLang(); // active language

DebugN("Active:",ls[t]);

for (i=0;i<no;i++) // Go through all languages

{

DebugN("name:",getLocale(i)); // Iso name

id=getGlobalLangId(i); // Global Id

DebugN("Global Id :",id);

idx=getLangIdx(id); // reverse of getGlobalLangId

DebugN("language ",idx,"=",ls[idx]);

}

}

IconNote

In the last output , instead of ls[idx] you can also write ls[i] for as long as an error does not occur, idx is equal to i (due to the reverse of getGlobalLangId()).

Relates to

Multi-language capability

Availability

UI, CTRL, DP

See also

getGlobalLangId(), getLangIdx(), getNoOfLangs(), getMetaLang()

Top Of Page

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved