Map guiTranslations = new HashMap(); ResourceUtil resourceUtil = new ResourceUtil( getClass().getClassLoader() ); InputStream in = resourceUtil.open( this.environment.getVariable("polish.home"), "translations.txt"); readProperties(in, guiTranslations); in.close();  Object[] keys = guiTranslations.keySet().toArray(); for (int i = 0; i < keys.length; i++) { String key = (String) keys[i]; if ( (rawTranslations.get(key) != null) ||(rawTranslations.get("var:" + key) != null) ||(rawTranslations.get("variable:" + key) != null)) {  guiTranslations.remove(key); } else { Object value = this.environment.getVariable( key ); if (value != null) {  guiTranslations.put( key, value ); }  } } rawTranslations.putAll(guiTranslations);
	private Map loadRawTranslations( File[] resourceDirs ) throws IOException {		//System.out.println("Loading translations for locale " + this.locale);		// load the translations by following scheme:		// first load the base-translations:		// resources		// resources/vendor		// resources/group1..n		// resources/vendor/device				// Then load the locale specific resources:		// resources/locale		// resources/vendor/locale		// resources/group1..n/locale		// resources/vendor/device/locale				Map rawTranslations = new HashMap();		// load GUI translations when dynamic translations:		ResourceUtil resourceUtil = new ResourceUtil( getClass().getClassLoader() );		InputStream in = resourceUtil.open( this.environment.getVariable("polish.home"), "translations.txt");		readProperties(in, rawTranslations);		//System.out.println( this.locale + ": read " + rawTranslations.size() + " translations:");		Object[] keys = rawTranslations.keySet().toArray();		for (int i = 0; i < keys.length; i++) {			String key = (String) keys[i];			Object value = this.environment.getVariable( key );			if (value != null) {				// user-defined variables have priority over these settings:				rawTranslations.put( key, value );			}			//System.out.println(key + "=" + rawTranslations.get( key ));		}		in.close();				// load general resources:		String messagesFileName = File.separator + this.localizationSetting.getMessagesFileName();		String localeFileName;		int splitPos = messagesFileName.lastIndexOf('.');		if (splitPos != -1) {			localeFileName = messagesFileName.substring(0, splitPos)				+ "_"				+ this.locale.toString()				+ messagesFileName.substring(splitPos);		} else {			localeFileName = messagesFileName + this.locale.toString();		}		String languageFileName = null;		if (this.locale.getLocale().getCountry().length() > 0) {			// okay, this locale has also a country defined,			// so we need to look at the language-resources as well:			if (splitPos != -1) {				languageFileName = messagesFileName.substring(0, splitPos)					+ "_"					+ this.locale.getLocale().getLanguage()					+ messagesFileName.substring(splitPos);			} else {				languageFileName = messagesFileName + this.locale.getLocale().getLanguage();			}		}		for (int i = 0; i < resourceDirs.length; i++) {			File dir = resourceDirs[i];			String dirPath = dir.getAbsolutePath();			File messagesFile = new File( dirPath + messagesFileName );			if (messagesFile.exists()) {				//System.out.println("Loading translations from " + messagesFile.getAbsolutePath() );				if (messagesFile.lastModified() > this.lastModificationTime) {					this.lastModificationTime = messagesFile.lastModified();				}				//System.out.println("Reading translations from " + messagesFile.getAbsolutePath() );				readPropertiesFile(messagesFile, rawTranslations );			}			if (languageFileName != null) {				messagesFile = new File( dirPath + languageFileName );				if (messagesFile.exists()) {					//System.out.println("Loading translations from " + messagesFile.getAbsolutePath() );					if (messagesFile.lastModified() > this.lastModificationTime) {						this.lastModificationTime = messagesFile.lastModified();					}					//System.out.println("Reading translations from " + messagesFile.getAbsolutePath() );					readPropertiesFile(messagesFile, rawTranslations );				}			}			messagesFile = new File( dirPath + localeFileName );			if (messagesFile.exists()) {				//System.out.println("Loading translations from " + messagesFile.getAbsolutePath() );				if (messagesFile.lastModified() > this.lastModificationTime) {					this.lastModificationTime = messagesFile.lastModified();				}				//System.out.println("Reading translations from " + messagesFile.getAbsolutePath() );				readPropertiesFile(messagesFile, rawTranslations );			}		}		return rawTranslations;	}