--- solenv/bin/make_installer.pl
+++ solenv/bin/make_installer.pl
@@ -549,13 +549,15 @@
 	if ( $installer::globals::is_unix_multi ) { $loglanguagestring = $installer::globals::unixmultipath_orig; }
 
 	my $loglanguagestring_orig = $loglanguagestring;
-	if (length($loglanguagestring) > 120)
+	if (length($loglanguagestring) > 32)
 	{
 	    chomp(my $shorter = `echo $loglanguagestring | md5sum | sed -e "s/ .*//g"`);
 	    $loglanguagestring = $shorter;
 	}
 
-	$installer::globals::logfilename = "log_" . $installer::globals::build . "_" . $logminor . "_" . $loglanguagestring . ".log";
+	$installer::globals::logfilename = "log_" . $installer::globals::build;
+	$installer::globals::logfilename .= "_" . $logminor if ($logminor ne '');
+	$installer::globals::logfilename .= ".log";
 
 	if (( ! $installer::globals::is_unix_multi ) || ( $isfirstrun )) { $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator; }
 
dummy line to avoid confusing diff-mode
--- solenv/bin/modules/installer/systemactions.pm
+++ solenv/bin/modules/installer/systemactions.pm
@@ -196,6 +196,11 @@
 		if (!($locallanguagesref eq "" ))	# this will be a path like "01_49", for Profiles and ConfigurationFiles, idt-Files
 		{
 			my $languagestring = $$languagesref;
+			if (length($languagestring) > 32)
+			{
+			    chomp(my $shorter = `echo $languagestring | md5sum | sed -e "s/ .*//g"`);
+			    $languagestring = $shorter;
+		    	}
 			if ($installer::globals::is_unix_multi) { $languagestring = $installer::globals::unixmultipath; }
 			$path = $path . $languagestring  . $installer::globals::separator;
 			create_directory($path);			
dummy line to avoid confusing diff-mode
--- ../../../2.0.2-pristine/build/OOO_2_0_2/scp2/source/ooo/file_library_ooo.scp	2006-06-02 13:06:38.003914500 +0000
+++ scp2/source/ooo/file_library_ooo.scp	2006-05-31 16:15:01.893875000 +0000
@@ -2414,3 +2425,13 @@
 End
 #endif
 
+#ifdef WNT
+
+File gid_File_Lib_sellangmsi
+    TXT_FILE_BODY;
+    Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
+    Dir = gid_Dir_Program;
+    Name = "sellangmsi.dll";
+End
+
+#endif
dummy line to avoid confusing diff-mode
--- ../../../2.0.2-pristine/build/OOO_2_0_2/scp2/source/ooo/windowscustomaction_ooo.scp	2006-02-16 14:16:57.000000000 +0000
+++ scp2/source/ooo/windowscustomaction_ooo.scp	2006-06-02 08:03:48.643875000 +0000
@@ -316,3 +316,12 @@
       Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\" And Not PATCH", "CostInitialize");
       Assignment2 = ("InstallUISequence", "Not REMOVE=\"ALL\" And Not PATCH", "CostInitialize");
 End
+
+WindowsCustomAction gid_Customaction_SelectLanguage
+	Name = "SelectLanguage";
+	Typ = "321";
+	Source = "sellangmsi.dll";
+	Target = "SelectLanguage";
+	Inbinarytable = 1;
+	Assignment1 = ("ControlEvent", "SetupType", "Next", "DoAction", "SelectLanguage", "1", "1");
+End
--- ../../../2.0.2-pristine/build/OOO_2_0_2/setup_native/prj/build.lst	2006-02-16 14:15:43.000000000 +0000
+++ setup_native/prj/build.lst	2006-05-31 12:16:31.550125000 +0000
@@ -5,6 +5,7 @@
 pk  setup_native\source\win32\customactions\regpatchactivex nmake -  w   sn_regpatchactivex NULL
 pk  setup_native\source\win32\customactions\reg4msdoc     nmake   -  w   sn_reg4msdoc NULL
 pk  setup_native\source\win32\customactions\regpython     nmake   -  w   sn_regpython NULL
+pk  setup_native\source\win32\customactions\sellang       nmake   -  w   sn_sellang NULL
 pk  setup_native\source\win32\customactions\javafilter    nmake   -  w   sn_javafilter NULL
 pk  setup_native\source\win32\customactions\quickstarter  nmake   -  w   sn_quickstarter NULL
 pk  setup_native\source\win32\customactions\shellextensions nmake   -  w   sn_shellextensions NULL
--- /dev/null
+++ setup_native/source/win32/customactions/sellang/exports.dxp	2006-05-31 12:15:54.268875000 +0000
@@ -0,0 +1 @@
+SelectLanguage
--- /dev/null
+++ setup_native/source/win32/customactions/sellang/makefile.mk	2006-05-31 12:13:28.331375000 +0000
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+#   OpenOffice.org - a multi-platform office productivity suite
+#
+#   $RCSfile$
+#
+#   $Revision: 8917 $
+#
+#   last change: $Author: tml $ $Date: 2007-02-26 14:21:06 +0100 (Po, 26 úno 2007) $
+#
+#   The Contents of this file are made available subject to
+#   the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+#     GNU Lesser General Public License Version 2.1
+#     =============================================
+#     Copyright 2005 by Sun Microsystems, Inc.
+#     901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+#     This library is free software; you can redistribute it and/or
+#     modify it under the terms of the GNU Lesser General Public
+#     License version 2.1, as published by the Free Software Foundation.
+#
+#     This library is distributed in the hope that it will be useful,
+#     but WITHOUT ANY WARRANTY; without even the implied warranty of
+#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#     Lesser General Public License for more details.
+#
+#     You should have received a copy of the GNU Lesser General Public
+#     License along with this library; if not, write to the Free Software
+#     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+#     MA  02111-1307  USA
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+PRJNAME=setup_native
+TARGET=sellangmsi
+
+.IF "$(GUI)"=="WNT"
+
+# --- Settings -----------------------------------------------------
+
+ENABLE_EXCEPTIONS=TRUE
+NO_DEFAULT_STL=TRUE
+DYNAMIC_CRT=
+USE_DEFFILE=TRUE
+
+.INCLUDE : settings.mk
+
+CFLAGS+=-D_STLP_USE_STATIC_LIB
+
+# --- Files --------------------------------------------------------
+
+UWINAPILIB=
+
+SLOFILES = \
+	$(SLO)$/sellang.obj
+
+SHL1STDLIBS=	kernel32.lib\
+				user32.lib\
+				advapi32.lib\
+				shell32.lib\
+				msi.lib\
+				$(LIBSTLPORTST)								
+
+SHL1LIBS = $(SLB)$/$(TARGET).lib 
+
+SHL1TARGET = $(TARGET)
+SHL1IMPLIB = i$(TARGET)
+
+SHL1DEF = $(MISC)$/$(SHL1TARGET).def
+SHL1DEPN = $(SLB)$/$(TARGET).lib
+SHL1BASE = 0x1c000000
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# -------------------------------------------------------------------------
+
+
+.ENDIF
+
--- /dev/null
+++ setup_native/source/win32/customactions/sellang/sellang.cxx	2006-06-02 09:13:53.893875000 +0000
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision: 8917 $
+ *
+ *  last change: $Author: tml $ $Date: 2007-02-26 14:21:06 +0100 (Po, 26 úno 2007) $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#define WIN32_LEAN_AND_MEAN
+#define _WIN32_WINNT 0x0500
+#undef WINVER
+#define WINVER 0x0500
+
+#pragma warning(push, 1) /* disable warnings within system headers as
+                          * warnings are now treated as errors...
+                          */
+#include <windows.h>
+#include <msiquery.h>
+#include <malloc.h>
+
+#ifdef UNICODE
+#define _UNICODE
+#define _tstring	wstring
+#else
+#define _tstring	string
+#endif
+#include <tchar.h>
+#include <string>
+#include <stdio.h>
+#pragma warning(pop)
+
+#include <systools/win32/uwinapi.h>
+
+/* #define VERBOSE_DEBUG_OUTPUT 1 */
+
+static const char *
+langid_to_string( LANGID langid, int *have_default_lang )
+{
+	/* Map from LANGID to string. The languages below are in the same
+	 * seemingly random order as in
+	 * setup_native/source/win32/msi-encodinglist.txt.
+	 *
+	 * Unfortunately we can't turn the LANGID into a LCID and call
+	 * GetLocaleInfo with LOCALE_SISO639LANGNAME and maybe
+	 * LOCALE_SISO3166CTRYNAME here as OOo uses somewhat ad-hoc naming
+	 * conventions for its localisations. We would have to have lots of
+	 * special cases.
+	 *
+	 * For example: For Finnish, just fetching the LOCALE_SISO639LANGNAME
+	 * would be fine, OOo uses just "fi". For Marathi we would need to fetch also
+	 * the LOCALE_SISO3166CTRYNAME as OOo uses "mr-IN" even if Marathi isn't spoken
+	 * outside India.
+	 */
+	switch (langid) {
+#define CASE(primary, sub, name) \
+		case MAKELANGID(LANG_##primary, SUBLANG_##sub): return #name
+		
+	case MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT): if (have_default_lang) *have_default_lang = 1; return "en-US";
+	case MAKELANGID(LANG_SERBIAN, 0x05): return "bs";
+	CASE(PORTUGUESE, PORTUGUESE, pt);
+	CASE(RUSSIAN, DEFAULT, ru);
+	CASE(GREEK, DEFAULT, el);
+	CASE(DUTCH, DEFAULT, nl);
+	CASE(FRENCH, DEFAULT, fr);
+	CASE(FRENCH, FRENCH_CANADIAN, fr-CA);
+	CASE(SPANISH, DEFAULT, es);
+	CASE(FINNISH, DEFAULT, fi);
+	CASE(HUNGARIAN, DEFAULT, hu);
+	CASE(CATALAN, DEFAULT, ca);
+	CASE(ITALIAN, DEFAULT, it);
+	CASE(CZECH, DEFAULT, cs);
+	CASE(SLOVAK, DEFAULT, sk);
+	CASE(ENGLISH, ENGLISH_UK, en-GB);
+	CASE(ENGLISH, ENGLISH_SOUTH_AFRICA, en-ZA);
+	CASE(DANISH, DEFAULT, da);
+	CASE(SWEDISH, DEFAULT, sv);
+	CASE(NORWEGIAN, NORWEGIAN_BOKMAL, nb);
+	CASE(NORWEGIAN, NORWEGIAN_NYNORSK, nn);
+	CASE(POLISH, DEFAULT, pl);
+	CASE(GERMAN, DEFAULT, de);
+	CASE(PORTUGUESE, PORTUGUESE_BRAZILIAN, pt-BR);
+	CASE(THAI, DEFAULT, th);
+	CASE(ESTONIAN, DEFAULT, et);
+	CASE(JAPANESE, DEFAULT, ja);
+	CASE(KOREAN, DEFAULT, ko);
+	// CASE(KHMER, DEFAULT, km);
+	// CASE(WELSH, DEFAULT, cy);
+	CASE(CHINESE, CHINESE_SIMPLIFIED, zh-CN);
+	CASE(CHINESE, CHINESE_TRADITIONAL, zh-TW);
+	CASE(TURKISH, DEFAULT, tr);
+	CASE(HINDI, DEFAULT, hi-IN);
+	CASE(PUNJABI, DEFAULT, pa-IN);
+	CASE(TAMIL, DEFAULT, ta-IN);
+	CASE(ARABIC, DEFAULT, ar);
+	CASE(HEBREW, DEFAULT, he);
+	CASE(AFRIKAANS, DEFAULT, af);
+	CASE(ALBANIAN, DEFAULT, sq);
+	CASE(ARMENIAN, DEFAULT, hy);
+	CASE(BASQUE, DEFAULT, eu);
+	CASE(BELARUSIAN, DEFAULT, be-BY);
+	case MAKELANGID(LANG_BENGALI, 0x02): return "bn-BD";
+	CASE(BENGALI, DEFAULT, bn-IN);
+	CASE(BULGARIAN, DEFAULT, bg);
+	CASE(ICELANDIC, DEFAULT, is);
+	CASE(INDONESIAN, DEFAULT, id);
+	// CASE(LAO, DEFAULT, lo);
+	CASE(LATVIAN, DEFAULT, lv);
+	CASE(LITHUANIAN, DEFAULT, lt);
+	// CASE(MALTESE, DEFAULT, mt);
+	// CASE(ROMANSH, DEFAULT, rm);
+	CASE(ROMANIAN, DEFAULT, ro);
+	// CASE(KINYARWANDA, DEFAULT, rw);
+	CASE(SANSKRIT, DEFAULT, sa);
+	// CASE(SERBIAN, SERBIAN_CYRILLIC, sr-SP);
+	// CASE(SETSWANA, DEFAULT, tn);
+	CASE(SERBIAN, DEFAULT, hr);
+	CASE(FARSI, DEFAULT, fa);
+	CASE(FAEROESE, DEFAULT, fo);
+	CASE(SLOVENIAN, DEFAULT, sl);
+	// CASE(SORBIAN, DEFAULT, sb);
+	// CASE(SUTU, DEFAULT, st);
+	CASE(SWAHILI, DEFAULT, sw-TZ); // MSFT says Kenya, but OOo has Tanzania
+	CASE(TATAR, DEFAULT, tt);
+	// CASE(TSONGA, DEFAULT, ts);
+	CASE(UKRAINIAN, DEFAULT, uk);
+	CASE(URDU, DEFAULT, ur);
+	CASE(VIETNAMESE, DEFAULT, vi);
+	// CASE(XHOSA, DEFAULT, xh);
+	// CASE(SOTHO, DEFAULT, ns);
+	// CASE(YIDDISH, DEFAULT, yi);
+	// CASE(ZULU, DEFAULT, zu);
+	CASE(GUJARATI, DEFAULT, gu-IN);
+	// CASE(BRETON, DEFAULT, br);
+	CASE(NEPALI, DEFAULT, ne);
+	CASE(SERBIAN, SERBIAN_LATIN, sh-YU);
+	CASE(SERBIAN, SERBIAN_CYRILLIC, sr-CS);
+	// CASE(NDEBELE, DEFAULT, nr);
+	// CASE(SWAZI, DEFAULT, ss);
+	// CASE(SOTHO, SOTHO_SOUTHERN, st);
+	// CASE(VENDA, DEFAULT, ve);
+	// CASE(IRISH, DEFAULT, ga);
+	CASE(MACEDONIAN, DEFAULT, mk);
+	CASE(TELUGU, DEFAULT, te-IN);
+	CASE(MALAYALAM, DEFAULT, ml-IN);
+	CASE(MARATHI, DEFAULT, mr-IN);
+	CASE(URDU, URDU_INDIA, ur-IN);
+	CASE(ORIYA, DEFAULT, or-IN);
+	// CASE(KURDISH, DEFAULT, ku);
+	// CASE(TAGALOG, DEFAULT, tg);
+	// CASE(TIGRINYA, DEDAULT, ti-ER);
+	CASE(GALICIAN, DEFAULT, gl);
+	CASE(KANNADA, DEFAULT, kn);
+	CASE(MALAY, DEFAULT, ms);
+	// CASE(TAJIK, DEFAULT, tg);
+	CASE(GEORGIAN, DEFAULT, ka);
+	// CASE(ESPERANTO, DEFAULT, eo);
+#undef CASE
+	default: return "";
+	}
+}
+
+static const char *ui_langs[100];
+static int num_ui_langs = 0;
+
+BOOL CALLBACK
+enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
+{
+	long langid = strtol(language, NULL, 16);
+	if (langid > 0xFFFF)
+		return TRUE;
+	ui_langs[num_ui_langs] = langid_to_string((LANGID) langid, NULL);
+	num_ui_langs++;
+	if (num_ui_langs == sizeof(ui_langs) / sizeof(ui_langs[0]))
+		return FALSE;
+	return TRUE;
+}
+
+static BOOL
+present_in_ui_langs(const char *lang)
+{
+	for (int i = 0; i < num_ui_langs; i++)
+		if (strcmp(ui_langs[i], lang) == 0)
+			return TRUE;
+	return FALSE;
+}
+
+extern "C" UINT __stdcall SelectLanguage( MSIHANDLE handle )
+{
+#ifdef VERBOSE_DEBUG_OUTPUT
+	char tem[2000];
+#endif
+	char feature[100];
+	MSIHANDLE database, view, record;
+	DWORD length;
+	int nlangs = 0;
+	/* Keeping this code simple and stupid... won't bother with any
+	 * dynamic arrays or whatnot. 100 is more than enough for this purpose.
+	 */
+	char langs[100][6];
+
+	database = MsiGetActiveDatabase(handle);
+
+	if (MsiDatabaseOpenViewA(database, "SELECT Feature from Feature", &view) != ERROR_SUCCESS) {
+		MsiCloseHandle(database);
+		return ERROR_SUCCESS;
+	}
+
+#ifdef VERBOSE_DEBUG_OUTPUT
+	MessageBoxA(NULL, "MsiDatabaseOpenViewA success!", "SelectLanguage", MB_OK);
+#endif
+
+	if (MsiViewExecute(view, NULL) != ERROR_SUCCESS) {
+		MsiCloseHandle(view);
+		MsiCloseHandle(database);
+		return ERROR_SUCCESS;
+	}
+
+#ifdef VERBOSE_DEBUG_OUTPUT
+	MessageBoxA(NULL, "MsiViewExecute success!", "SelectLanguage", MB_OK);
+#endif
+
+	while (MsiViewFetch(view, &record) == ERROR_SUCCESS) {
+		length = sizeof(feature);
+		if (MsiRecordGetStringA(record, 1, feature, &length) != ERROR_SUCCESS) {
+			MsiCloseHandle(record);
+			MsiCloseHandle(view);
+			MsiCloseHandle(database);
+			return ERROR_SUCCESS;
+		}
+
+		/* Keep track of what languages are included in this installer, if
+		 * it is a multilangiage one.
+		 */
+		if (strncmp (feature, "gm_Dynamic_Language_", strlen ("gm_Dynamic_Language_")) == 0 &&
+			strcmp(feature, "gm_Dynamic_Language_TOP") != 0 &&
+			strcmp(feature, "gm_Dynamic_Language_en-US") != 0 &&
+			strlen(feature) <= strlen("gm_Dynamic_Language_xx-XX"))
+			strcpy(langs[nlangs++], feature + strlen("gm_Dynamic_Language_"));
+
+		MsiCloseHandle(record);
+	}
+
+	MsiCloseHandle(view);
+
+	if (nlangs > 0) {
+		/* Deselect those languages that don't match any of the UI languages
+		 * availableon the system.
+		 */
+
+		int i;
+		int have_system_default_lang = 0;
+		const char *system_default_lang = langid_to_string(GetSystemDefaultUILanguage(), &have_system_default_lang);
+		const char *user_locale_lang = langid_to_string(LANGIDFROMLCID(GetThreadLocale()), NULL);
+
+#ifdef VERBOSE_DEBUG_OUTPUT
+		sprintf(tem, "GetSystemDefaultUILanguage(): %#x = %s", GetSystemDefaultUILanguage(), system_default_lang);
+		MessageBoxA(NULL, tem, "SelectLanguage", MB_OK);
+#endif
+
+		EnumUILanguagesA(enum_ui_lang_proc, 0, 0);
+
+#ifdef VERBOSE_DEBUG_OUTPUT
+		sprintf(tem, "Have %d UI languages: ", num_ui_langs);
+		for (i = 0; i < num_ui_langs; i++) {
+			char *p = tem + strlen(tem);
+			sprintf(p, "%s%s", 
+			        ui_langs[i],
+			        (i + 1 < num_ui_langs) ? ", " : "");
+		}
+		MessageBoxA(NULL, tem, "SelectLanguage", MB_OK);
+#endif
+
+		/* If one of the alternative languages in a multi-language installer
+		 * is the system default UI language, deselect those languages that
+		 * aren't among the UI languages available on the system.
+		 * (On most Windows installations, just one UI language is present,
+		 * which obviously is the same as the default UI language. But
+		 * we want to be generic.)
+		 */
+		if (system_default_lang[0]) {
+			for (i = 0; i < nlangs; i++) {
+				if (strcmp (system_default_lang, langs[i]) == 0) {
+#ifdef VERBOSE_DEBUG_OUTPUT
+					sprintf(tem, "We have the system default language %s in the installer", system_default_lang);
+					MessageBoxA(NULL, tem, "SelectLanguage", MB_OK);
+#endif
+					have_system_default_lang = 1;
+				}
+			}
+		}
+
+		if (have_system_default_lang) {
+			for (i = 0; i < nlangs; i++) {
+				if (strcmp(system_default_lang, langs[i]) != 0 &&
+					strcmp(user_locale_lang, langs[i]) != 0 &&
+					!present_in_ui_langs(langs[i])) {
+					UINT rc;
+					sprintf(feature, "gm_Dynamic_Language_%s", langs[i]);
+					rc = MsiSetFeatureStateA(handle, feature, INSTALLSTATE_ABSENT); 
+					if (rc != ERROR_SUCCESS) {
+#ifdef VERBOSE_DEBUG_OUTPUT
+						sprintf(tem, "MsiSetFeatureStateA %s failed: %d", feature, rc);
+						MessageBoxA(NULL, tem, "SelectLanguage", MB_OK);
+#endif
+					} else {
+#ifdef VERBOSE_DEBUG_OUTPUT
+						sprintf(tem, "MsiSetFeatureStateA %s OK!", feature);
+						MessageBoxA(NULL, tem, "SelectLanguage", MB_OK);
+#endif
+					}
+				}
+			}
+		}
+	}
+
+	MsiCloseHandle(database);
+
+	return ERROR_SUCCESS;
+}
