Cross-Platform Programming with wxWidgets
Just Make It Cross-Platform
Subscribe to Feed
  • Home
  • Projects
  • Links

wxGoogleTranslate

Overview

wxGoogleTranslate provides wxWidgets-based API for accessing Google Translate service.

Downloads

  • wxGoogleTranslate Source Code, Sample Application and binaries for Win32 and Windows Mobile

Supported Platforms

  • Windows NT/2000/XP/Vista
  • Windows Mobile 2003/5/6
  • Windows CE
  • Linux
  • Mac OS

Screenshots

wxGoogleTranslate - C++ Wrapper for Google Translate - Sample Application for Windows Vista
wxGoogleTranslate - C++ Wrapper for Google Translate - Sample Application for Windows Mobile

Usage

Retrieve Names of All Supported Languages

void wxGoogleTranslateClientMainFrame::FillLanguageChoice(wxChoice * choice)
{
	wxArrayString names;
	wxGoogleTranslate::GetLanguages(names);
	choice->Clear();
	for(size_t i = 0; i < names.Count(); i++)
	{
		choice->Append(names[i]);
	}
	if(choice->GetCount() > 0)
	{
		choice->SetSelection(choice->GetCount()-1);
	}
}

Translate Text

void wxGoogleTranslateClientMainFrame::OnTRANSLATEClick( wxCommandEvent& event )
{
	do
	{
		wxString result;
		wxString details;
		int errorCode(0);
		int sourceLangselection = m_SourceLanguageChoice->GetSelection();
		int resultLangselection = m_ResultLanguageChoice->GetSelection();
		if((sourceLangselection < 0) || (resultLangselection < 0)) break;
		if(wxGoogleTranslate::Translate(m_SourceTextCtrl->GetValue(),
			result,
			wxGoogleTranslate::GetLanguageCode(
				m_SourceLanguageChoice->GetString(sourceLangselection)),
			wxGoogleTranslate::GetLanguageCode(
			m_ResultLanguageChoice->GetString(resultLangselection)),
				details, errorCode))
		{
			m_ResultTextCtrl->SetValue(result);
		}
		else
		{
			wxMessageBox(wxString::Format(_("Erorr occured: %s"), details.GetData()));
		}
	}
	while(false);
}
  • This blog is about…

    Articles Code::Blocks Components Controls Database DatabaseLayer Document/View Eclipse Localization NetBeans Networking News Printing Reports SQLite Tutorilas Video Visual Studio wxAUI wxButton wxDev-CPP wxGrid wxHelpController wxJavaScript wxJSON wxLocale wxLog wxPaintDC wxPropertyGrid wxRuby wxSQLite3 wxThread wxValidator wxWidgets wxWinCE wxZipInputStream wxZipOutputStream XML Библиотека Книги Статьи
  • Showcase

    Visit wxToolBox Homepage

    Buy wxToolBox (with source code)

  • Archives

    • November 2009
    • September 2009
    • August 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • June 2007
    • May 2007
    • January 2007
  • Recent Comments

    • T-Rex on Getting Acquainted with Document/View Framework – Simple Image Viewer
    • T-Rex on Сделайте мне красиво – Часть II – wxAUI в Multi-View приложений
    • Mardiko on Getting Acquainted with Document/View Framework – Simple Image Viewer
    • marty on Сделайте мне красиво – Часть II – wxAUI в Multi-View приложений
    • T-Rex on Перевод книги Julian’а Smart’а – Глава VI – Обработка данных с устройств ввода
  • Buttons

    Locations of visitors to this page

    Rambler's Top100
    Рейтинг@Mail.ru

Copyright © 2010 Cross-Platform Programming with wxWidgets All Rights Reserved
RSS Log in