Get all configured Project languages in Mapp view

Hey,
I am currently creating a compound widget to select the mapp view language.
I am not using the “LanguageSelector” widget because it doesn’t have the design possibilites I need.

I would like the compound Widget to automatically show only the languages I configured in my project.

Is it possible to somehow publish the languages to OPC UA or access them any other way?
I had a look at ArTextSys but it seems like it’s only able to give me the currently active language.

I also noticed the Client variable “clientInfo:languages”, but if I’m not mistaken it shows me the configured languages of my pc and is thus not project specific.

Thanks, Tim

Hoi Tim,

I used a DropDownBox and built the dataProvider in PLC.
You can read out all available languages with FUB ArTextSysGetNamespaceLanguages.

clientInfo:languages seems not to show all available languages.

I was thinking along the same lines. What I don’t know and haven’t tested is how many languages you get in return with that function block since it’s referencing a namespace.

For example you could have 4 languages in the namespace/ text file but only two of them are assign in the text configuration and therefore downloaded to the target.
Do we get the 4 from the namespace or only the 2 we want and have access to during runtime?

Not sure if that’s a concern for Tim’s application but I thought it worth noting.

Thanks, I think I’m gonna try that.
Did you use an array for gathering the languages? If yes, how did you define your array length?
Static, so that you have to change the length manually when you add or remove languages?

@marcel.voigt I will test the behavior and report back when I know more.

Hi Marcel,

you get only the languages which are transferred (selected in the TC.textconfig file). We have many languages in our tmx files but only transfer fewer languages to target.
This works well for us.

Content of Dataprovider:
grafik

Languages defined in TC.textconfig;
grafik

Languages in tmx file:

1 Like

I did set the array size of a const value (10). It’s not a problem when dataprovider array is bigger than needed if you have enough RAM on your target.

If there are no more languages just leave dataprovider items empty.

Would it be possible for you to share your code on how you use the “GetNamespaceLanguages” FUB? I can’t seem to get it to work.

Sure:

ACTION A_GetAvailableLanguages:
	
				// Read out available languages for visu
	IF iLang <= MAX_LANGUAGES THEN
				
		// read out languages in general namespace
		ArTextSysGetNamespaceLanguages_0(Execute := TRUE, Namespace := ADR('IAT/ZTexts/General'), First := FALSE);
		
		// WAIT until language is read out
		IF ArTextSysGetNamespaceLanguages_0.Done THEN
			
			// build DataProvider for visu		
			AvailableLanguages[iLang] := '{"value":"';
			brsstrcat(ADR(AvailableLanguages[iLang]), ADR(ArTextSysGetNamespaceLanguages_0.LanguageCode));
			brsstrcat(ADR(AvailableLanguages[iLang]), ADR('","text":"$$IAT/ZTexts/User/Languages/'));
			brsstrcat(ADR(AvailableLanguages[iLang]), ADR(ArTextSysGetNamespaceLanguages_0.LanguageCode));
			brsstrcat(ADR(AvailableLanguages[iLang]), ADR('"}'));
			
			iLang := iLang + 1;
			
			// reset to start again with next language
			ArTextSysGetNamespaceLanguages_0(Execute := FALSE);
			
			IF(iLang > MAX_LANGUAGES) THEN			// reset FB
				ArTextSysGetNamespaceLanguages_0(Execute := FALSE);
			END_IF
		END_IF
		
		// all languaes are read out
		IF ArTextSysGetNamespaceLanguages_0.EndOfList THEN
			iLang := MAX_LANGUAGES + 1;	
		END_IF
		
		   
	END_IF

END_ACTION
3 Likes