Complete C++ i18n gettext() hello world example. sets the LANG environment variable using export before executing the program (Linux):export LANG=es_MX.utf8./hellogtIs there a way to set the language just while executing hellogt, like a command line argument?This would be handy for testing programs.
Set the language for a single program execution
environment variables;locale
In ksh, bash, and similar shells,LANG=es_MX.utf8 ./hellogtwill set LANG=es_MX.utf8 only for the invocation of ./hellogt.More portably, there is a program called envenv LANG=es_MX.utf8 ./hellogtwhich will set environment variables and run the program specified.  This works in all shells, including csh and traditional sh (which do not support the first method).