cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How do you get the language of linked translation objects?

AdamElkins
12-Amethyst

How do you get the language of linked translation objects?

Version: Windchill 12.1

 

Use Case: I am working in a Java workflow Expression robot, on an EPMDocument. My end result is I need to create new translation packages based on what that document had been translated into in past versions and iterations. I have the Starting Document, and all version, and I have the target translation package. How can I get the actual TranslationLink object, and get the language attribute, or how can I get the language of the translated package?


Description:

I tried querying for the Translation link like this, but  windchill indicates that source is not an attribute of TranslationLink.

 

wt.query.QuerySpec qs = new wt.query.QuerySpec(com.ptc.arbortext.windchill.translation.TranslationLink.class);
				qs.appendWhere(new wt.query.SearchCondition(com.ptc.arbortext.windchill.translation.TranslationLink.class,
						com.ptc.arbortext.windchill.translation.TranslationLink.SOURCE_ROLE,wt.query.SearchCondition.EQUAL, epmDoc.getIdentity()));

				wt.fc.QueryResult linkResults = PersistenceHelper.manager.find(qs);
				while(linkResults.hasMoreElements()){
					com.ptc.arbortext.windchill.translation.TranslationLink link = (com.ptc.arbortext.windchill.translation.TranslationLink)linkResults.nextElement();
				      System.out.println("Lang ="+link.getLanguage());
				}

 

 I am getting the translation package like this, but I havent had any luck getting the language off of that document.

 

wt.fc.PersistenceHelper.manager.navigate(nextObj, com.ptc.arbortext.windchill.translation.TranslationLink.ALL_ROLES, com.ptc.arbortext.windchill.translation.TranslationLink.class);

 

Any help would be appreciated. 

ACCEPTED SOLUTION

Accepted Solutions

You can get the language of a persistable  object like an translation package or document by requesting it's PTC_DD_LANGUAGE attribute.

com.ptc.core.lwc.server.PersistableAdapter persistAdapObj = new com.ptc.core.lwc.server.PersistableAdapter((wt.fc.Persistable) linkedObj, null,java.util.Locale.US, new com.ptc.core.meta.common.SearchOperationIdentifier());	
persistAdapObj.load("IBA|PTC_DD_LANGUAGE");	
String strValue = (String) persistAdapObj.get("IBA|PTC_DD_LANGUAGE").toString();
System.out.println("Lang-"+strValue);

 

View solution in original post

2 REPLIES 2

You can get the language of a persistable  object like an translation package or document by requesting it's PTC_DD_LANGUAGE attribute.

com.ptc.core.lwc.server.PersistableAdapter persistAdapObj = new com.ptc.core.lwc.server.PersistableAdapter((wt.fc.Persistable) linkedObj, null,java.util.Locale.US, new com.ptc.core.meta.common.SearchOperationIdentifier());	
persistAdapObj.load("IBA|PTC_DD_LANGUAGE");	
String strValue = (String) persistAdapObj.get("IBA|PTC_DD_LANGUAGE").toString();
System.out.println("Lang-"+strValue);

 

plutsky
14-Alexandrite
(To:AdamElkins)

Yes, I agree.  That attribute is on the source DD and on the translated DD.

 

Note that technically this can be controlled by a Translation Preference: "Document Language Attribute" but in practise customers use the out of the box setting PTC_DD_LANGUAGE.

Announcements

Top Tags