bool IEAcceptLanguagesAction::_isCurrentLanguageOk(wstring& firstlang)
{
	wstring langcode;

	_readLanguageCode(langcode);
	_parseLanguage(langcode);
	_getFirstLanguage(firstlang);

	// IE 6.0 uses two digit language codes, after IE 6 can also include country
	return firstlang.compare(L"ca-es") == 0 || firstlang.compare(L"ca") == 0;
}
bool FirefoxAction::_readLanguageCode()
{	
	wstring location, line, langcode;
	wifstream reader;

	if (m_CachedLanguageCode == true)
		return true;	
	
	if (_getPreferencesFile(location) == false)
	{
		g_log.Log(L"FirefoxAction::_readLanguageCode. No preferences file found. Firefox is not installed");
		return false;
	}
	reader.open(location.c_str());

	if (reader.is_open())
	{
		int start, end;

		while(!reader.eof())
		{	
			getline(reader,line);
			start = line.find(USER_PREF);

			if (start == wstring::npos)
				continue;

			start+=wcslen(USER_PREF);

			end = line.find(L"\"", start);

			if (end == wstring::npos)
				continue;

			langcode = line.substr(start, end - start);
			_parseLanguage(langcode);
			break;
		}
	}
	else
	{
		g_log.Log(L"FirefoxAction::_readLanguageCode cannot open %s", (wchar_t *) location.c_str());
		return false;
	}

	reader.close();
	g_log.Log(L"FirefoxAction::_readLanguageCode open %s", (wchar_t *) location.c_str());
	m_CachedLanguageCode = true;
	return true;
}