Skip to content

Commit

Permalink
- Locale patch eranif#9 (DavidGH)
Browse files Browse the repository at this point in the history
git-svn-id: https://codelite.svn.sourceforge.net/svnroot/codelite/trunk@4671 9da81c78-c036-0410-9e1f-a2b0375e4b5a
  • Loading branch information
eranif committed Dec 20, 2010
1 parent 1389dd6 commit 815c81f
Show file tree
Hide file tree
Showing 26 changed files with 4,361 additions and 1,327 deletions.
5 changes: 2 additions & 3 deletions ExternalTools/newtoolbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ NewToolBase::NewToolBase( wxWindow* parent, wxWindowID id, const wxString& title
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

wxString m_choiceIdChoices[] = { _("external_tool_0"), _("external_tool_1"), _("external_tool_2"), _("external_tool_3"), _("external_tool_4"), _("external_tool_5"), _("external_tool_6"), _("external_tool_7"), _("external_tool_8"), _("external_tool_9") };
int m_choiceIdNChoices = sizeof( m_choiceIdChoices ) / sizeof( wxString );
m_choiceId = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceIdNChoices, m_choiceIdChoices, 0 );
wxArrayString m_choiceIdChoices;
m_choiceId = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceIdChoices, 0 );
m_choiceId->SetSelection( 0 );
fgSizer1->Add( m_choiceId, 0, wxALL|wxEXPAND, 5 );

Expand Down
6 changes: 6 additions & 0 deletions ExternalTools/newtooldlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ NewToolDlg::NewToolDlg( wxWindow* parent, IManager *mgr, ExternalToolData *data)
: NewToolBase( parent )
, m_mgr(mgr)
{
// Don't use wxFB to load translated versions of these strings: the translations wouldn't be very sensible, and it might break things
const wxString IdChoices[] = { wxT("external_tool_0"), wxT("external_tool_1"), wxT("external_tool_2"), wxT("external_tool_3"), wxT("external_tool_4"),
wxT("external_tool_5"), wxT("external_tool_6"), wxT("external_tool_7"), wxT("external_tool_8"), wxT("external_tool_9") };
wxArrayString choices(10, IdChoices);
m_choiceId->Clear();
m_choiceId->Append(choices);
m_choiceId->SetFocus();
if( data ) {
m_textCtrlArguments->SetValue(data->m_args);
Expand Down
5 changes: 2 additions & 3 deletions Gizmos/newinheritancebasedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ NewIneritanceBaseDlg::NewIneritanceBaseDlg( wxWindow* parent, wxWindowID id, con
m_staticText1->Wrap( -1 );
bSizer5->Add( m_staticText1, 0, wxALL, 5 );

wxString m_choiceAccessChoices[] = { _("public"), _("private"), _("protected"), _("virtual") };
int m_choiceAccessNChoices = sizeof( m_choiceAccessChoices ) / sizeof( wxString );
m_choiceAccess = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceAccessNChoices, m_choiceAccessChoices, 0 );
wxArrayString m_choiceAccessChoices;
m_choiceAccess = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceAccessChoices, 0 );
m_choiceAccess->SetSelection( 0 );
bSizer5->Add( m_choiceAccess, 0, wxALL|wxEXPAND, 5 );

Expand Down
5 changes: 5 additions & 0 deletions Gizmos/newinheritancedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ NewIneritanceDlg::NewIneritanceDlg( wxWindow* parent, IManager *mgr, const wxStr
: NewIneritanceBaseDlg( parent, wxID_ANY, _("New Inheritance"))
, m_mgr(mgr)
{
// Do this the hard way, rather than letting wxFB localise these particular strings :p
const wxString AccessChoices[] = { wxT("public"), wxT("private"), wxT("protected"), wxT("virtual") };
wxArrayString choices(4, AccessChoices);
m_choiceAccess->Clear();
m_choiceAccess->Append(choices);
//by default select 0
m_choiceAccess->Select(0);
if(access.IsEmpty() == false){
Expand Down
5 changes: 2 additions & 3 deletions Gizmos/newwxprojectbasedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ NewWxProjectBaseDlg::NewWxProjectBaseDlg( wxWindow* parent, wxWindowID id, const
m_staticText6->Wrap( -1 );
fgSizer2->Add( m_staticText6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

wxString m_choiceVersionChoices[] = { _("Default"), _("2.6"), _("2.8"), _("2.9"), _("3.0") };
int m_choiceVersionNChoices = sizeof( m_choiceVersionChoices ) / sizeof( wxString );
m_choiceVersion = new wxChoice( m_panelAdvancedInfo, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVersionNChoices, m_choiceVersionChoices, 0 );
wxArrayString m_choiceVersionChoices;
m_choiceVersion = new wxChoice( m_panelAdvancedInfo, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVersionChoices, 0 );
m_choiceVersion->SetSelection( 0 );
m_choiceVersion->SetToolTip( _("Use selected wxWidgets version.") );

Expand Down
6 changes: 5 additions & 1 deletion Gizmos/newwxprojectdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "wx/xrc/xmlres.h"
#include "windowattrmanager.h"
#include "imanager.h"
#include "globals.h"
#include "newwxprojectdlg.h"
#include "wx/msgdlg.h"
#include "workspace.h"
Expand All @@ -36,6 +37,9 @@ NewWxProjectDlg::NewWxProjectDlg( wxWindow* parent, IManager *mgr )
m_bitmap1->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wx_project_header")));
m_choiceApplicationType->SetSelection(wxProjectTypeSimpleMain);
m_dirPicker->SetPath(m_mgr->GetWorkspace()->GetWorkspaceFileName().GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR));
const wxString VersionChoices[] = { wxT("Default"), wxT("2.6"), wxT("2.8"), wxT("2.9"), wxT("3.0") };
m_stringManager.AddStrings(sizeof(VersionChoices)/sizeof(wxString), VersionChoices, wxT("Default"), m_choiceVersion);

m_textCtrlName->SetFocus();

#if defined (__WXMSW__)
Expand Down Expand Up @@ -141,7 +145,7 @@ void NewWxProjectDlg::GetProjectInfo(NewWxProjectInfo &info)
info.SetName(m_textCtrlName->GetValue());
info.SetPath(path);
info.SetPrefix(m_textCtrlPrefix->GetValue());
info.SetVersion(m_choiceVersion->GetStringSelection());
info.SetVersion(m_stringManager.GetStringSelection());
}

void NewWxProjectDlg::OnChoiceChanged(wxCommandEvent &e)
Expand Down
95 changes: 48 additions & 47 deletions Gizmos/newwxprojectdlg.h
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2008 by Eran Ifrah
// file name : newwxprojectdlg.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef __newwxprojectdlg__
#define __newwxprojectdlg__

/**
@file
Subclass of NewWxProjectBaseDlg, which is generated by wxFormBuilder.
*/

#include "newwxprojectbasedlg.h"
#include "newwxprojectinfo.h"
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2008 by Eran Ifrah
// file name : newwxprojectdlg.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef __newwxprojectdlg__
#define __newwxprojectdlg__

class IManager;
/** Implementing NewWxProjectBaseDlg */
class NewWxProjectDlg : public NewWxProjectBaseDlg
/**
@file
Subclass of NewWxProjectBaseDlg, which is generated by wxFormBuilder.
*/

#include "newwxprojectbasedlg.h"
#include "newwxprojectinfo.h"

class IManager;
/** Implementing NewWxProjectBaseDlg */
class NewWxProjectDlg : public NewWxProjectBaseDlg
{
IManager *m_mgr;
StringManager m_stringManager;
protected:
void OnButtonCancel(wxCommandEvent &e);
void OnButtonOK(wxCommandEvent &e);
bool ValidateInput();
void OnChoiceChanged(wxCommandEvent &e);

public:
/** Constructor */
NewWxProjectDlg( wxWindow* parent, IManager *mgr );
virtual ~NewWxProjectDlg();
void OnChoiceChanged(wxCommandEvent &e);

public:
/** Constructor */
NewWxProjectDlg( wxWindow* parent, IManager *mgr );
virtual ~NewWxProjectDlg();

void GetProjectInfo(NewWxProjectInfo &info);
};

#endif // __newwxprojectdlg__
void GetProjectInfo(NewWxProjectInfo &info);
};

#endif // __newwxprojectdlg__
2 changes: 1 addition & 1 deletion LiteEditor/advanced_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void AdvancedDlg::SaveCompilers()
bool AdvancedDlg::CreateDefaultNewCompiler ( const wxString &name )
{
if ( BuildSettingsConfigST::Get()->IsCompilerExist ( name ) ) {
wxMessageBox ( _( "A compiler with this name already exist" ), _( "Error" ), wxOK | wxICON_HAND );
wxMessageBox ( _( "A compiler with this name already exists" ), _( "Error" ), wxOK | wxICON_HAND );
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions LiteEditor/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3948,7 +3948,7 @@ void clMainFrame::OnFindResourceXXX(wxCommandEvent& e)
} else if (e.GetId() == XRCID("find_type")) {
searchType = OpenResourceDialog::TYPE_CLASS;
} else {
searchType = OpenResourceDialog::TYPE_WORKSPACE_FILE;
searchType = wxGetTranslation(OpenResourceDialog::TYPE_WORKSPACE_FILE);
}

OpenResourceDialog dlg(this, PluginManager::Get(), searchType);
Expand Down Expand Up @@ -4060,12 +4060,12 @@ void clMainFrame::SelectBestEnvSet()
if(p) {
BuildConfigPtr buildConf = WorkspaceST::Get()->GetProjBuildConf(activeProj, wxEmptyString);
if(buildConf) {
if( buildConf->GetEnvVarSet() != wxGetTranslation(USE_WORKSPACE_ENV_VAR_SET) &&
if( buildConf->GetEnvVarSet() != USE_WORKSPACE_ENV_VAR_SET &&
buildConf->GetEnvVarSet() != wxT("<Use Workspace Settings>") /* backward support */) {
projectSetName = buildConf->GetEnvVarSet();
}

if( buildConf->GetDbgEnvSet() != wxGetTranslation(USE_GLOBAL_SETTINGS)) {
if( buildConf->GetDbgEnvSet() != USE_GLOBAL_SETTINGS) {
projectDbgSetName = buildConf->GetDbgEnvSet();
}
}
Expand Down
5 changes: 2 additions & 3 deletions LiteEditor/newprojectbasedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ NewProjectBaseDlg::NewProjectBaseDlg( wxWindow* parent, wxWindowID id, const wxS
m_staticText2->Wrap( -1 );
categoriesSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );

wxString m_chCategoriesChoices[] = { _("Console"), _("GUI"), _("Library"), _("Others"), _("User templates"), _("All") };
int m_chCategoriesNChoices = sizeof( m_chCategoriesChoices ) / sizeof( wxString );
m_chCategories = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxSize( 275,-1 ), m_chCategoriesNChoices, m_chCategoriesChoices, 0 );
wxArrayString m_chCategoriesChoices;
m_chCategories = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxSize( 275,-1 ), m_chCategoriesChoices, 0 );
m_chCategories->SetSelection( 0 );
m_chCategories->SetMinSize( wxSize( 275,-1 ) );

Expand Down
9 changes: 5 additions & 4 deletions LiteEditor/newprojectdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@ NewProjectDlg::NewProjectDlg( wxWindow* parent )
for (; iter != m_list.end(); iter++) {
wxString internalType = (*iter)->GetProjectInternalType();
if (internalType.IsEmpty()) internalType = _("Others");
categories.insert( internalType );
// Use wxGetTranslation() here. Some won't have translations, but it'll catch e.g. "GUI"
categories.insert( wxGetTranslation(internalType) );
}

std::set<wxString>::iterator cIter = categories.begin();
for (; cIter != categories.end(); cIter++) {
m_chCategories->Append((*cIter));
}

// Select the 'Console' to be the default
int where = m_chCategories->FindString(wxT("Console"));
// Select 'GUI' to be the default category
int where = m_chCategories->FindString(_("GUI"));
if (where == wxNOT_FOUND) {
where = 0;
}
Expand Down Expand Up @@ -247,7 +248,7 @@ void NewProjectDlg::FillProjectTemplateListCtrl(const wxString& category)

std::list<ProjectPtr>::iterator iter = m_list.begin();
for (; iter != m_list.end(); iter++) {
wxString intType = (*iter)->GetProjectInternalType();
wxString intType = wxGetTranslation( (*iter)->GetProjectInternalType() );

if ( (category == _("All")) ||
(intType == category) ||
Expand Down
14 changes: 12 additions & 2 deletions LiteEditor/ps_environment_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,18 @@ void PSEnvironmentPage::Load(BuildConfigPtr buildConf)

void PSEnvironmentPage::Save(BuildConfigPtr buildConf, ProjectSettingsPtr projSettingsPtr)
{
buildConf->SetDbgEnvSet(m_choiceDbgEnv->GetStringSelection());
buildConf->SetEnvVarSet(m_choiceEnv->GetStringSelection());
wxString env = m_choiceDbgEnv->GetStringSelection();
if (env == wxGetTranslation(USE_GLOBAL_SETTINGS)) {
// Save it untranslated
env = USE_GLOBAL_SETTINGS;
}
buildConf->SetDbgEnvSet(env);

env = m_choiceEnv->GetStringSelection();
if (env == wxGetTranslation(USE_WORKSPACE_ENV_VAR_SET)) {
env = USE_WORKSPACE_ENV_VAR_SET;
}
buildConf->SetEnvVarSet(env);
}

void PSEnvironmentPage::Clear()
Expand Down
2 changes: 1 addition & 1 deletion LiteEditor/workspacesettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WorkspaceSettingsDlg::WorkspaceSettingsDlg( wxWindow* parent, LocalWorkspace *lo
wxString activeEnvSet;
wxString tmpSet = localWorkspace->GetActiveEnvironmentSet();

if(tmpSet == wxT("<Use Active Set>")){
if(tmpSet == _("<Use Active Set>")){
tmpSet = wxGetTranslation(USE_GLOBAL_SETTINGS);
}

Expand Down
4 changes: 2 additions & 2 deletions Plugin/build_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ BuildConfig::BuildConfig(wxXmlNode *node)
}
}

SetEnvVarSet(wxGetTranslation(USE_WORKSPACE_ENV_VAR_SET));
SetDbgEnvSet(wxGetTranslation(USE_GLOBAL_SETTINGS));
SetEnvVarSet(USE_WORKSPACE_ENV_VAR_SET);
SetDbgEnvSet(USE_GLOBAL_SETTINGS);

// read the environment page
wxXmlNode *envNode = XmlUtils::FindFirstByTagName(node, wxT("Environment"));
Expand Down
2 changes: 1 addition & 1 deletion Plugin/evnvarlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class WXDLLIMPEXP_SDK EvnVarList : public SerializedObject
virtual ~EvnVarList();

void SetActiveSet(const wxString& activeSet) {
if(activeSet != wxT("<Use Active Set>") && activeSet != wxGetTranslation(USE_GLOBAL_SETTINGS))
if(activeSet != _("<Use Active Set>") && activeSet != USE_GLOBAL_SETTINGS)
this->m_activeSet = activeSet;
}

Expand Down
15 changes: 12 additions & 3 deletions Plugin/open_resource_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "windowattrmanager.h"
#include <vector>

// It makes sense to localise "Workspace file" but surely not the others...
wxString OpenResourceDialog::TYPE_WORKSPACE_FILE = _("Workspace file");
wxString OpenResourceDialog::TYPE_CLASS = wxT("Class, struct or union");
wxString OpenResourceDialog::TYPE_MACRO = wxT("Macro");
Expand Down Expand Up @@ -50,6 +51,14 @@ OpenResourceDialog::OpenResourceDialog( wxWindow* parent, IManager *manager, con
m_manager->GetConfigTool()->ReadObject(wxT("OpenResourceAllowsPartialMatch"), &l);
m_checkBoxUsePartialMatching->SetValue(l.GetValue() == 1);

m_choiceResourceType->Clear();
m_choiceResourceType->Append(wxGetTranslation(TYPE_WORKSPACE_FILE));
m_choiceResourceType->Append(TYPE_CLASS);
m_choiceResourceType->Append(TYPE_MACRO);
m_choiceResourceType->Append(TYPE_FUNCTION);
m_choiceResourceType->Append(TYPE_TYPEDEF);
m_choiceResourceType->Append(TYPE_NAMESPACE);

m_choiceResourceType->SetStringSelection(m_type);

if (!allowChangeType)
Expand Down Expand Up @@ -145,7 +154,7 @@ void OpenResourceDialog::DoPopulateList()
wxWindowUpdateLocker locker(this);
wxArrayString kind;
Clear();
if (m_type == TYPE_WORKSPACE_FILE) {
if (m_type == wxGetTranslation(TYPE_WORKSPACE_FILE)) {
DoPopulateWorkspaceFile();
return;

Expand Down Expand Up @@ -275,7 +284,7 @@ void OpenResourceDialog::DoPopulateWorkspaceFile()
// Change was done, update the file list
for (size_t i=0; i<tmpArr.GetCount(); i++) {
wxFileName fn(tmpArr.Item(i));
DoAppendLine(fn.GetFullName(), fn.GetFullPath(), wxT(""), false, new OpenResourceDialogItemData(tmpArr.Item(i), -1, wxT(""), OpenResourceDialog::TYPE_WORKSPACE_FILE, wxT(""), wxT("")));
DoAppendLine(fn.GetFullName(), fn.GetFullPath(), wxT(""), false, new OpenResourceDialogItemData(tmpArr.Item(i), -1, wxT(""), wxGetTranslation(TYPE_WORKSPACE_FILE), wxT(""), wxT("")));

if( i == 150 ) {
m_staticTextErrorMessage->SetLabel(_("Too many matches, please narrow down your search"));
Expand Down Expand Up @@ -367,7 +376,7 @@ void OpenResourceDialog::OnOKUI(wxUpdateUIEvent& event)

bool OpenResourceDialogItemData::IsOk() const
{
if (m_resourceType == OpenResourceDialog::TYPE_WORKSPACE_FILE) {
if (m_resourceType == wxGetTranslation(OpenResourceDialog::TYPE_WORKSPACE_FILE)) {
return m_file.IsEmpty() == false;
} else {
// tag
Expand Down
5 changes: 2 additions & 3 deletions Plugin/openresourcedialogbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ OpenResourceDialogBase::OpenResourceDialogBase( wxWindow* parent, wxWindowID id,
m_textCtrlResourceName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RICH2 );
fgSizer1->Add( m_textCtrlResourceName, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );

wxString m_choiceResourceTypeChoices[] = { _("Workspace file"), _("Class, struct or union"), _("Function"), _("Typedef"), _("Macro"), _("Namespace") };
int m_choiceResourceTypeNChoices = sizeof( m_choiceResourceTypeChoices ) / sizeof( wxString );
m_choiceResourceType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceResourceTypeNChoices, m_choiceResourceTypeChoices, 0 );
wxArrayString m_choiceResourceTypeChoices;
m_choiceResourceType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceResourceTypeChoices, 0 );
m_choiceResourceType->SetSelection( 0 );
fgSizer1->Add( m_choiceResourceType, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 );

Expand Down
Loading

0 comments on commit 815c81f

Please sign in to comment.