Sorry, thats me being unobservant.  My bad.  
Its qmailadmin that uses the same mechanism, and folders.

What I would actually recommend though, is patch lang.c to default to not 
failing on language type.

eg

Find where it fails, and change it - the failure occurs in the open_lang 
function, in the first test, so we add a very minor patch there.
eg

   /*Change the failure notice to a soft fail */
    global_error("invalid language file",1,1);

   /*Set lang to an appropriate default value (english) */
    memset(lang, 0, MAX_TMPBUF);
    strcpy (lang, "en");

and place appropriately in the lang.c file

I haven't tested this, but its a small change, and should work (famous last 
words haha).


The complete function would look something like this - I used 2.3.7, 


int open_lang( char *lang)
{
 char tmpfile[MAX_TMPBUF];
 struct stat mystat;

  /* only open files in the local directory */
  if ( strstr(lang, ".") != NULL || strstr(lang, "/") != NULL ) {

   /*Change the failure notice to a soft fail */
    global_error("invalid language file",1,1);

   /*Set lang to an appropriate default value (english) */
    memset(lang, 0, MAX_TMPBUF);
    strcpy (lang, "en");
  
  }

  if ( lang_fs == NULL ) {
    memset(tmpfile, 0, MAX_TMPBUF);
    snprintf(tmpfile, MAX_TMPBUF - 1, "html/%s", lang);
                                                                           
    /* check for symbolic link */
    if ( lstat(tmpfile, &mystat) == 0 && S_ISLNK(mystat.st_mode) ) {
      global_error("invalid file",1,0);
    }

    if ( (lang_fs=fopen(tmpfile, "r"))==NULL) return(-1);
  }
  return(0);
}




On Mar 6, 2011, at 9:03 AM, Charlie Garrison wrote:

> Good morning,
> 
> On 5/03/11 at 6:09 PM +0800, Lawrence Sheed <[email protected]> 
> wrote:
> 
>> I just tried this on mine, worked fine.
>> Changed my browser language to  en-au, and it came up with invalid language 
>> file as expected (as I hadn't made the folder yet)
> 
> I'm confused about the folder part. On my system they are language *files*, 
> not folders or directories.
> 
> $ ls -l en en-us en-au
> -rw-r--r--  1 vpopmail  vchkpw  1492 Mar  5  2008 en
> -rw-r--r--  1 vpopmail  vchkpw  1492 Mar  5  2008 en-au
> -rw-r--r--  1 vpopmail  vchkpw  1492 Mar  5  2008 en-us
> 
> $ file en en-us en-au
> en:    ASCII English text
> en-us: ASCII English text
> en-au: ASCII English text
> 
> 
>> Tested
>> cp -rp en en-au
>> 
>> ..and it comes up with the english page as expected.
>> 
>> However, I do see that Firefox uses lower case for the language encoding - 
>> Preferences, Choose Preferred Language, ...
> 
> Hmm, I had tried en-AU (rather than en-au) before and I got a server error 
> rather than invalid language error. But at that time I was using symlinks. 
> Making a copy of the file as en-AU works now.
> 
> Thanks for your help.
> 
> 
> Charlie
> 
> -- 
>   Ꮚ Charlie Garrison ♊ <[email protected]>
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> 〠  http://www.ietf.org/rfc/rfc1855.txt
> 
> 
> 
> 


!DSPAM:4d72f51a32712105516817!

Reply via email to