Important: The information in this document is obsolete and should not be used for new development.
Translating Files Explicitly
It's possible that your application might open some document files without the assistance of the Finder or the Standard File Package. For example, your application might execute a script that contains the name of a file to open. Because you're bypassing the system software services that invoke implicit translation, you might need to modify your application to perform explicit translation (the conversion of a file or scrap with direct intervention from your application). The Translation Manager provides several routines that you can use to retrieve information about documents and about the document types that an application can open, as well as to translate documents from one format to another.
You can use the
- IMPORTANT
- Before calling the routines described in this section, you must make sure that they are available in the current operating environment. See "Checking for the Translation Manager" on page 7-12 for details.
![]()
GetFileTypesThatAppCanNativelyOpenfunction to get a list of file types that an application can open by itself. This function takes a volume reference number (where the application resides), an application signature, and a pointer to a buffer to be filled with up to 64 file types. It returns a pointer to the list of the file types that the application can open without translation.You can use the
ExtendFileTypeListfunction to get a list of all file types that the Translation Manager can translate into file types in a given list. This routine takes the original list, the number of file types in it, a pointer to a buffer to be filled with file types, and the maximum number of file types that can be put into the extended list. TheExtendFileTypeListfunction returns a list of all the file types that can be translated into some type in the original list.You can use the
CanDocBeOpenedfunction to verify that a specified application can open the document that it is being requested to open. It takes the source document record, the volume reference number of the application that is to open the document, the creator application signature, and the list of file types that the application can open without translation. It returns a document-opening method (howToOpen) and document-translation method (howToTranslate). The choices for document-opening method are
The Translation Manager uses
domCannotdomNativedomTranslateFirstdomWildcard
howToTranslateto get information on converting the document into a format the application can read. For more information on theCanDocBeOpenedfunction, see page 7-40.You can call the function
TranslateFileto translate a file from one format to another. It takes the source document record, the destination document record, and thehowToTranslateparameter returned byCanDocBeOpened. In the destination document record,TranslateFilereturns the name and location of the translated file.