--- scite-1.63.orig/scite/src/SciTEProps.cxx	2005-05-12 00:49:45.000000000 +0000
+++ scite-1.63/scite/src/SciTEProps.cxx	2005-05-10 20:36:20.000000000 +0000
@@ -12,6 +12,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <locale.h>
+#include <unistd.h>
 
 #include "Platform.h"
 
@@ -303,14 +304,23 @@
 }
 
 void SciTEBase::ReadLocalPropFile() {
-	char propdir[MAX_PATH + 20];
-	GetDocumentDirectory(propdir, sizeof(propdir));
+	char propdir[MAX_PATH + 20];
+	char *home;
+	home = getenv("HOME");
+	if (home!=NULL) {
+		strncpy(propdir,  home, sizeof(propdir)-2);
+		strcat(propdir, "/.");
+	}
+	else {
+		GetDocumentDirectory(propdir, sizeof(propdir));
+	}
 	char propfile[MAX_PATH + 20];
 	strcpy(propfile, propdir);
 #ifndef __vms
-
+	if (home==NULL) {
 	strcat(propdir, pathSepString);
-	strcat(propfile, pathSepString);
+	strcat(propfile, pathSepString);
+	}
 #endif
 
 	strcat(propfile, propFileName);
@@ -1278,7 +1288,7 @@
 		translation.substitute("^2", param2);
 	return translation;
 }
-
+/*
 void SciTEBase::ReadLocalisation() {
 	char propfile[MAX_PATH + 20];
 	char propdir[MAX_PATH + 20];
@@ -1295,6 +1305,66 @@
 	}
 	localisationRead = true;
 }
+*/
+
+void SciTEBase::ReadLocalisation() {
+	char propfile[MAX_PATH + 20];
+	char propdir[MAX_PATH + 20];
+	char basetitle[MAX_PATH + 20];
+	const char *title;
+	char shortlang[6];
+	bool loaded = false;
+	propsUI.Clear();
+	char *lang;
+	if (!loaded) {	
+		title = "locale.properties";
+		SString localeProps = props.GetExpanded(title);
+		if (localeProps.length()) {
+		title = localeProps.c_str();
+		}
+		if (GetSciteDefaultHome(propdir, sizeof propdir)
+		    && BuildPath(propfile, propdir, title, sizeof propfile)) {
+			strcat(propdir, pathSepString);
+			loaded = propsUI.Read(propfile, propdir, importFiles, importMax);
+		}
+	}
+	if (!loaded) {	
+		lang = getenv("LANG");
+		if (lang!=NULL) {
+			if (!loaded) {
+				memcpy(shortlang, lang, 5);
+				shortlang[5]=0;
+				snprintf(basetitle, sizeof(basetitle), "locale/locale.%s.properties", shortlang);
+				SString localeProps = props.GetExpanded(basetitle);
+				if (localeProps.length())
+					title = localeProps.c_str();
+				else
+					title = basetitle;
+				if (GetSciteDefaultHome(propdir, sizeof propdir)
+				    && BuildPath(propfile, propdir, title, sizeof propfile)) {
+					strcat(propdir, pathSepString);
+					loaded = propsUI.Read(propfile, propdir, importFiles, importMax);
+				}
+			}
+			if (!loaded) {
+				memcpy(shortlang, lang, 2);
+				shortlang[2]=0;
+				snprintf(basetitle, sizeof(basetitle), "locale/locale.%s.properties", shortlang);
+				SString localeProps = props.GetExpanded(title);
+				if (localeProps.length())
+					title = localeProps.c_str();
+				else
+					title = basetitle;
+				if (GetSciteDefaultHome(propdir, sizeof propdir)
+				    && BuildPath(propfile, propdir, title, sizeof propfile)) {
+					strcat(propdir, pathSepString);
+					loaded = propsUI.Read(propfile, propdir, importFiles, importMax);
+				}
+			}
+		}
+	}
+	localisationRead = true;
+}
 
 void SciTEBase::ReadPropertiesInitial() {
 	SetPropertiesInitial();
@@ -1404,13 +1474,23 @@
 	char propfile[MAX_PATH + 20];
 	char propdir[MAX_PATH + 20];
 	if (propsFile == IDM_OPENLOCALPROPERTIES) {
-		GetDocumentDirectory(propfile, sizeof(propfile));
+		char *home;
+		home = getenv("HOME");
+		if (home!=NULL) {
+			strncpy(propfile,  home, sizeof(propdir)-2);
+			strcat(propfile, "/.");
+		}
+		else {
+			GetDocumentDirectory(propfile, sizeof(propfile));
+		}		
 #ifdef __vms
 
 		strcpy(propfile, VMSToUnixStyle(propfile));
 #endif
 
-		strcat(propfile, pathSepString);
+		if (home==NULL) {
+		strcat(propfile, pathSepString);
+		}
 		strcat(propfile, propFileName);
 		Open(propfile, ofQuiet);
 	} else if (propsFile == IDM_OPENUSERPROPERTIES) {
