public static function llXmlAutoFileName($fileRef, $language, $sameLocation = FALSE) {
		if ($sameLocation) {
			$location = 'EXT:';
		} else {
			$location = 'typo3conf/l10n/' . $language . '/'; // Default location of translations
		}

			// Analyse file reference:
		if (self::isFirstPartOfStr($fileRef, PATH_typo3 . 'sysext/')) { // Is system:
			$validatedPrefix = PATH_typo3 . 'sysext/';
			#$location = 'EXT:csh_'.$language.'/';	// For system extensions translations are found in "csh_*" extensions (language packs)
		} elseif (self::isFirstPartOfStr($fileRef, PATH_typo3 . 'ext/')) { // Is global:
			$validatedPrefix = PATH_typo3 . 'ext/';
		} elseif (self::isFirstPartOfStr($fileRef, PATH_typo3conf . 'ext/')) { // Is local:
			$validatedPrefix = PATH_typo3conf . 'ext/';
		} elseif (self::isFirstPartOfStr($fileRef, PATH_site . 'typo3_src/tests/')) { // Is test:
			$validatedPrefix = PATH_site . 'typo3_src/tests/';
			$location = $validatedPrefix;
		} else {
			$validatedPrefix = '';
		}

		if ($validatedPrefix) {

				// Divide file reference into extension key, directory (if any) and base name:
			list($file_extKey, $file_extPath) = explode('/', substr($fileRef, strlen($validatedPrefix)), 2);
			$temp = self::revExplode('/', $file_extPath, 2);
			if (count($temp) == 1) {
				array_unshift($temp, '');
			} // Add empty first-entry if not there.
			list($file_extPath, $file_fileName) = $temp;

				// If $fileRef is already prefix with "[language key]" then we should return it as this
			if (substr($file_fileName, 0, strlen($language) + 1) === $language . '.') {
				return $fileRef;
			}

				// The filename is prefixed with "[language key]." because it prevents the llxmltranslate tool from detecting it.
			return $location .
					$file_extKey . '/' .
					($file_extPath ? $file_extPath . '/' : '') .
					$language . '.' . $file_fileName;
		} else {
			return NULL;
		}
	}