// $Id: MessageIDs.cpp 8019 2007-07-14 22:30:11Z trick $

/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Deadly Rooms of Death.
 *
 * The Initial Developer of the Original Code is
 * Caravel Software.
 * Portions created by the Initial Developer are Copyright (C) 1995, 1996, 
 * 1997, 2000, 2001, 2002 Caravel Software. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */

#include "MessageIDs.h"

using namespace Language;

const char szEnglish[] = "English";
const char szFrench[] = "French";
const char szRussian[] = "Russian";

const WCHAR wszEnglish[] = {{'E'},{'n'},{'g'},{'l'},{'i'},{'s'},{'h'},{0}};
const WCHAR wszFrench[] = {{'F'},{'r'},{'e'},{'n'},{'c'},{'h'},{0}};
const WCHAR wszRussian[] = {{'R'},{'u'},{'s'},{'s'},{'i'},{'a'},{'n'},{0}};

#ifdef RUSSIAN_BUILD
LANGUAGE m_eLanguageCode = Language::Russian;
#else
LANGUAGE m_eLanguageCode = Language::English;
#endif

//*****************************************************************************
LANGUAGE Language::Get(const char* pStr, const UINT wStrLen)
{
	if (strncmp(pStr, szEnglish, wStrLen)==0)
		return English;
	if (strncmp(pStr, szFrench, wStrLen)==0)
		return French;
	if (strncmp(pStr, szRussian, wStrLen)==0)
		return Russian;

	return Unknown;
}

//*****************************************************************************
LANGUAGE Language::Get(const WCHAR* pwStr, const UINT wStrLen)
{
	if (WCSncmp(pwStr, wszEnglish, wStrLen)==0)
		return English;
	if (WCSncmp(pwStr, wszFrench, wStrLen)==0)
		return French;
	if (WCSncmp(pwStr, wszRussian, wStrLen)==0)
		return Russian;

	return Unknown;
}

//*****************************************************************************
LANGUAGE Language::GetLanguage()
{
	return m_eLanguageCode;
}

//*****************************************************************************
void Language::SetLanguage(const LANGUAGE eSetLanguageCode)
{
	m_eLanguageCode = eSetLanguageCode;
}
