Make Plugins Admin translatable
This commit is contained in:
parent
6cf238a6ab
commit
78a0f57ed1
|
@ -133,7 +133,7 @@ withoutUpdater:
|
|||
StrCpy $noUpdater "true"
|
||||
updaterDone:
|
||||
|
||||
${GetOptions} $R0 "/pliginsForAllUsers" $R1 ;case insensitive
|
||||
${GetOptions} $R0 "/pluginsForAllUsers" $R1 ;case insensitive
|
||||
IfErrors withoutPlugins4AllUsers withPlugins4AllUsers
|
||||
withPlugins4AllUsers:
|
||||
StrCpy $arePlugins4AllUsers "true"
|
||||
|
|
|
@ -484,7 +484,7 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePlu
|
|||
{
|
||||
if (nbPlugin > 0)
|
||||
::InsertMenu(_hPluginsMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
|
||||
::InsertMenu(_hPluginsMenu, 1, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugin Admin"));
|
||||
::InsertMenu(_hPluginsMenu, 1, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugins Admin..."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5710,6 +5710,11 @@ bool Notepad_plus::reloadLang()
|
|||
_nativeLangSpeaker.changeDlgLang(_colEditorDlg.getHSelf(), "ColumnEditor");
|
||||
}
|
||||
|
||||
if (_pluginsAdminDlg.isCreated())
|
||||
{
|
||||
_nativeLangSpeaker.changePluginsAdminDlgLang(_pluginsAdminDlg);
|
||||
}
|
||||
|
||||
UserDefineDialog *udd = _pEditView->getUserDefineDlg();
|
||||
if (udd->isCreated())
|
||||
{
|
||||
|
|
|
@ -2480,7 +2480,7 @@ void Notepad_plus::command(int id)
|
|||
_pluginsAdminDlg.doDialog(_nativeLangSpeaker.isRTL());
|
||||
if (isFirstTime)
|
||||
{
|
||||
_nativeLangSpeaker.changeConfigLang(_pluginsAdminDlg.getHSelf());
|
||||
_nativeLangSpeaker.changePluginsAdminDlgLang(_pluginsAdminDlg);
|
||||
_pluginsAdminDlg.updateListAndLoadFromJson();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -51,6 +51,13 @@ public:
|
|||
_columnInfos.push_back(column2Add);
|
||||
};
|
||||
|
||||
void setColumnText(size_t i, generic_string txt2Set) {
|
||||
LVCOLUMN lvColumn;
|
||||
lvColumn.mask = LVCF_TEXT;
|
||||
lvColumn.pszText = const_cast<TCHAR *>(txt2Set.c_str());
|
||||
ListView_SetColumn(_hSelf, i, &lvColumn);
|
||||
}
|
||||
|
||||
// setStyleOption() should be called before init()
|
||||
void setStyleOption(int32_t extraStyle) {
|
||||
_extraStyle = extraStyle;
|
||||
|
|
|
@ -576,6 +576,30 @@ bool PluginsAdminDlg::removePlugins()
|
|||
return exitToInstallRemovePlugins(pa_remove, puis);
|
||||
}
|
||||
|
||||
void PluginsAdminDlg::changeTabName(LIST_TYPE index, const TCHAR *name2change)
|
||||
{
|
||||
TCITEM tie;
|
||||
tie.mask = TCIF_TEXT;
|
||||
tie.pszText = (TCHAR *)name2change;
|
||||
TabCtrl_SetItem(_tab.getHSelf(), index, &tie);
|
||||
|
||||
TCHAR label[MAX_PATH];
|
||||
_tab.getCurrentTitle(label, MAX_PATH);
|
||||
::SetWindowText(_hSelf, label);
|
||||
}
|
||||
|
||||
void PluginsAdminDlg::changeColumnName(COLUMN_TYPE index, const TCHAR *name2change)
|
||||
{
|
||||
_availableList.changeColumnName(index, name2change);
|
||||
_updateList.changeColumnName(index, name2change);
|
||||
_installedList.changeColumnName(index, name2change);
|
||||
}
|
||||
|
||||
void PluginViewList::changeColumnName(COLUMN_TYPE index, const TCHAR *name2change)
|
||||
{
|
||||
_ui.setColumnText(index, name2change);
|
||||
}
|
||||
|
||||
bool PluginViewList::removeFromFolderName(const generic_string& folderName)
|
||||
{
|
||||
|
||||
|
|
|
@ -111,6 +111,8 @@ struct NppCurrentStatus
|
|||
bool shouldLaunchInAdmMode() { return _isInProgramFiles; };
|
||||
};
|
||||
|
||||
enum COLUMN_TYPE { COLUMN_PLUGIN, COLUMN_VERSION };
|
||||
|
||||
class PluginViewList
|
||||
{
|
||||
public:
|
||||
|
@ -144,12 +146,16 @@ public:
|
|||
bool hideFromPluginInfoPtr(PluginUpdateInfo* pluginInfo2hide);
|
||||
bool restore(const generic_string& folderName);
|
||||
bool removeFromPluginInfoPtr(PluginUpdateInfo* pluginInfo2hide);
|
||||
void changeColumnName(COLUMN_TYPE index, const TCHAR *name2change);
|
||||
|
||||
private:
|
||||
std::vector<PluginUpdateInfo*> _list;
|
||||
ListView _ui;
|
||||
};
|
||||
|
||||
enum LIST_TYPE { AVAILABLE_LIST, UPDATES_LIST, INSTALLED_LIST };
|
||||
|
||||
|
||||
class PluginsAdminDlg final : public StaticDialog
|
||||
{
|
||||
public :
|
||||
|
@ -188,6 +194,9 @@ public :
|
|||
bool updatePlugins();
|
||||
bool removePlugins();
|
||||
|
||||
void changeTabName(LIST_TYPE index, const TCHAR *name2change);
|
||||
void changeColumnName(COLUMN_TYPE index, const TCHAR *name2change);
|
||||
|
||||
protected:
|
||||
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
|
|
@ -754,6 +754,66 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
|
|||
changeDlgLang(findReplaceDlg.getHSelf(), "Find");
|
||||
}
|
||||
|
||||
void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdminDlg)
|
||||
{
|
||||
if (_nativeLangA)
|
||||
{
|
||||
TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
|
||||
if (dlgNode)
|
||||
{
|
||||
dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg");
|
||||
if (dlgNode)
|
||||
{
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
|
||||
TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin");
|
||||
if (ColumnPluginNode)
|
||||
{
|
||||
const char *name = (ColumnPluginNode->ToElement())->Attribute("name");
|
||||
if (name && name[0])
|
||||
{
|
||||
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
||||
pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TiXmlNodeA *ColumnVersionNode = dlgNode->FirstChild("ColumnVersion");
|
||||
if (ColumnVersionNode)
|
||||
{
|
||||
const char *name = (ColumnVersionNode->ToElement())->Attribute("name");
|
||||
if (name && name[0])
|
||||
{
|
||||
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
||||
pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
const char *titre1 = (dlgNode->ToElement())->Attribute("titleAvailable");
|
||||
const char *titre2 = (dlgNode->ToElement())->Attribute("titleUpdates");
|
||||
const char *titre3 = (dlgNode->ToElement())->Attribute("titleInstalled");
|
||||
|
||||
if (titre1 && titre1[0])
|
||||
{
|
||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
|
||||
pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str());
|
||||
}
|
||||
if (titre2 && titre2[0])
|
||||
{
|
||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
|
||||
pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str());
|
||||
}
|
||||
if (titre3 && titre3[0])
|
||||
{
|
||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
|
||||
pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
changeDlgLang(pluginsAdminDlg.getHSelf(), "PluginsAdminDlg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
||||
{
|
||||
auto currentSel = preference.getListSelectedIndex();
|
||||
|
|
|
@ -37,6 +37,7 @@ class FindReplaceDlg;
|
|||
class PreferenceDlg;
|
||||
class ShortcutMapper;
|
||||
class UserDefineDialog;
|
||||
class PluginsAdminDlg;
|
||||
|
||||
class MenuPosition {
|
||||
public:
|
||||
|
@ -65,6 +66,8 @@ public:
|
|||
void changeUserDefineLangPopupDlg(HWND hDlg);
|
||||
void changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg);
|
||||
void changePrefereceDlgLang(PreferenceDlg & preference);
|
||||
void changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdminDlg);
|
||||
|
||||
bool isRTL() const {
|
||||
return _isRTL;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue