[Live-demo] language code detection

Hamish hamish_b at yahoo.com
Sun Sep 19 02:48:16 PDT 2010


Daniel wrote:
> At the code sprint in Barcelona we had the idea to detect the language
> code automatically by the language the user selected at login (or the
> language set by default).So Hal made a change in /bin/main.sh to read
> the $LANG parameter and set the default language (and welcome_message.txt)
> according to it. Here the additional source code:
>
>
> case `echo $LANG | sed 's/_.*//'` in
...

is that method acceptable for the Brazilians?


> The change for custom welcome message is in bin/install_desktop.sh (line
> 280):
>
> cp "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.* \
>   /usr/local/share/osgeo-desktop/
...
> Language codes have to be added or deleted when they are ready or
> not ready to be included.

try:

if [ -e "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.txt" ] ; then
   cp "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.txt \
     /usr/local/share/osgeo-desktop/
else
   cp "$BUILD_DIR"/../desktop-conf/welcome_message.txt \
     /usr/local/share/osgeo-desktop/
fi


then if the translated version exists it will be used, otherwise it
will default to copying in the english version.
this assumes the DVD builder will be local..


original welcome_message.sh should always be copied, and duplication of
english version with desktop-conf/ is to be avoided. (correct way is to
remove the duplicated version from doc/en/, then if desired (I'm not sure
it is) 'svn move' from the desktop-conf/ dir; this way full svn history
is preserved and there is only one master file to edit. if duplicate is
absolutely needed, tell svn to use a symlink)


regards,
Hamish



      



More information about the Osgeolive mailing list