view pwplib/locale.c @ 64:c272f66c5eb8

Add pwplib_end() to public header.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Aug 2011 10:41:08 +0300
parents 676c6104ee22
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>

#include "pwplib.h"

char* pwp_get_locale()
{
#ifdef __POSIX__
   int i=3;
   char *z;

   while(i)
   {
      i--;
      if(i==2)
         z=getenv("LANG");
         else
      if(i==1)
         z=getenv("LC_ALL");
         else
         {
            z=getenv("HOST");
            if(z!=NULL)z+=strlen(z)-2;
         }

      if(z!=NULL)
      {
         if(z[0]=='f' && z[1]=='i')return "fi";
         if(z[0]=='F' && z[1]=='I')return "fi";
      }
   }

   return "en";
#else
   return "fi";
#endif
}