From: Yves <yme...@pe...> - 2005-02-09 10:56:12
|
Some ideas. Answer to Flo : of course single words should not be translated as _("segmentation")+_("fault"). But there are cases where you have to trans= late single words, like for the title of a column in a table : _("host"). But in that= case, it's the translation of a sentence that contains one word, so it's the same : tran= slate as much as possible in one string :) About destructive/non-destructive methods for translations : never be afr= aid of breaking a translation. The software is first designed to work, and then to work i= n foreign languages, and not the other way round. A recent example : sylpheed (a ni= ce mail client) was released as 1.0. This usually means stable and tested version, and yo= u don't expect for a newer version before a while. Few weeks after, 1.0.1 was released. = Changelog : many translations updated. Now, Alex's subject : this is NOT a translation problem. It is a keyword = problem. So you have to put #ifdef USE_NAGIOS and #ifdef USE_ASNMTAP everywhere. When it's only a keyword problem, here is what you can do : #if defined ENABLE_ASNMTAP #define APPLICATION_TITLE "ASNMTAP" #endif #elsif defined ENABLE_NAGIOS #define APPLICATION_TITLE "Nagios" #endif Then, in the application, you can use this : char*application =3D strdup(_(APPLICATION_TITLE)); Here you see that you define the keywords to use somewhere, and you enabl= e the translation system (as _(...) ) somewhere else. I wrote an incorrect example to make things clear about keywords and tran= slation. It's incorrect because if you write this, the i18n tools will not see that "AS= NMTAP" and "Nagios" are strings to translate. The correct example is : #if defined ENABLE_ASNMTAP #define APPLICATION_TITLE N_("ASNMTAP") #endif #elsif defined ENABLE_NAGIOS #define APPLICATION_TITLE N_("Nagios") #endif Then, in the application, you can use this : char*application =3D strdup(_(APPLICATION_TITLE)); N_(...) does nothing but tell the translation system that it contains a s= tring to translate. The translation occurs only when you use _(...). > Is it possible to have one parameters: > > ./configure--enable-asnmtap > > but where for the nagios users because of the > --enable-nagios (default) parameters nothings change!!! > > so that it automatically compiles with the next default parameters: > > --prefix=3D/opt/asnmtap/perfparse --with-imagedir=3D/opt/asnmtap/htmlro= ot/img/ > --with-cgidir=3D/opt/asnmtap/htmlroot/cgi-bin > --with-http_image_path=3D/asnmtap/img I suggest that you make a variable, not a #define constant. This way, you can enable/disable asnmtap at runtime, and have one binary = only. This creates a problem for the CGI because it should read one config file= for nagios behaviour and another file for asnmtap behaviour. I suggest that you use = an environment variable (no problem to use it for perfparsed and perfparse tools too) to= say where the config file is. There would be 3 ways to say where it is, and the priority would be 1/ check if -c is set and take the config file name from the command line 2/ if -c is not set, check if PERFPARSE_CONFIG_FILE is set and take the c= onfig file name from that environment variable 3/ otherwise, use the default built-in config file name. In all cases, if the config file does not exist, use the built-in default= values. With this, you can edit your httpd.conf file and add the environment var = : <directory /your/web/repository/nagios/cgi-bin> Options ExecCgi ... SetEnv PERFPARSE_CONFIG_FILE /perfparse/etc/perfparse.conf </directory> <directory /your/web/repository/asnmtap/cgi-bin> Options ExecCgi ... SetEnv PERFPARSE_CONFIG_FILE /perfparse/etc/asnmtap.conf </directory> Then, no need to hard-code the paths at ./configure time. Just have 2 dis= tinct configuration files :) Documentation : http://httpd.apache.org/docs-2.0/mod/mod_env.html man getenv Yves --=20 - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - - GPG key - http://ymettier.free.fr/gpg.txt - - Maitretarot - http://www.nongnu.org/maitretarot/ - - Perfparse - http://www.perfparse.org/ - |