[Previous] [Contents] [Index] [Next]

ApAppendTranslation()

Append external translation files to an application's translation list

Synopsis:

#include <Ap.h>

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

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.

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()


[Previous] [Contents] [Index] [Next]