Additional Windchill Capabilities > Service Information Management > Customizing Windchill Service Information Manager and Windchill Service Parts > Custom Hook to Pre-populate Target Languages for Translation
  
Custom Hook to Pre-populate Target Languages for Translation
The PrePopulateTargetLanguagesHook is used to pre-populate a list of target languages in the Create Translation Package dialog box.
The set of languages that is returned from the hook must be legal for the root object of the Translation Package.
For example, if a language is returned but the user does not have a role in the library for that language, the language appears as strikethrough under the Available Target Languages list and is not pre-populated in the Selected Target Languages list.
Or, if the target language is not valid or is not in the Supported Languages preference, the invalid target language is not pre- populated in the Selected Target Languages list. An error message for the invalid language is displayed in the method server.
The combination of available and selected target languages populated in the Create Translation Package can be manually shuffled to meet the translation requirement.
The implementation of this hook requires you to specify the name of the hook in the PrePopulateTargetLanguagesHook property.
Interface
package com.ptc.tml.validation;

import java.util.Set;

import wt.fc.Persistable;
import wt.util.WTException;

/**
* This interface provides a way to preselect the target languages to be displayed under
* 'Selected Target Languages' section in Create translation package dialog.
*
* <BR>
* <BR>
* <B>Supported API: </B>true <BR>
* <BR>
* <B>Extendable: </B>false
* @author nbhalgat
*/
public interface PrePopulateTargetLanguagesHook {

public Set<String> getSelectedTargetLanguageCodes(Persistable p) throws WTException;
}
See also, SamplePrePopulateTargetLanguagesHookImpl.java which is a sample implementation that has been provided for reference. This sample is available at http://bla-opengrok/xref/wnc-main/arb_wcArbortext/SIS/Translation/src/com/ptc/tml/sample/Sample PrePopulateTargetLanguagesHookImpl.java location.
Registry
1. Use the xconfmanager utility to edit translation.service.properties.xconf. You can also register it in the components.service.properties file located at <Windchill>/codebase/com/ptc/core/components. For information on using the xconfmanager utility, see About the xconfmanager Utility.
2. Add the following property:
<Service context="default"
name="com.ptc.tml.validation.CustomXMLValidationHook">
<Option serviceClass="YourCustomXMLValidationHookClassName"
selector="null"/>
</Service>
3. Save the file.
4. Propagate your changes using the xconfmanager utility. From the <Windchill>\bin directory, enter the following command:
xconfmanager -pF
5. Restart the method server.