Make some items translatable (in UDL & on status bar)

Fix #15426, fix #8004, fix #8972, close #16347
This commit is contained in:
Don Ho 2025-03-31 17:23:24 +02:00
parent 11e01d9abc
commit 6bc7abb021
8 changed files with 140 additions and 65 deletions

View File

@ -1522,6 +1522,11 @@ Do you want to continue?"/>
<UDLNewNameError title="UDL Error" message="This name is used by another language,
please give another one."/>
<UDLRemoveCurrentLang title="Remove the current language" message="Are you sure?"/>
<UDL_importSuccessful title="User Defined Language" message="Import successful."/>
<UDL_importFails title="User Defined Language" message="Failed to import."/>
<UDL_saveBeforeImport title="User Defined Language" message="Before exporting, save your language definition by clicking &quot;Save As...&quot; button."/> <!-- HowToReproduce: Choose "User Defined Language" in User Language combobox, then click on "Export... button". -->
<UDL_exportSuccessful title="User Defined Language" message="Export successful."/>
<UDL_exportFails title="User Defined Language" message="Failed to export."/>
<SCMapperDoDeleteOrNot title="Are you sure?" message="Are you sure you want to delete this shortcut?"/>
<FindCharRangeValueError title="Range Value problem" message="You should type between 0 and 255."/> <!-- HowToReproduce: Search menu, then Find characters in range, select Custom range, enter 999 in either edit box, press Find. -->
<OpenInAdminMode title="Save failed" message="The file cannot be saved and it may be protected.
@ -1838,9 +1843,21 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell and JSON.
If you select advanced mode but do not edit files in the aforementioned languages, the indentation will remain in basic mode."/>
<!-- Don't translate "Global override" and "Default Style" -->
<global-override-tip value="Enabling &quot;Global override&quot; here will override that parameter in all language styles. What you probably really want is to use the &quot;Default Style&quot; settings instead"/>
<scintillaRenderingTechnology-tip value="May improve rendering of special characters or resolve some graphics issues, restart Notepad++ to apply the changes."/>
<!-- Due to the limited space on the status bar, if the translations for 'length' & 'lines' are much longer than the English words, please leave them in English instead of translating them. -->
<statusbar-length-lines value="length: $STR_REPLACE1$ lines: $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Ln' & 'Col' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Ln-Col value="Ln: $STR_REPLACE1$ Col: $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Pos' & 'Sel' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Pos value="Pos: "/>
<statusbar-Sel value="Sel: "/>
<statusbar-Sel-number value="Sel"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1522,6 +1522,11 @@ Do you want to continue?"/>
<UDLNewNameError title="UDL Error" message="This name is used by another language,
please give another one."/>
<UDLRemoveCurrentLang title="Remove the current language" message="Are you sure?"/>
<UDL_importSuccessful title="User Defined Language" message="Import successful."/>
<UDL_importFails title="User Defined Language" message="Failed to import."/>
<UDL_saveBeforeImport title="User Defined Language" message="Before exporting, save your language definition by clicking &quot;Save As...&quot; button."/>
<UDL_exportSuccessful title="User Defined Language" message="Export successful."/>
<UDL_exportFails title="User Defined Language" message="Failed to export."/>
<SCMapperDoDeleteOrNot title="Are you sure?" message="Are you sure you want to delete this shortcut?"/>
<FindCharRangeValueError title="Range Value problem" message="You should type between 0 and 255."/> <!-- HowToReproduce: Search menu, then Find characters in range, select Custom range, enter 999 in either edit box, press Find. -->
<OpenInAdminMode title="Save failed" message="The file cannot be saved and it may be protected.
@ -1838,9 +1843,21 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell and JSON.
If you select advanced mode but do not edit files in the aforementioned languages, the indentation will remain in basic mode."/>
<!-- Don't translate "Global override" and "Default Style" -->
<global-override-tip value="Enabling &quot;Global override&quot; here will override that parameter in all language styles. What you probably really want is to use the &quot;Default Style&quot; settings instead"/>
<scintillaRenderingTechnology-tip value="May improve rendering of special characters or resolve some graphics issues, restart Notepad++ to apply the changes."/>
<!-- Due to the limited space on the status bar, if the translations for 'length' & 'lines' are much longer than the English words, please leave them in English instead of translating them. -->
<statusbar-length-lines value="length: $STR_REPLACE1$ lines: $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Ln' & 'Col' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Ln-Col value="Ln: $STR_REPLACE1$ Col: $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Pos' & 'Sel' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Pos value="Pos: "/>
<statusbar-Sel value="Sel: "/>
<statusbar-Sel-number value="Sel"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1521,7 +1521,12 @@ Il semble que le fichier à ouvrir nappartient pas au projet."/>
Voulez-vous continuer ?"/>
<UDLNewNameError title="Erreur UDL" message="Ce nom est utilisé par un autre langage,
veuillez en donner un autre."/>
<UDLRemoveCurrentLang title="Supprimer la langage actuelle" message="Êtes-vous sûr de vouloir supprimer la langage actuelle ?"/>
<UDLRemoveCurrentLang title="Suppression du UDL actuel" message="Êtes-vous sûr de vouloir supprimer le langage actuel ?"/>
<UDL_importSuccessful title="UDL" message="Importation réussie."/>
<UDL_importFails title="UDL" message="Échec de l'importation."/>
<UDL_saveBeforeImport title="UDL" message="Avant d'une exportation, enregistrez votre définition de langage en cliquant sur le bouton « Enregistrer sous... »."/>
<UDL_exportSuccessful title="UDL" message="Exportation réussie."/>
<UDL_exportFails title="UDL" message="Échec de l'exportation."/>
<SCMapperDoDeleteOrNot title="Supprimer un raccourci clavier" message="Êtes-vous sûr de vouloir supprimer ce raccourci clavier ?"/>
<FindCharRangeValueError title="Valeur en dehors des limites" message="Veuillez entrer une valeur entre 0 et 255."/> <!-- HowToReproduce: Search menu, then Find characters in range, select Custom range, enter 999 in either edit box, press Find. -->
<OpenInAdminMode title="Lenregistrement a échoué" message="Le fichier ne peut pas être enregistré et il est peut-être protégé.
@ -1838,9 +1843,21 @@ Cliquez sur le bouton « ? » à droite pour ouvrir le site web du manuel utilis
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell et JSON
Si vous sélectionnez le mode avancé sans modifier les fichiers des langues mentionnées ci-dessus, les paramètres d'indentation resteront en mode basique."/>
<!-- Don't translate "Global override" and "Default Style" -->
<global-override-tip value="Activer le « global override » ici substituera ces paramètres dans tous les styles pour tous les langages de programmation. Vous préférerez probablement utiliser les paramètres « Default Style » à la place"/>
<scintillaRenderingTechnology-tip value="Cela peut améliorer le rendu des caractères spéciaux ou résoudre certains problèmes graphiques. Veuillez redémarrer Notepad++ pour appliquer le changement."/>
<!-- Due to the limited space on the status bar, if the translations for 'length' & 'lines' are much longer than the English words, please leave them in English instead of translating them. -->
<statusbar-length-lines value="longueur : $STR_REPLACE1$ lignes : $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Ln' & 'Col' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Ln-Col value="Ln : $STR_REPLACE1$ Col : $STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Pos' & 'Sel' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Pos value="Pos : "/>
<statusbar-Sel value="Sel : "/>
<statusbar-Sel-number value="Sel"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1415,6 +1415,11 @@
<ProjectPanelReloadDirty title="重新載入工作區" message="目前的工作區已被修改。你要重新載入並捨棄所做的修改嗎?"/>
<UDLNewNameError title="自訂程式語言錯誤" message="此名稱已被另一個程式語言使用。請重新命名。"/>
<UDLRemoveCurrentLang title="刪除語言" message="你確定要刪除目前的自訂程式語言嗎?"/>
<UDL_importSuccessful title="自訂程式語言" message="匯入成功。"/>
<UDL_importFails title="自訂程式語言" message="匯入失敗。"/>
<UDL_saveBeforeImport title="自訂程式語言" message="在匯出之前,請點擊「另存...」按鈕以儲存你定義的程式語言。"/>
<UDL_exportSuccessful title="自訂程式語言" message="匯出成功。"/>
<UDL_exportFails title="自訂程式語言" message="匯出失敗。"/>
<SCMapperDoDeleteOrNot title="刪除快捷鍵" message="你確定要刪除這個快捷鍵嗎?"/>
<FindCharRangeValueError title="輸入值範圍錯誤" message="你輸入的值應在 0 到 255 之間。如要搜尋字元編號大於 255 的字元,請在「尋找」對話方塊中使用「規則運算式」。"/>
<ExitToUpdatePlugins title="關閉 Notepad++" message="Notepad++
@ -1660,6 +1665,18 @@ C、C++、Java、C#、Objective-C、PHP、JavaScript、JSP、CSS、Perl、Rust
如果你選擇進階模式但不編輯上述語言文件,縮排設定將保留為基本模式。"/>
<global-override-tip value="此處啟用「Global override」將覆蓋所有語言樣式中的此些參數。你可能真正想要的是使用「Default Style」設置"/>
<scintillaRenderingTechnology-tip value="變更選項可能會改善特殊字元的顯示或解決一些圖形問題。請重新啟動 Notepad++ 以套用變更。"/>
<!-- Due to the limited space on the status bar, if the translations for 'length' & 'lines' are much longer than the English words, please leave them in English instead of translating them. -->
<statusbar-length-lines value="長度:$STR_REPLACE1$ 行數:$STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Ln' & 'Col' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Ln-Col value="行:$STR_REPLACE1$ 列:$STR_REPLACE2$"/>
<!-- Due to the limited space on the status bar, if the translations for 'Pos' & 'Sel' are longer than the English words, please leave them in English instead of translating them. -->
<statusbar-Pos value="位置:"/>
<statusbar-Sel value="選取:"/>
<statusbar-Sel-number value="選取"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -30,34 +30,6 @@ using namespace std;
const wchar_t * USERMSG = L" is not compatible with the current version of Notepad++.\n\n\
Do you want to remove this plugin from the plugins directory to prevent this message from the next launch?";
bool PluginsManager::unloadPlugin(int index, HWND nppHandle)
{
SCNotification scnN;
scnN.nmhdr.code = NPPN_SHUTDOWN;
scnN.nmhdr.hwndFrom = nppHandle;
scnN.nmhdr.idFrom = 0;
_pluginInfos[index]->_pBeNotified(&scnN);
//::DestroyMenu(_pluginInfos[index]->_pluginMenu);
//_pluginInfos[index]->_pluginMenu = NULL;
if (::FreeLibrary(_pluginInfos[index]->_hLib))
{
_pluginInfos[index]->_hLib = nullptr;
printStr(L"we're good");
}
else
printStr(L"not ok");
//delete _pluginInfos[index];
// printInt(index);
//vector<PluginInfo *>::iterator it = _pluginInfos.begin() + index;
//_pluginInfos.erase(it);
//printStr(L"remove");
return true;
}
static WORD getBinaryArchitectureType(const wchar_t *filePath)
{
HANDLE hFile = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);

View File

@ -94,8 +94,6 @@ public:
bool loadPlugins(const wchar_t *dir = NULL, const PluginViewList* pluginUpdateInfoList = nullptr, PluginViewList* pluginImcompatibleList = nullptr);
bool unloadPlugin(int index, HWND nppHandle);
void runPluginCommand(size_t i);
void runPluginCommand(const wchar_t *pluginName, int commandID);

View File

@ -4326,15 +4326,20 @@ void Notepad_plus::updateStatusBar()
// these sections of status bar NOT updated by this function:
// STATUSBAR_DOC_TYPE , STATUSBAR_EOF_FORMAT , STATUSBAR_UNICODE_TYPE
wchar_t strDocLen[256];
size_t docLen = _pEditView->getCurrentDocLen();
intptr_t nbLine = _pEditView->execute(SCI_GETLINECOUNT);
wsprintf(strDocLen, L"length : %s lines : %s",
commafyInt(docLen).c_str(),
commafyInt(nbLine).c_str());
_statusBar.setText(strDocLen, STATUSBAR_DOC_SIZE);
wchar_t strSel[64];
wstring docLenStr = commafyInt(docLen);
wstring nbLineStr = commafyInt(nbLine);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
wstring statusbarLengthLinesStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-length-lines", L"length: $STR_REPLACE1$ lines: $STR_REPLACE2$");
statusbarLengthLinesStr = stringReplace(statusbarLengthLinesStr, L"$STR_REPLACE1$", docLenStr);
statusbarLengthLinesStr = stringReplace(statusbarLengthLinesStr, L"$STR_REPLACE2$", nbLineStr);
_statusBar.setText(statusbarLengthLinesStr.c_str(), STATUSBAR_DOC_SIZE);
wstring statusbarSelStr;
size_t nbSelections = _pEditView->execute(SCI_GETSELECTIONS);
if (nbSelections == 1)
@ -4342,14 +4347,14 @@ void Notepad_plus::updateStatusBar()
if (_pEditView->execute(SCI_GETSELECTIONEMPTY))
{
size_t currPos = _pEditView->execute(SCI_GETCURRENTPOS);
wsprintf(strSel, L"Pos : %s", commafyInt(currPos + 1).c_str());
statusbarSelStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-Pos", L"Pos: ");
statusbarSelStr += commafyInt(currPos + 1);
}
else
{
const std::pair<size_t, size_t> oneSelCharsAndLines = _pEditView->getSelectedCharsAndLinesCount();
wsprintf(strSel, L"Sel : %s | %s",
commafyInt(oneSelCharsAndLines.first).c_str(),
commafyInt(oneSelCharsAndLines.second).c_str());
statusbarSelStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-Sel", L"Sel: ");
statusbarSelStr += commafyInt(oneSelCharsAndLines.first) + L" | " + commafyInt(oneSelCharsAndLines.second);
}
}
else if (_pEditView->execute(SCI_SELECTIONISRECTANGLE))
@ -4382,33 +4387,35 @@ void Notepad_plus::updateStatusBar()
}
}
wsprintf(strSel, L"Sel : %sx%s %s %s",
commafyInt(nbSelections).c_str(), // lines (rows) in rectangular selection
commafyInt(maxLineCharCount).c_str(), // show maximum width for columns
sameCharCountOnEveryLine ? L"=" : L"->",
commafyInt(rectSelCharsAndLines.first).c_str());
wstring nbSelectionsStr = commafyInt(nbSelections); // lines (rows) in rectangular selection
wstring maxLineCharCountStr = commafyInt(maxLineCharCount); // show maximum width for columns
wstring opStr = sameCharCountOnEveryLine ? L" = " : L" -> ";
wstring rectSelCharsStr = commafyInt(rectSelCharsAndLines.first);
statusbarSelStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-Sel", L"Sel: ");
statusbarSelStr += nbSelectionsStr + L"x" + maxLineCharCountStr + opStr + rectSelCharsStr;
}
else // multiple stream selections
{
const int maxSelsToProcessLineCount = 99; // limit the number of selections to process, for performance reasons
const std::pair<size_t, size_t> multipleSelCharsAndLines = _pEditView->getSelectedCharsAndLinesCount(maxSelsToProcessLineCount);
wsprintf(strSel, L"Sel %s : %s | %s",
commafyInt(nbSelections).c_str(),
commafyInt(multipleSelCharsAndLines.first).c_str(),
nbSelections <= maxSelsToProcessLineCount ?
commafyInt(multipleSelCharsAndLines.second).c_str() :
L"..."); // show ellipsis for line count if too many selections are active
wstring nbSelectionsStr = commafyInt(nbSelections);
wstring multipleSelChars = commafyInt(multipleSelCharsAndLines.first);
wstring multipleSelLines = (nbSelections <= maxSelsToProcessLineCount) ? commafyInt(multipleSelCharsAndLines.second) : L"..."; // show ellipsis for line count if too many selections are active
statusbarSelStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-Sel-number", L"Sel");
statusbarSelStr += L" " + nbSelectionsStr + L" : " + multipleSelChars + L" | " + multipleSelLines;
}
wchar_t strLnColSel[128];
intptr_t curLN = _pEditView->getCurrentLineNumber();
intptr_t curCN = _pEditView->getCurrentColumnNumber();
wsprintf(strLnColSel, L"Ln : %s Col : %s %s",
commafyInt(curLN + 1).c_str(),
commafyInt(curCN + 1).c_str(),
strSel);
_statusBar.setText(strLnColSel, STATUSBAR_CUR_POS);
wstring lnStr = commafyInt(_pEditView->getCurrentLineNumber() + 1);
wstring colStr = commafyInt(_pEditView->getCurrentColumnNumber() + 1);
wstring statusbarLnColStr = pNativeSpeaker->getLocalizedStrFromID("statusbar-Ln-Col", L"Ln: $STR_REPLACE1$ Col: $STR_REPLACE2$");
statusbarLnColStr = stringReplace(statusbarLnColStr, L"$STR_REPLACE1$", lnStr);
statusbarLnColStr = stringReplace(statusbarLnColStr, L"$STR_REPLACE2$", colStr);
wstring statusbarLnColSelStr = statusbarLnColStr + L" " + statusbarSelStr;
_statusBar.setText(statusbarLnColSelStr.c_str(), STATUSBAR_CUR_POS);
_statusBar.setText(_pEditView->execute(SCI_GETOVERTYPE) ? L"OVR" : L"INS", STATUSBAR_TYPING_MODE);

View File

@ -1397,28 +1397,48 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
wstring sourceFile = fDlg.doOpenSingleFileDlg();
if (sourceFile.empty()) break;
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
bool isSuccessful = nppParam.importUDLFromFile(sourceFile);
if (isSuccessful)
{
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
reloadLangCombo();
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0);
printStr(L"Import successful.");
pNativeSpeaker->messageBox("UDL_importSuccessful",
_hSelf,
L"Import successful.",
L"User Defined Language",
MB_OK | MB_APPLMODAL,
0);
}
else
{
printStr(L"Fail to import.");
pNativeSpeaker->messageBox("UDL_importFails",
_hSelf,
L"Failed to import.",
L"User Defined Language",
MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION,
0);
}
break;
}
case IDC_EXPORT_BUTTON :
{
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
auto i2Export = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
if (i2Export == 0)
{
// maybe a better option would be to simply send IDC_SAVEAS_BUTTON message, and display "Save As..." dialog?
printStr(L"Before exporting, save your language definition by clicking \"Save As...\" button");
pNativeSpeaker->messageBox("UDL_saveBeforeImport",
_hSelf,
L"Before exporting, save your language definition by clicking \"Save As...\" button",
L"User Defined Language",
MB_OK | MB_APPLMODAL,
0);
break;
}
@ -1433,11 +1453,21 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
bool isSuccessful = nppParam.exportUDLToFile(i2Export - 1, fileName2save);
if (isSuccessful)
{
printStr(L"Export successful");
pNativeSpeaker->messageBox("UDL_exportSuccessful",
_hSelf,
L"Export successful.",
L"User Defined Language",
MB_OK | MB_APPLMODAL,
0);
}
else
{
printStr(L"Fail to export.");
pNativeSpeaker->messageBox("UDL_exportFails",
_hSelf,
L"Failed to export.",
L"User Defined Language",
MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION,
0);
}
}
break;