Skip to content

Commit ecf92c6

Browse files
authored
[translation] Add missing "Open AI Chat Window" (#3881)
[translation] Avoid static initialization before language is set [cleanup] Remove `SideBar::DoGetControlByName` [cleanup] Use `emplace`
1 parent 7eb3cde commit ecf92c6

File tree

3 files changed

+41
-57
lines changed

3 files changed

+41
-57
lines changed

LiteEditor/SideBar.cpp

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,18 @@
2626

2727
#include "clWorkspaceView.h"
2828
#include "cl_config.h"
29-
#include "cl_editor.h"
3029
#include "codelite_events.h"
31-
#include "dockablepanemenumanager.h"
3230
#include "editor_config.h"
3331
#include "event_notifier.h"
3432
#include "fileexplorer.h"
35-
#include "fileview.h"
36-
#include "frame.h"
33+
#include "SecondarySideBar.hpp"
3734
#include "globals.h"
3835
#include "openwindowspanel.h"
3936
#include "pluginmanager.h"
4037
#include "tabgroupspane.h"
4138
#include "workspacetab.h"
4239

4340
#include <wx/app.h>
44-
#include <wx/bitmap.h>
4541
#include <wx/gauge.h>
4642
#include <wx/menu.h>
4743
#include <wx/sizer.h>
@@ -61,10 +57,10 @@
6157

6258
namespace
6359
{
64-
const wxString WORKSPACE_LABEL = _("Workspace");
65-
const wxString EXPLORER_LABEL = _("Explorer");
66-
const wxString TABS_LABEL = _("Tabs");
67-
const wxString GROUPS_LABEL = _("Groups");
60+
wxString WorkspaceLabel() { return _("Workspace"); }
61+
wxString ExplorerLabel() { return _("Explorer"); }
62+
wxString TabsLabel() { return _("Tabs"); }
63+
wxString GroupsLabel() { return _("Groups"); }
6864
} // namespace
6965

7066
SideBar::SideBar(wxWindow* parent, const wxString& caption, wxAuiManager* mgr, long style)
@@ -109,7 +105,7 @@ void SideBar::CreateGUIControls()
109105
// Calculate the widest tab (the one with the 'Workspace' label)
110106
int xx, yy;
111107
wxFont fnt = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
112-
wxWindow::GetTextExtent(WORKSPACE_LABEL, &xx, &yy, NULL, NULL, &fnt);
108+
wxWindow::GetTextExtent(WorkspaceLabel(), &xx, &yy, NULL, NULL, &fnt);
113109

114110
mainSizer->Add(m_book, 1, wxEXPAND | wxALL, 0);
115111

@@ -126,37 +122,37 @@ void SideBar::CreateGUIControls()
126122
// the IManager instance
127123
IManager* mgr = PluginManager::Get();
128124

129-
m_workspaceTab = new WorkspaceTab(m_book, WORKSPACE_LABEL);
130-
m_book->AddPage(m_workspaceTab, WORKSPACE_LABEL, "workspace-button", true);
125+
m_workspaceTab = new WorkspaceTab(m_book, WorkspaceLabel());
126+
m_book->AddPage(m_workspaceTab, WorkspaceLabel(), "workspace-button", true);
131127

132-
m_tabs.insert(std::make_pair(WORKSPACE_LABEL, Tab(WORKSPACE_LABEL, m_workspaceTab)));
133-
mgr->AddWorkspaceTab(WORKSPACE_LABEL);
128+
m_tabs.emplace(WorkspaceLabel(), Tab(WorkspaceLabel(), m_workspaceTab));
129+
mgr->AddWorkspaceTab(WorkspaceLabel());
134130

135131
// Add the explorer tab
136-
m_explorer = new FileExplorer(m_book, EXPLORER_LABEL);
137-
m_book->AddPage(m_explorer, EXPLORER_LABEL, "file-explorer-button", false);
132+
m_explorer = new FileExplorer(m_book, ExplorerLabel());
133+
m_book->AddPage(m_explorer, ExplorerLabel(), "file-explorer-button", false);
138134

139-
m_tabs.insert(std::make_pair(EXPLORER_LABEL, Tab(EXPLORER_LABEL, m_explorer)));
140-
mgr->AddWorkspaceTab(EXPLORER_LABEL);
135+
m_tabs.emplace(ExplorerLabel(), Tab(ExplorerLabel(), m_explorer));
136+
mgr->AddWorkspaceTab(ExplorerLabel());
141137

142138
// Add the "File Explorer" view to the list of files managed by the workspace-view
143-
m_workspaceTab->GetView()->AddPage(m_explorer, EXPLORER_LABEL, false);
139+
m_workspaceTab->GetView()->AddPage(m_explorer, ExplorerLabel(), false);
144140

145141
// Add the Open Windows Panel (Tabs)
146142
// #ifndef __WXOSX__
147-
m_openWindowsPane = new OpenWindowsPanel(m_book, TABS_LABEL);
148-
m_book->AddPage(m_openWindowsPane, TABS_LABEL, "tabs-button");
143+
m_openWindowsPane = new OpenWindowsPanel(m_book, TabsLabel());
144+
m_book->AddPage(m_openWindowsPane, TabsLabel(), "tabs-button");
149145

150-
m_tabs.insert(std::make_pair(TABS_LABEL, Tab(TABS_LABEL, m_openWindowsPane)));
151-
mgr->AddWorkspaceTab(TABS_LABEL);
146+
m_tabs.emplace(TabsLabel(), Tab(TabsLabel(), m_openWindowsPane));
147+
mgr->AddWorkspaceTab(TabsLabel());
152148
// #endif
153149

154150
// Add the Tabgroups tab
155-
m_TabgroupsPane = new TabgroupsPane(m_book, GROUPS_LABEL);
156-
m_book->AddPage(m_TabgroupsPane, GROUPS_LABEL, "groups-button");
151+
m_TabgroupsPane = new TabgroupsPane(m_book, GroupsLabel());
152+
m_book->AddPage(m_TabgroupsPane, GroupsLabel(), "groups-button");
157153

158-
m_tabs.insert(std::make_pair(GROUPS_LABEL, Tab(GROUPS_LABEL, m_TabgroupsPane)));
159-
mgr->AddWorkspaceTab(GROUPS_LABEL);
154+
m_tabs.emplace(GroupsLabel(), Tab(GroupsLabel(), m_TabgroupsPane));
155+
mgr->AddWorkspaceTab(GroupsLabel());
160156

161157
if (m_book->GetPageCount() > 0) {
162158
m_book->SetSelection((size_t)0);
@@ -169,7 +165,7 @@ void SideBar::CreateGUIControls()
169165
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event_chat);
170166
});
171167

172-
m_book->AddActionButton("chat-bot", "Open AI Chat Window", action_ptr);
168+
m_book->AddActionButton("chat-bot", _("Open AI Chat Window"), action_ptr);
173169
m_mgr->Update();
174170
}
175171

@@ -224,44 +220,29 @@ void SideBar::SaveWorkspaceViewTabOrder() const
224220
clConfig::Get().SetWorkspaceTabOrder(panes, m_book->GetSelection());
225221
}
226222

227-
wxWindow* SideBar::DoGetControlByName(const wxString& title)
228-
{
229-
if (title == EXPLORER_LABEL)
230-
return m_explorer;
231-
else if (title == WORKSPACE_LABEL)
232-
return m_workspaceTab;
233-
#ifndef __WXOSX__
234-
else if (title == TABS_LABEL)
235-
return m_openWindowsPane;
236-
#endif
237-
else if (title == GROUPS_LABEL)
238-
return m_TabgroupsPane;
239-
return NULL;
240-
}
241-
242223
bool SideBar::IsTabVisible(int flag)
243224
{
244225
wxWindow* win(NULL);
245226
wxString title;
246227

247228
switch (flag) {
248229
case View_Show_Workspace_Tab:
249-
title = WORKSPACE_LABEL;
250-
win = DoGetControlByName(WORKSPACE_LABEL);
230+
title = WorkspaceLabel();
231+
win = m_workspaceTab;
251232
break;
252233
case View_Show_Explorer_Tab:
253-
title = EXPLORER_LABEL;
254-
win = DoGetControlByName(EXPLORER_LABEL);
234+
title = ExplorerLabel();
235+
win = m_explorer;
255236
break;
256237
#ifndef __WXOSX__
257238
case View_Show_Tabs_Tab:
258-
title = TABS_LABEL;
259-
win = DoGetControlByName(TABS_LABEL);
239+
title = TabsLabel();
240+
win = m_openWindowsPane;
260241
break;
261242
#endif
262243
case View_Show_Tabgroups_Tab:
263-
title = GROUPS_LABEL;
264-
win = DoGetControlByName(GROUPS_LABEL);
244+
title = GroupsLabel();
245+
win = m_TabgroupsPane;
265246
break;
266247
}
267248

LiteEditor/SideBar.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class SideBar : public wxPanel
8484

8585
protected:
8686
void CreateGUIControls();
87-
wxWindow* DoGetControlByName(const wxString& title);
8887
void OnInitDone(wxCommandEvent& event);
8988
void OnSettingsChanged(wxCommandEvent& event);
9089
void OnContextMenu(clContextMenuEvent& event);

translations/codelite.pot

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: CodeLite\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-03-17 15:54+0000\n"
11+
"POT-Creation-Date: 2026-03-18 22:28+0100\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3832,6 +3832,10 @@ msgstr ""
38323832
msgid "Parsing workspace..."
38333833
msgstr ""
38343834

3835+
#: LiteEditor/SideBar.cpp:168
3836+
msgid "Open AI Chat Window"
3837+
msgstr ""
3838+
38353839
#: LiteEditor/SideBar.cpp:194
38363840
#, c-format
38373841
msgid "Parsing workspace: %d%% completed"
@@ -11800,10 +11804,6 @@ msgstr ""
1180011804
msgid "Add a missing header file"
1180111805
msgstr ""
1180211806

11803-
#: Plugin/ai/ChatAI.cpp:33 Plugin/ai/ChatAIWindow.cpp:26
11804-
msgid "Chat AI"
11805-
msgstr ""
11806-
1180711807
#: Plugin/ai/ChatAIWindow.cpp:45
1180811808
msgid "Clear the chat history"
1180911809
msgstr ""
@@ -11841,6 +11841,10 @@ msgid "Insert Prompt"
1184111841
msgstr ""
1184211842

1184311843
#: Plugin/ai/ChatAIWindow.cpp:244
11844+
msgid "Dock Chat Window"
11845+
msgstr ""
11846+
11847+
#: Plugin/ai/ChatAIWindow.cpp:256
1184411848
msgid "Chat History"
1184511849
msgstr ""
1184611850

0 commit comments

Comments
 (0)