コード例 #1
0
void CEditLanguageDialog::OnButtonAdd( wxCommandEvent& /*event*/ )
{
    if (m_pButtonAdd->GetLabel() == _T("Add") ||
        m_pButtonAdd->GetLabel() == CLanguageManager::GetInstance()->GetText(eL_Add))
    {
        AddSaveButtonPrompt();
        if (m_bAddSaveSuc)
        {
            AddLanguage();
            AppendDataViewListCtrl();
            ClearTextCtrl();
            m_pSrchCtrl->SetValue(_T(""));
        }
        m_bAddSaveSuc = false;
    }
    else if (m_pButtonAdd->GetLabel() == _T("Save") ||
        m_pButtonAdd->GetLabel() == CLanguageManager::GetInstance()->GetText(eL_Save))
    {
        AddSaveButtonPrompt();
        if (m_bAddSaveSuc)
        {
            m_pButtonAdd->SetLabel(m_bISLanguageSwitch ? CLanguageManager::GetInstance()->GetText(eL_Add) : _T("Add"));
            DleLanguage();
            AddLanguage();
            AppendDataViewListCtrl();
            ClearTextCtrl();
            m_pSrchCtrl->SetValue(_T(""));
        }
        m_bAddSaveSuc = false;
        m_bIsChange = false;
        m_bIsSave = false;
    }
}
コード例 #2
0
ファイル: LanguageList.cpp プロジェクト: nr-plugins/resedit
/*********************************************************************\
	Function name    : CLanguageList::Init
	Description      :
	Created at       : 26.09.01, @ 16:11:23
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CLanguageList::Init()
{
	Filename resourcepath = GeGetStartupPath() + Filename("resource");

	if (GetC4DVersion() >= 16000) {
		// R16 has a new resource directory structure. The c4d_language.str
		// files we are searching for are in resource/modules/c4dplugin/strings_xx.
		// Fix for https://github.com/nr-plugins/resedit/issues/4
		resourcepath = resourcepath + "modules" + "c4dplugin";
	}

	AutoAlloc <BrowseFiles> pBrowse;
	pBrowse->Init(resourcepath, false);

	while (pBrowse->GetNext())
	{
		if (pBrowse->IsDir())
		{
			Filename fn = pBrowse->GetFilename();
			if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
			{
				String idx = fn.GetString();
				idx.Delete(0, 8);

				Filename stringname = resourcepath + fn+Filename("c4d_language.str");
				AutoAlloc <BaseFile> pFile;
				if (!pFile)
					return;
				if (!GeFExist(stringname))
				{
					GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
				}
				else if (pFile->Open(stringname))
				{
					Int32 len = pFile->GetLength();
					Char *buffer = NewMemClear(Char,len + 2);
					if (buffer)
					{
						pFile->ReadBytes(buffer,len);
						buffer[len]=0;

						Int32 i;

						for (i = 0; i < len && buffer[i] >= ' '; i++) { }
						buffer[i] = 0;

						for (i--; i > 0 && buffer[i]== ' '; i--) { }
						buffer[i + 1] = 0;

						AddLanguage(buffer, idx);
						DeleteMem(buffer);
					}
				}
			}
		}
	}

	CriticalAssert(GetNumLanguages() > 0);
}
コード例 #3
0
ファイル: Translator.cpp プロジェクト: asceth/synapi
void Translator::OnSourceModAllInitialized()
{
	AddLanguage("en", "English");

	g_pCorePhrases = CreatePhraseCollection();
	g_pCorePhrases->AddPhraseFile("core.phrases");

	g_ShareSys.AddInterface(NULL, this);
}
コード例 #4
0
ファイル: Translator.cpp プロジェクト: asceth/synapi
SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
{
	size_t len = strlen(key);

	if (len < 2 || len > 3)
	{
		g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
		g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
	}

	AddLanguage(key, value);

	return SMCResult_Continue;
}
コード例 #5
0
ファイル: LanguageList.cpp プロジェクト: phohale/ResEdit
/*********************************************************************\
	Function name    : CLanguageList::Init
	Description      :
	Created at       : 26.09.01, @ 16:11:23
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CLanguageList::Init()
{
	Filename resourcepath = GeGetStartupPath() + Filename("resource");
	AutoAlloc <BrowseFiles> pBrowse;
	pBrowse->Init(resourcepath, false);

	while (pBrowse->GetNext())
	{
		if (pBrowse->IsDir())
		{
			Filename fn = pBrowse->GetFilename();
			if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
			{
				String idx = fn.GetString();
				idx.Delete(0, 8);

				Filename stringname = resourcepath + fn+Filename("c4d_language.str");
				AutoAlloc <BaseFile> pFile;
				if (!pFile)
					return;
				if (!GeFExist(stringname))
				{
					GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
				}
				else if (pFile->Open(stringname))
				{
					Int32 len = pFile->GetLength();
					Char *buffer = NewMemClear(Char,len + 2);
					if (buffer)
					{
						pFile->ReadBytes(buffer,len);
						buffer[len]=0;

						Int32 i;

						for (i = 0; i < len && buffer[i] >= ' '; i++) { }
						buffer[i] = 0;

						for (i--; i > 0 && buffer[i]== ' '; i--) { }
						buffer[i + 1] = 0;

						AddLanguage(buffer, idx);
						DeleteMem(buffer);
					}
				}
			}
		}
	}
}
コード例 #6
0
ファイル: lang.cpp プロジェクト: drodin/Crimson
int Locale::Load( MemBuffer &file ) {

  unsigned short langs = file.Read16();
  for ( int i = 0; i < langs; ++i ) {
    Language lang;
    int rc = lang.ReadCatalog( file );

    if ( rc >= 0 ) AddLanguage( lang );
    else return -1;
  }

  if ( lib.size() == 0 ) return -1;

  if ( !SetDefaultLanguage( CF_LANG_DEFAULT ) ) {
    // no english translation found, use something we have
    SetDefaultLanguage( lib.begin()->first );
  }

  return lib.size();
}