Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 8

ApAppendTranslation()

Append external translation files to an application's translation list

Synopsis:

#include <Ap.h>

int ApAppendTranslation( char const *filename,
                         char const *lang_extension );

Arguments:

filename
The name of the translation file that you want to append.
lang_extension
NULL, or the language extension to append to the file name.

Library:

Ap

Description:

This function is used to append external translation files to the application's translation list. It takes the translation file identified by filename, appends the lang_extension and looks for the translation file in the directory defined by the ABLPATH environment variable. If lang_extension is NULL, the current language extension is used.

This is useful when you want to share common text strings among many different applications. Essentially, you create a standalone application that contains a single picture module (widget database) of text strings. Then you use the PhAB Language Editor to translate the strings in this module. Once the database is created and translated, you can access it from another application.

Keep in mind when calling this function from a DLL that this function performs the language extension search based on the location of the executable or DLL associated with the current context, and appends the language translation to the current context. You must make sure that there is a current context. You most likely want your DLL to append a language translation to its own context, rather than the main program's context:

 ApContext_t *old = ApSetContext( & AbContext );
 ApAppendTranslation( filename, NULL );
 ApSetContext( old ); // Restore the program's context

For more information about creating DLLs from PhAB applications, see “Making a DLL out of a PhAB application” in the Generating, Compiling, and Running Code chapter of the Photon Programmer's Guide.

Returns:

0
Success.
-1
Unable to read the translation file.

Examples:

Assuming ABLPATH has been set to /usr/photon/translations:

ApDBase_t *mytext_db;

/* Open the text database. */
mytext_db = ApOpenDBaseFile( "/fullpath/mytext_db.wgtp" );

/* Set the translation to German. */
ApSetTranslation( "de_DE" );

/* Append the external German translation file to the
   current list. This will read the translation file
   "/usr/photon/translations/mystrings.de_DE" and append
   it to the application's current translation list. */

ApAppendTranslation( "mystrings", "de_DE" );

/* Get a translated text string. */
text = ApGetTextRes( mytext_db, "msg001" );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApOpenDBase(), ApOpenDBaseFile(), ApSetTranslation(), ApGetTextRes()

International Language Support chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 180

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/ap/apappendtranslation.html on line 180