Modifying the output / Using localized strings |
Localization information (FGLPROFILE, FGLRESOURCEPATH, DBPATH, DBFORMAT and so on) are statically defined at the start of a program and cannot be changed at runtime. However, by placing reports in separate executables and running these from the main application with a modified environment, you can achieve the affect of “modifying” these values on a per report basis.
$echo $FGLPROFILE fglprofile $cat $FGLPROFILE fglrun.localization.file.count = 2 fglrun.localization.file.1.name = "captions.42s" fglrun.localization.file.2.name = "mappings.42s" $find translation_files translation_files translation_files/en translation_files/en/captions.str translation_files/en/captions.42s translation_files/fr translation_files/fr/captions.str translation_files/fr/captions.42s translation_files/common translation_files/common/mappings.str translation_files/common/mappings.42s $cat test.4gl MAIN ... #select French translation LET handler=configureReport(“translation_files/fr:translation_files/common”); START REPORT invoice TO XML HANDLER handler ... END MAIN ... FUNCTION configureReport(resourcePath) ... LET handler=fgl_report_loadCurrentSettings(“localizable_invoice.4rp”) ... CALL fgl_report_configureLocalization(NULL,resourcePath,NULL,NULL) ... RETURN fgl_report_commitCurrentSettings() END FUNCTION ...
$echo $DBFORMAT $:,:.: $cat test.4gl MAIN ... #select German number formatting LET handler=configureReport(“:.:,:EUR”); START REPORT invoice TO XML HANDLER handler ... END MAIN ... FUNCTION configureReport(numberFormat) ... LET handler=fgl_report_loadCurrentSettings(“invoice.4rp”) ... CALL fgl_report_configureLocalization(NULL,NULL,numberFormat,NULL) ... RETURN fgl_report_commitCurrentSettings() END FUNCTION ...