Sun Java Solaris Communities My SDN Account Join SDN
 
FAQ

Localized Software License Agreements - SLAs

 
Question:
I would like to create a shell script that will display an SLA [Software License Agreement] in the appropriate locale - provided the translated SLA is available.
The user would have to agree with the SLA before continuing.
Do you have any samples or advice on how to create this?

Answer:

There are a number freely available scripts under various kinds of open source licenses. However, it's quite possible that the use of such source code may not be what you want. Below are some alternatives.

If you plan to store the localized Software License Agreements in gettext MO files, then please see gettext(1), msgfmt(1), and gettext(3C) man pages on how to retrieve the translated messages, and also on how to build and place the MO (Message Object) files.

However, if you are looking for a simpler mechanism for a shell script to choose a localized SLA file based on the current locale setting, then, an option is to:
  1. Save your localized SLA files in a location as <filename>.<locale> where <locale> is the value of the:
    # locale | grep LC_CTYPE | cut -f2 -d\"
  2. Then, in a shell script, find out the locale name with the above approach and pick up the localized SLA file and show the file.

    * Note that if any of the locale category environment variables is explicitly set then there will be no quote characters in the line(s). In other words, ' " ' means it is implicitly set by other environment variables.

    Something like the following will catch both possibilities:
    
    
    #!/bin/csh
    
    locale | grep LC_CTYPE=\" > /dev/null
    if ($status == 0) then
    	set lc=`locale | grep LC_CTYPE | cut -f2 -d\"`
    else
            set lc=`locale | grep LC_CTYPE | cut -f2 -d=`
    endif
    if (X"$lc" == X"") set lc='C'
    echo $lc