pvbrowser menu text can be set to different languages using the INI file "~/.pvbrz". If you want to use non latin character sets like chinese or arabic set "codec=utf8 ## Unicode, 8-bit" in the INI file. Then you can use these characters in the INI file and in your sourcecode.
While pvbrowser is running you can switch from one language to the other, provided you have programmed this in your pvserver. There is a "#define DEFAULT_LANGUAGE 0" in processviewserver.h. Now you can define (in pvapp.h):
#define GERMAN_LANGUAGE DEFAULT_LANGUAGE+1 #define FRENCH_LANGUAGE DEFAULT_LANGUAGE+2 #define SPANISH_LANGUAGE DEFAULT_LANGUAGE+3 #define ITALIAN_LANGUAGE DEFAULT_LANGUAGE+4 #define CHINESE_LANGUAGE DEFAULT_LANGUAGE+5 ...
Now set the language parameter of "PARAM *p to your language (Let the user choose his language). "
p->language = GERMAN_LANGUAGE; // the default is: p->language = DEFAULT_LANGUAGE;
Within "defineMask(PARAM *p)" overwrite all text of any Objects to the other language."
static int defineMask(PARAM *p)
{
if(p == NULL) return 1;
generated_defineMask(p);
switch(p->language)
{
case GERMAN_LANGUAGE:
pvPrintf(p,idOfAnObject,"%s","Dies ist der deutsche Text");
break;
case FRENCH_LANGUAGE:
break;
case SPANISH_LANGUAGE:
break;
case ITALIAN_LANGUAGE:
break;
case CHINESE_LANGUAGE:
break;
default:
// nothing todo, because generated_defineMask has already set the text
break;
}
return 0;
}
Another topic in internationalization is UNIT CONVERSION. You can set p->convert_units to 0 or 1 (default: 0).
p->convert_units = 1;
Now you may use the function "float unit(PARAM *p, float val, int conversion);". If (p->convert_units == 0) then the original val will be returned.
val = unit(p, val, MM2INCH);
These are the available conversions. You may set p->convert_units depending on your language settings.
enum UNIT_CONVERSION
{
MM2INCH = 1,
INCH2MM ,
CM2FOOT ,
FOOT2CM ,
CM2YARD ,
YARD2CM ,
KM2MILE ,
MILE2KM ,
KM2NAUTICAL_MILE ,
NAUTICAL_MILE2KM ,
QMM2SQINCH ,
SQINCH2QMM ,
QCM2SQFOOT ,
SQFOOT2QCM ,
QM2SQYARD ,
SQYARD2QM ,
QM2ACRE ,
ACRE2QM ,
QKM2SQMILE ,
SQMILE2QKM ,
ML2TEASPOON ,
TEASPOON2ML ,
ML2TABLESPOON ,
TABLESPOON2ML ,
ML2OUNCE ,
OUNCE2ML ,
L2CUP ,
CUP2L ,
L2PINT ,
PINT2L ,
L2QUART ,
QUART2L ,
L2GALLON ,
GALLON2L ,
GR2OUNCE ,
OUNCE2GR ,
KG2POUND ,
POUND2KG ,
T2TON ,
TON2T ,
C2FAHRENHEIT ,
FAHRENHEIT2C
};