diff --git a/bin/assets/i18n/en.xml b/bin/assets/i18n/en.xml index 80b38017d..96e71d9ca 100644 --- a/bin/assets/i18n/en.xml +++ b/bin/assets/i18n/en.xml @@ -1,10 +1,19 @@ - About ecode... + About Ecode + Add Branch + Add Build + Add Build Step + Add Build Type + Add Clean Step + Add Custom Output Parser + Add Custom Environment Variable + Advanced Options Any https or http URL - Any name... + Any name... + Arguments Close Tab? - author + Author Auto-Close Brackets & Tags Auto Close XML Tags Auto Detect Indent Type & Width @@ -13,42 +22,79 @@ Branches Build New Cloned Build Name: + Build Configuration Elapsed Time: %s. + Build Environment Build run with errors + Build Name Build name not found! Operating System not supported for this build! + Build Output Show Build Issues + Build Output Show Build Output Build Settings Build Settings + * All changes are automatically saved Step %u: %s + Build Steps Build run successfully + Build Target Build Type Name: Delete Build Type: %s? Build type must be set! + Build Types + Build types can be used as a dynamic build option represented by the special key ${build_type}. The build type can be switch easily from the editor. + Cancel Cancel Build Cancel Clean + Capture Positions + Case sensitive + Change Case + Change Escape Sequence + Change Whole Word Always check for new updates at startup. - Check for Updates... + Check For Updates Check Languages Health Clean Clean run with errors + Clean Steps Clean run successfully + Clear History Clear Menu + Clear System Environment + Clone Setting Cloned name must be different from any existing build name. Close + Close All Tabs + Close App + Close Clean Tabs + Close Find Replace Close Folder Close Folder? + Close Global Searchbar + Close Locatebar + Close Other Tabs + Close Searchbar + Close Tab + Close Tabs To The Left + Close Tabs To The Right Close %s? col Collapse All Color scheme: %s - Command Palette... - commit - Configure Ignore Files... + Column Position + Command + Command Palette + Command Palette... + Commit + Commit Bypass Hook + Complete Edit + Configure default shell + Configure Ignore Files... Configure Terminal Scrollback Configure Terminal Shell Are you sure you want to delete the build configuration? @@ -60,10 +106,13 @@ All changes in "%s" will be lost. All changes will be lost. Font loading confirmation Do you really want to remove "%s"? + Console Toggle Copy - Copy Containing Folder Path... + Copy Containing Folder Path + Copy Containing Folder Path... Copy Error Message Copy File Path + Copy File Path And Position Couldn't write the file. Could not write file to disk. Please check if the file is read-only or if ecode does not have permissions to write to that file. @@ -74,34 +123,61 @@ File path is: Couldn't create folder of file. Couldn't remove Couldn't write file on disk. + Create New Create new file Create new folder + Create New Terminal + Create New Window Curly Brackets {} Current Document Current Terminal Cursor Blinking Time + Custom Environment Variables Custom Output Parser + Custom Variables + Custom Variables allow to simplify the build commands steps adding custom variables that can be used over the build settings in commands, arguments, and working directories. + Custom Variables can be invoked using ${variable_name} in any of the commands. + There are predefined custom variables available to use:
${project_root}: The folder / project root directory.
${build_type}: The build type selected to build the project.
${os}: The current operating system name.
${nproc}: The number of logical processing units. Cut Dark - date + Date + Draw Boxes + Debug Draw Boxes Toggle + Debug Draw Debug Data + Highlight Focus & Hover + Debug Draw Highlight Toggle + Debug Widget Tree View Default Theme + Delete Selected Custom Output Parser + Delete Selected Environment Variable Delete + Delete Selected + Delete Setting + Details directory Document - Search Document Symbol... + Search Document Symbol... Documents Settings Double Quotes "" + Download File Web Duplicate file + Duplicate File... There are currently no updates available. - ecode source code... + Ecode Source You are running an unreleased version of ecode! Current version: is available! Do you want to download it now? Edit + Edit Build + Edit Selected Custom Output Parser Editor Font Size + Editor Go Back + Editor Go Forward + Editor Set Cursor Blinking Time + Editor Set Line Breaking Column + Editor Set Line Spacing You must set a name to the file. - Enable Vertical ScrollBar Enable Color Picker Enables the color picker tool when a double click selection is done over a word representing a color. @@ -109,6 +185,8 @@ is done over a word representing a color. Enables a quick preview of a color when the mouse is hover a word that represents a color. Enable Horizontal ScrollBar + Enable Vertical ScrollBar + Enabled? Enter duplicate file name: Enter new file name: Enter new folder name: @@ -116,32 +194,47 @@ is hover a word that represents a color. Failed checking for updates. Error copying file. Error renaming file. + Replace \, , +, and (Unicode characters Exclusive Mode Open directory in terminal Execute in terminal Expand All - Fallback Font... + Fallback Font + Fallback Font... This feature is only supported in the desktop version of ecode. This feature is not supported in this Operating System file File already exists! + File Name File Type - Find/Replace + Find And Replace + Find Prev + Find Replace + Find: Folder/Project Settings Folder/Project Settings + Font Size Grow + Font Size Reset + Font Size Shrink Force New Line at End of File - Format Document + Format Doc + Format Document Frame Rate Limit Frame Rate Limit Applied Full Screen Mode + Fullscreen Toggle Git Add Branch Ammend last commit + Apply Stash Apply Stash + Git Blame Bypass commit hook Changed Check Out - Commit + Check Out... + Git Commit Commit Message: Confirm Apply a previously saved stash? @@ -150,21 +243,37 @@ is hover a word that represents a color. Are you sure you want to discard the changes in file: "%s"? Do you want to drop the selected stash? Are you sure you want to push the local changes to the remote server? + Create Branch Create new branch at current branch (HEAD). Enter the name for the branch: Create local branch? + Delete + Discard + Drop Stash Drop Stash + Fast Forward Merge + Git Fetch Ignored Local Branches + Merge Branch + Current folder is not a Git repository. Git binary not found. Please check that git is accesible via PATH Nothing to Commit + Open Diff + Open File + Git Pull + Git Push Push commit Remote Branches + Rename Rename Branch Enter the new name for the branch: '%s' Restore Index + Stage + Stage All Staged + Stash All Keep Index Keep Working Tree Stash Local Changes @@ -173,40 +282,94 @@ Name your stash (optional): Stashes Tags Unmerged + Unstage Untracked + Global Search + Global Search Clear History Global Settings Renderer version changed. Restart ecode to see the changes. - Go to line... + Go To Line + Go to line... Go To Line in Current Document Group Treat .h files as C++ code. Help + Hide Hide tabbar on single tab Hides the tabbar if there's only one element in the tab widget. Highlight Current Line Highlight Matching Bracket Highlight Selection Match + History: + Ignore + Indent Indent Width Indentation Type Inode Insert search query Inspect Widgets + Issues + Jump Lines Down + Jump Lines Up Key Bindings + Keybindings + The language selected will be set as the default language for this file extension. + Languages Health Light Line line Line Breaking Column Line Endings + Line Number Line Spacing + Linter Copy Error Message + Linter Go To Next Error + Linter Go To Previous Error Load current document directory as folder - Locate... + Load Current Dir + Locate + Locate... + Locate Files & Symbols + Lock + Lock Toggle + Code Action + Find References to Symbol Under Cursor + Lsp Format Range + Format Selected Range + Lsp Go To Declaration + Lsp Go To Definition + Lsp Go To Implementation + Lsp Go To Type Definition + Lsp Memory Usage + Lsp Plugin Restart + Lsp Refresh Semantic Highlighting + Lsp Rename Symbol Under Cursor + Restart LSP Client + Lsp Switch Header Source + Lsp Symbol Code Action + Lsp Symbol Info + Lsp Symbol References + Lua Pattern + Match Whole Word + Menu Toggle Message + Message Capture Pattern Mode Modified - Monospace Font... - Move panel to left... - Move panel to right... + Monospace Font + Monospace Font... + More... + Move Down + Move Panel Left + Move panel to left... + Move Panel Right + Move panel to right... + Move Scroll Down + Move Scroll Up + Move To Next Line + Move To Previous Line + Move Up Cancel No Ok @@ -215,10 +378,11 @@ Restart ecode to see the changes. Multisample Anti-Aliasing Level applied. Restart ecode to see the changes. Name - New File... - New File in directory... - New File in File Folder... - New Folder... + New File + New File... + New File in directory... + New File in File Folder... + New Folder... New Name New Terminal New Terminal Behavior @@ -227,6 +391,8 @@ Restart ecode to see the changes. Please restart the application. New Value New Window + Next + Next Tab No build has been run No Code Action No open document @@ -234,24 +400,44 @@ Please restart the application. Threaded ecode required to compile builds. None Not found in $PATH + Notice Open - Open Containing Folder... - Open Containing Folder... + Open a File + Open a Folder + Open Command Palette + Open Containing Folder + Open Containing Folder... + Open Context Menu + Open Document Symbol Search Open Documents Open File - Open File from Web... + Open File... + Open File from Web... You must first open a folder. - Open Folder... + Open Folder + Open Folder... + Open Global Search Open In New Horizontal Split - Open in New Window... + Open In New Window + Open in New Window... Open In Current Tab Bar Open In New Vertical Split + Open Locatebar + Open Recent Folder... + Open Workspace Symbol Search + Output + Output Parser + Custom output parsers scan command line output for user-provided error patterns to create entries in Build Issues and highlight those errors on the Build Output + Presets are provided as generic output parsers, you can select one below, by default a "generic" preset will be selected: + Overwrite Owner Paste Path Pattern - Please enter the file URL... + Pick Widget + Please enter the file URL... Plugin Manager + Plugin Manager Open Description Enabled Id @@ -259,36 +445,69 @@ Please restart the application. Version Portable Mode failed. Please check that the application directory has write permissions. + Preferences + Press Enter + Previous + Previous Tab The process "%s" exited normally. The process "%s" exited with errors. - Project Find... + Project + Project Build Cancel + Project Build Start + Project Find... + Pull Branch + Push Branch Quit Read Only Recent Files + Recent Files... Recent Folders + Recent Folders... Redo - Refresh View... - Remove... + Refresh View... + Reload + The current document uses an extension that can be interpreted as more than one languages.
Which language is this document? + Remove Item + Remove... Remove file? + Remove Item Rename Rename file Rename Session Reopen Closed Document + Reopen Closed Tab + Repeat Find + Replace + Replace All + Replace & Find + Replace In Files + Replace Selection + Replace with: Restart last session at startup - Running steps for project %s... + Running steps for project %s... Save Save All - Save as... + Save As Doc + Save as... + Save Doc Save File As + Search + Search & Replace + Search for: Search for Symbols in Current Document Search for Workspace Symbols Search in Command Palette + Search Set String Select All + Select All Results Select Font File - Serif Font... + Select To Next Line + Select To Previous Line + Serif Font + Serif Font... Set Cursor Blinking Time: Set 0 to disable it. @@ -308,8 +527,11 @@ Set 0 to disable it. Set the UI scale factor (pixel density): Minimum value is 1, and maximum 6. Requires restart. Shell + Shell Configuration + Show Build Tab Show Console Show Document Info + Show Folder Treeview Tab Show hidden files Show Image Preview Show Indentation Guides @@ -317,8 +539,10 @@ Minimum value is 1, and maximum 6. Requires restart. Show Line Numbers Show Lines Relative Position Show Minimap - Show Open Documents... + Show Open Documents + Show Open Documents... Show Side Panel + Show Source Control Tab Show Status Bar Show White Spaces Single Quotes '' @@ -328,13 +552,23 @@ Minimum value is 1, and maximum 6. Requires restart. Split Bottom Split Left Split Right + Split Swap Split Top Square Brackets [] Starting %s %s Status + Supported Platforms + Selecting none means that the build settings will work and be available on any Operating System Switch Build Switch Build Type + Switch Side Panel + Switch To First Tab + Switch To Last Tab + Switch To Next Colorscheme + Switch To Next Split + Switch To Previous Colorscheme + Switch To Previous Split Symlink target Synchronize project tree with editor Syncronizes the current focused document as the selected @@ -345,24 +579,61 @@ file in the directory tree. Terminal Terminal Color Scheme Terminal color scheme: %s - Terminal Font... + Terminal Copy + Terminal Font + Terminal Font... Terminal Font Size - Split Terminal Bottom - Split Terminal Left - Split Terminal Right - Split Terminal Top + Terminal Font Size Grow + Terminal Font Size Shrink + Terminal Open Link + Terminal Paste + Terminal Rename + Terminal Scroll Down History + Terminal Scroll Down Row + Terminal Scroll Down Screen + Terminal Scroll Up History + Terminal Scroll Up Row + Terminal Scroll Up Screen + Terminal Split Bottom + Terminal Split Left + Terminal Split Right + Terminal Split Top + Texture Viewer + Toggle Lua Pattern + Toggle Status Bar + Toggle Status Build Output + Toggle Status Global Search Bar + Toggle Status Locate Bar + Toggle Status Terminal Tools + Ignores the changes on disk without any action. + Reload the file from disk. Unsaved changes will be lost. + Writes the local changes on disk, overwriting the disk changes + Tree View Configure Ignore Files Single Click Navigation in Tree View Trim Trailing Whitespaces Type - UI Font Size + Type to Locate + Ui Font Size Multisample Anti-Aliasing Level - UI Panel Font Size + Ui Panel Font Size UI Prefers Color Scheme Renderer Renderer Version - UI Scale Factor (Pixel Density) + Ui Scale Factor UI Theme + Copy + Copy Containing Folder Path... + Copy File Path + Copy File Path and Position + Paste + Delete + Open Containing Folder... + Paste + Redo + Select All + Undo + Copy Cancel Create new folder Enter new folder name: @@ -377,7 +648,13 @@ file in the directory tree. Select a file Select a folder Table + Copy + Open Link + Paste Undo + Unindent + Unlock + Use escape sequences Use Global Settings Using build type: %s. @@ -385,12 +662,15 @@ file in the directory tree. VSync Vsync configuration changed. Restart ecode to see the changes. + Warning Welcome Window + Working Directory Working Dir %s - Search Worskspace Symbol... + Search Worskspace Symbol... Write Unicode BOM + You have not yet opened a folder. Zoom In Zoom Out Zoom Reset diff --git a/include/eepp/ui/uicodeeditor.hpp b/include/eepp/ui/uicodeeditor.hpp index 1bb90e7ca..884da13f9 100644 --- a/include/eepp/ui/uicodeeditor.hpp +++ b/include/eepp/ui/uicodeeditor.hpp @@ -631,9 +631,9 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client { void setFileLockIconName( const std::string& fileLockIconName ); bool getDisplayLockedIcon() const; - void setDisplayLockedIcon(bool displayLockedIcon); + void setDisplayLockedIcon( bool displayLockedIcon ); - protected: + protected: struct LastXOffset { TextPosition position{ 0, 0 }; Float offset{ 0.f }; @@ -892,8 +892,7 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client { void createDefaultContextMenuOptions( UIPopUpMenu* menu ); - UIMenuItem* menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, + UIMenuItem* menuAdd( UIPopUpMenu* menu, const String& translateString, const std::string& icon, const std::string& cmd ); void drawMinimap( const Vector2f& start, const std::pair& lineRange ); diff --git a/include/eepp/ui/uiconsole.hpp b/include/eepp/ui/uiconsole.hpp index 02d169e10..4d1488163 100644 --- a/include/eepp/ui/uiconsole.hpp +++ b/include/eepp/ui/uiconsole.hpp @@ -327,8 +327,7 @@ class EE_API UIConsole : public UIWidget, TextPosition getPositionOnScreen( Vector2f position ); - UIMenuItem* menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, + UIMenuItem* menuAdd( UIPopUpMenu* menu, const String& translateString, const std::string& icon, const std::string& cmd ); Drawable* findIcon( const std::string& name ); diff --git a/include/eepp/ui/uitextinput.hpp b/include/eepp/ui/uitextinput.hpp index e9269d84c..4a34b8dfd 100644 --- a/include/eepp/ui/uitextinput.hpp +++ b/include/eepp/ui/uitextinput.hpp @@ -227,8 +227,7 @@ class EE_API UITextInput : public UITextView, public TextDocument::Client { virtual bool onCreateContextMenu( const Vector2i& position, const Uint32& flags ); - UIMenuItem* menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, + UIMenuItem* menuAdd( UIPopUpMenu* menu, const String& translateString, const std::string& icon, const std::string& cmd ); Drawable* findIcon( const std::string& name ); diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 415e63431..157eb53c5 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -1173,7 +1173,7 @@ ProjectExplorer.CustomExecutableRunConfiguration true - --css=/root/.config/ecode/style.css + --css=/root/.config/ecode/style.css --language=de 0 false 1 diff --git a/projects/linux/ee.files b/projects/linux/ee.files index ffd1fb24b..e3c1c8363 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -972,6 +972,7 @@ ../../src/eepp/ui/tools/uitextureviewer.hpp ../../src/eepp/ui/tools/uiwidgetinspector.cpp ../../src/eepp/ui/uiabstractview.cpp +../../src/eepp/ui/uiapplication.cpp ../../src/eepp/ui/uibackgrounddrawable.cpp ../../src/eepp/ui/uiborderdrawable.cpp ../../src/eepp/ui/uicheckbox.cpp diff --git a/src/eepp/system/translator.cpp b/src/eepp/system/translator.cpp index 5e878643c..8babd0b55 100644 --- a/src/eepp/system/translator.cpp +++ b/src/eepp/system/translator.cpp @@ -64,6 +64,18 @@ bool Translator::loadNodes( pugi::xml_node node, std::string lang ) { return true; } +static size_t countLines( const std::string_view& text ) { + const char* startPtr = text.data(); + const char* endPtr = text.data() + text.size(); + size_t count = 0; + if ( startPtr != endPtr ) { + count = 1 + *startPtr == '\n' ? 1 : 0; + while ( ++startPtr && startPtr != endPtr ) + count += ( '\n' == *startPtr ) ? 1 : 0; + } + return count; +} + bool Translator::loadFromFile( const std::string& path, std::string lang ) { if ( FileSystem::fileExists( path ) ) { lang = lang.size() == 2 @@ -79,6 +91,10 @@ bool Translator::loadFromFile( const std::string& path, std::string lang ) { Log::error( "Couldn't load i18n file: %s", path.c_str() ); Log::error( "Error description: %s", result.description() ); Log::error( "Error offset: %d", result.offset ); + std::string file; + FileSystem::fileGet( path, file ); + Log::error( "Error line: %d", + countLines( std::string_view{ file }.substr( 0, result.offset ) ) + 1 ); } } else if ( PackManager::instance()->isFallbackToPacksActive() ) { std::string packPath( path ); @@ -100,6 +116,8 @@ bool Translator::loadFromString( const std::string& string, std::string lang ) { Log::error( "Couldn't load i18n file from string: %s", string.c_str() ); Log::error( "Error description: %s", result.description() ); Log::error( "Error offset: %d", result.offset ); + Log::error( "Error line: %d", + countLines( std::string_view{ string }.substr( 0, result.offset ) ) + 1 ); } return false; } @@ -114,6 +132,10 @@ bool Translator::loadFromMemory( const void* buffer, Int32 bufferSize, std::stri Log::error( "Couldn't load i18n file from buffer" ); Log::error( "Error description: %s", result.description() ); Log::error( "Error offset: %d", result.offset ); + Log::error( "Error line: %d", + countLines( std::string_view{ (const char*)buffer, (size_t)bufferSize }.substr( + 0, result.offset ) ) + + 1 ); } return false; } @@ -250,7 +272,7 @@ void Translator::saveToStream( IOStream& stream, std::string lang ) { resources.append_attribute( "language" ).set_value( lang.c_str() ); auto& unordered_map = mDictionary[lang]; - std::map langStrs(unordered_map.begin(), unordered_map.end()); + std::map langStrs( unordered_map.begin(), unordered_map.end() ); for ( const auto& str : langStrs ) { auto r = resources.append_child( "string" ); diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 16a4bd6e7..3c9fe7669 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -1051,12 +1051,10 @@ Sizef UICodeEditor::getMaxScroll() const { getLineHeight() ); } -UIMenuItem* UICodeEditor::menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, - const std::string& cmd ) { +UIMenuItem* UICodeEditor::menuAdd( UIPopUpMenu* menu, const String& translateString, + const std::string& icon, const std::string& cmd ) { UIMenuItem* menuItem = - menu->add( i18n( "uicodeeditor_" + translateKey, translateString ), findIcon( icon ), - mKeyBindings.getCommandKeybindString( cmd ) ); + menu->add( translateString, findIcon( icon ), mKeyBindings.getCommandKeybindString( cmd ) ); menuItem->setId( cmd ); return menuItem; } @@ -1065,30 +1063,40 @@ void UICodeEditor::createDefaultContextMenuOptions( UIPopUpMenu* menu ) { if ( !mCreateDefaultContextMenuOptions ) return; - menuAdd( menu, "undo", "Undo", "undo", "undo" )->setEnabled( mDoc->hasUndo() ); - menuAdd( menu, "redo", "Redo", "redo", "redo" )->setEnabled( mDoc->hasRedo() ); + menuAdd( menu, i18n( "uicodeeditor_undo", "Undo" ), "undo", "undo" ) + ->setEnabled( mDoc->hasUndo() ); + menuAdd( menu, i18n( "uicodeeditor_redo", "Redo" ), "redo", "redo" ) + ->setEnabled( mDoc->hasRedo() ); menu->addSeparator(); - menuAdd( menu, "cut", "Cut", "cut", "cut" )->setEnabled( mDoc->hasSelection() ); - menuAdd( menu, "copy", "Copy", "copy", "copy" )->setEnabled( mDoc->hasSelection() ); - menuAdd( menu, "paste", "Paste", "paste", "paste" ); - menuAdd( menu, "delete", "Delete", "delete-text", "delete-to-next-char" ); + menuAdd( menu, i18n( "uicodeeditor_cut", "Cut" ), "cut", "cut" ) + ->setEnabled( mDoc->hasSelection() ); + menuAdd( menu, i18n( "uicodeeditor_copy", "Copy" ), "copy", "copy" ) + ->setEnabled( mDoc->hasSelection() ); + menuAdd( menu, i18n( "uicodeeditor_paste", "Paste" ), "paste", "paste" ); + menuAdd( menu, i18n( "uicodeeditor_delete", "Delete" ), "delete-text", "delete-to-next-char" ); menu->addSeparator(); - menuAdd( menu, "select_all", "Select All", "select-all", "select-all" ); + menuAdd( menu, i18n( "uicodeeditor_select_all", "Select All" ), "select-all", "select-all" ); if ( mDoc->hasFilepath() ) { menu->addSeparator(); - menuAdd( menu, "open_containing_folder", "Open Containing Folder...", "folder-open", - "open-containing-folder" ); + menuAdd( + menu, + i18n( "uicodeeditor_open_containing_folder_ellipsis", "Open Containing Folder..." ), + "folder-open", "open-containing-folder" ); - menuAdd( menu, "copy_containing_folder_path", "Copy Containing Folder Path...", "copy", - "copy-containing-folder-path" ); + menuAdd( menu, + i18n( "uicodeeditor_copy_containing_folder_path_ellipsis", + "Copy Containing Folder Path..." ), + "copy", "copy-containing-folder-path" ); - menuAdd( menu, "copy_file_path", "Copy File Path", "copy", "copy-file-path" ); + menuAdd( menu, i18n( "uicodeeditor_copy_file_path", "Copy File Path" ), "copy", + "copy-file-path" ); - menuAdd( menu, "copy_file_path_and_position", "Copy File Path and Position", "copy", - "copy-file-path-and-position" ); + menuAdd( menu, + i18n( "uicodeeditor_copy_file_path_and_position", "Copy File Path and Position" ), + "copy", "copy-file-path-and-position" ); } } diff --git a/src/eepp/ui/uiconsole.cpp b/src/eepp/ui/uiconsole.cpp index 5c1550768..79151bb05 100644 --- a/src/eepp/ui/uiconsole.cpp +++ b/src/eepp/ui/uiconsole.cpp @@ -1192,12 +1192,10 @@ void UIConsole::copySelection() { getUISceneNode()->getWindow()->getClipboard()->setText( str ); } -UIMenuItem* UIConsole::menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, - const std::string& cmd ) { +UIMenuItem* UIConsole::menuAdd( UIPopUpMenu* menu, const String& translateString, + const std::string& icon, const std::string& cmd ) { UIMenuItem* menuItem = - menu->add( i18n( "uiconsole_" + translateKey, translateString ), findIcon( icon ), - mKeyBindings.getCommandKeybindString( cmd ) ); + menu->add( translateString, findIcon( icon ), mKeyBindings.getCommandKeybindString( cmd ) ); menuItem->setId( cmd ); return menuItem; } @@ -1208,7 +1206,8 @@ bool UIConsole::onCreateContextMenu( const Vector2i& position, const Uint32& fla UIPopUpMenu* menu = UIPopUpMenu::New(); - menuAdd( menu, "copy", "Copy", "copy", "copy" )->setEnabled( mSelection.hasSelection() ); + menuAdd( menu, i18n( "uiconsole_copy", "Copy" ), "copy", "copy" ) + ->setEnabled( mSelection.hasSelection() ); ContextMenuEvent event( this, menu, Event::OnCreateContextMenu, position, flags ); sendEvent( &event ); diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index eadd4a513..7f0c3ca99 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -876,12 +876,10 @@ Drawable* UITextInput::findIcon( const std::string& name ) { return nullptr; } -UIMenuItem* UITextInput::menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, - const std::string& cmd ) { +UIMenuItem* UITextInput::menuAdd( UIPopUpMenu* menu, const String& translateString, + const std::string& icon, const std::string& cmd ) { UIMenuItem* menuItem = - menu->add( i18n( "uicodeeditor_" + translateKey, translateString ), - findIcon( icon ), mKeyBindings.getCommandKeybindString( cmd ) ); + menu->add( translateString, findIcon( icon ), mKeyBindings.getCommandKeybindString( cmd ) ); menuItem->setId( cmd ); return menuItem; } @@ -890,16 +888,20 @@ void UITextInput::createDefaultContextMenuOptions( UIPopUpMenu* menu ) { if ( !mCreateDefaultContextMenuOptions ) return; - menuAdd( menu, "undo", "Undo", "undo", "undo" )->setEnabled( mDoc.hasUndo() ); - menuAdd( menu, "redo", "Redo", "redo", "redo" )->setEnabled( mDoc.hasRedo() ); + menuAdd( menu, i18n( "uicodeeditor_undo", "Undo" ), "undo", "undo" ) + ->setEnabled( mDoc.hasUndo() ); + menuAdd( menu, i18n( "uicodeeditor_redo", "Redo" ), "redo", "redo" ) + ->setEnabled( mDoc.hasRedo() ); menu->addSeparator(); - menuAdd( menu, "cut", "Cut", "cut", "cut" )->setEnabled( mDoc.hasSelection() ); - menuAdd( menu, "copy", "Copy", "copy", "copy" )->setEnabled( mDoc.hasSelection() ); - menuAdd( menu, "cut", "Paste", "paste", "paste" ); - menuAdd( menu, "delete", "Delete", "delete-text", "delete-to-next-char" ); + menuAdd( menu, i18n( "uicodeeditor_cut", "Cut" ), "cut", "cut" ) + ->setEnabled( mDoc.hasSelection() ); + menuAdd( menu, i18n( "uicodeeditor_copy", "Copy" ), "copy", "copy" ) + ->setEnabled( mDoc.hasSelection() ); + menuAdd( menu, i18n( "uicodeeditor_cut", "Paste" ), "paste", "paste" ); + menuAdd( menu, i18n( "uicodeeditor_delete", "Delete" ), "delete-text", "delete-to-next-char" ); menu->addSeparator(); - menuAdd( menu, "select_all", "Select All", "select-all", "select-all" ); + menuAdd( menu, i18n( "uicodeeditor_select_all", "Select All" ), "select-all", "select-all" ); } bool UITextInput::onCreateContextMenu( const Vector2i& position, const Uint32& flags ) { diff --git a/src/examples/7guis/circle_drawer/circle_drawer.cpp b/src/examples/7guis/circle_drawer/circle_drawer.cpp index df98c9479..a22ddd354 100644 --- a/src/examples/7guis/circle_drawer/circle_drawer.cpp +++ b/src/examples/7guis/circle_drawer/circle_drawer.cpp @@ -37,7 +37,7 @@ class AddCircleCommand : public UndoCommand { } virtual ~AddCircleCommand() { - if ( !SceneManager::instance()->isShuttingDown() ) + if ( SceneManager::existsSingleton() && !SceneManager::instance()->isShuttingDown() ) circle->close(); } diff --git a/src/modules/eterm/include/eterm/ui/uiterminal.hpp b/src/modules/eterm/include/eterm/ui/uiterminal.hpp index 2de1fe38f..068c78b1c 100644 --- a/src/modules/eterm/include/eterm/ui/uiterminal.hpp +++ b/src/modules/eterm/include/eterm/ui/uiterminal.hpp @@ -165,8 +165,7 @@ class UITerminal : public UIWidget { virtual int getContentSize() const; - UIMenuItem* menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, + UIMenuItem* menuAdd( UIPopUpMenu* menu, const String& translateString, const std::string& icon, const std::string& cmd ); virtual bool onCreateContextMenu( const Vector2i& position, const Uint32& flags ); diff --git a/src/modules/eterm/src/eterm/ui/uiterminal.cpp b/src/modules/eterm/src/eterm/ui/uiterminal.cpp index ab3903f3d..38e779a7b 100644 --- a/src/modules/eterm/src/eterm/ui/uiterminal.cpp +++ b/src/modules/eterm/src/eterm/ui/uiterminal.cpp @@ -536,13 +536,14 @@ void UITerminal::createDefaultContextMenuOptions( UIPopUpMenu* menu ) { auto sel( mTerm->getTerminal()->getSelection() ); if ( LuaPattern::matches( sel, LuaPattern::getURIPattern() ) ) { - menuAdd( menu, "open_link", "Open Link", "earth", "terminal-open-link" ); + menuAdd( menu, i18n( "uiterminal_open_link", "Open Link" ), "earth", + "terminal-open-link" ); } } - menuAdd( menu, "copy", "Copy", "copy", "terminal-copy" ) + menuAdd( menu, i18n( "uiterminal_copy", "Copy" ), "copy", "terminal-copy" ) ->setEnabled( mTerm->getTerminal() && mTerm->getTerminal()->hasSelection() ); - menuAdd( menu, "paste", "Paste", "paste", "terminal-paste" ) + menuAdd( menu, i18n( "uiterminal_paste", "Paste" ), "paste", "terminal-paste" ) ->setEnabled( !getUISceneNode()->getWindow()->getClipboard()->getText().empty() ); } @@ -553,12 +554,10 @@ Drawable* UITerminal::findIcon( const std::string& name ) { return nullptr; } -UIMenuItem* UITerminal::menuAdd( UIPopUpMenu* menu, const std::string& translateKey, - const String& translateString, const std::string& icon, - const std::string& cmd ) { +UIMenuItem* UITerminal::menuAdd( UIPopUpMenu* menu, const String& translateString, + const std::string& icon, const std::string& cmd ) { UIMenuItem* menuItem = - menu->add( i18n( "uiterminal_" + translateKey, translateString ), findIcon( icon ), - mKeyBindings.getCommandKeybindString( cmd ) ); + menu->add( translateString, findIcon( icon ), mKeyBindings.getCommandKeybindString( cmd ) ); menuItem->setId( cmd ); return menuItem; } diff --git a/src/tools/ecode/applayout.xml.hpp b/src/tools/ecode/applayout.xml.hpp index f45d0306e..84d25b6c5 100644 --- a/src/tools/ecode/applayout.xml.hpp +++ b/src/tools/ecode/applayout.xml.hpp @@ -436,9 +436,9 @@ R"html( - + - + diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 22123f99d..c0a868489 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -331,8 +331,9 @@ void App::openFontDialog( std::string& fontPath, bool loadingMonoFont ) { } void App::downloadFileWebDialog() { - UIMessageBox* msgBox = UIMessageBox::New( - UIMessageBox::INPUT, i18n( "please_enter_file_url", "Please enter the file URL..." ) ); + UIMessageBox* msgBox = + UIMessageBox::New( UIMessageBox::INPUT, i18n( "please_enter_file_url_ellipsis", + "Please enter the file URL..." ) ); msgBox->setTitle( mWindowTitle ); msgBox->getTextInput()->setHint( i18n( "any_https_or_http_url", "Any https or http URL" ) ); @@ -1703,14 +1704,14 @@ void App::onTabCreated( UITab* tab, UIWidget* ) { menu->addSeparator(); - menuAdd( "open_containing_folder", "Open Containing Folder...", "folder-open", + menuAdd( "open_containing_folder_ellipsis", "Open Containing Folder...", "folder-open", "open-containing-folder" ); - menuAdd( "open_in_new_window", "Open in New Window...", "window", + menuAdd( "open_in_new_window_ellipsis", "Open in New Window...", "window", "open-in-new-window" ); - menuAdd( "copy_containing_folder_path", "Copy Containing Folder Path...", "copy", - "copy-containing-folder-path" ); + menuAdd( "copy_containing_folder_path_ellipsis", "Copy Containing Folder Path...", + "copy", "copy-containing-folder-path" ); menuAdd( "copy_file_path", "Copy File Path", "copy", "copy-file-path" ); @@ -3560,8 +3561,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe language = mConfig.ui.language; if ( !language.empty() ) mUISceneNode->getTranslator().setCurrentLanguage( language ); - std::string currentLanguage( - language.empty() ? mUISceneNode->getTranslator().getCurrentLanguage() : language ); + std::string currentLanguage( mUISceneNode->getTranslator().getCurrentLanguage() ); std::string langPath( mResPath + "i18n" + FileSystem::getOSSlash() + currentLanguage + ".xml" ); if ( currentLanguage != "en" && FileSystem::fileExists( langPath ) ) @@ -3603,7 +3603,8 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe "fonts/DejaVuSansMonoNerdFontComplete.ttf" ); if ( ( nullptr != mTerminalFont && mTerminalFont->getInfo().family == "DejaVuSansMono NF" && mFontMono->getInfo().family == "DejaVu Sans Mono" ) || - ( nullptr != mTerminalFont && mTerminalFont->getInfo().family == mFontMono->getInfo().family ) ) { + ( nullptr != mTerminalFont && + mTerminalFont->getInfo().family == mFontMono->getInfo().family ) ) { mTerminalFont->setBoldFont( mFontMono->getBoldFont() ); mTerminalFont->setItalicFont( mFontMono->getItalicFont() ); mTerminalFont->setBoldItalicFont( mFontMono->getBoldItalicFont() ); diff --git a/src/tools/ecode/plugins/formatter/formatterplugin.cpp b/src/tools/ecode/plugins/formatter/formatterplugin.cpp index 8fa147303..0144879ed 100644 --- a/src/tools/ecode/plugins/formatter/formatterplugin.cpp +++ b/src/tools/ecode/plugins/formatter/formatterplugin.cpp @@ -310,7 +310,7 @@ bool FormatterPlugin::onCreateContextMenu( UICodeEditor* editor, UIPopUpMenu* me return false; menu->addSeparator(); - menu->add( editor->getUISceneNode()->i18n( "formatter-format-document", "Format Document" ), + menu->add( editor->getUISceneNode()->i18n( "formatter_format_document", "Format Document" ), nullptr, KeyBindings::keybindFormat( mKeyBindings["format-doc"] ) ) ->setId( "format-doc" ); diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index 5ff493627..824903c2a 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -401,12 +401,12 @@ void GitPlugin::displayTooltip( UICodeEditor* editor, const Git::Blame& blame, String str( blame.error.empty() ? String::format( "%s: %s (%s)\n%s: %s (%s)\n%s: %s\n\n%s", - i18n( "commit", "commit" ).capitalize().toUtf8().c_str(), + i18n( "commit", "Commit" ).toUtf8().c_str(), blame.commitHash.c_str(), blame.commitShortHash.c_str(), - i18n( "author", "author" ).capitalize().toUtf8().c_str(), + i18n( "author", "Author" ).toUtf8().c_str(), blame.author.c_str(), blame.authorEmail.c_str(), - i18n( "date", "date" ).capitalize().toUtf8().c_str(), - blame.date.c_str(), blame.commitMessage.c_str() ) + i18n( "date", "Date" ).toUtf8().c_str(), blame.date.c_str(), + blame.commitMessage.c_str() ) : blame.error ); Text::wrapText( str, PixelDensity::dpToPx( 400 ), tooltip->getFontStyleConfig(), @@ -761,7 +761,7 @@ void GitPlugin::commit( const std::string& repoPath ) { msgBox->closeWindow(); runAsync( - [this, msg, ammend, bypassHook, msgBox, pushCommit, repoPath]() { + [this, msg, ammend, bypassHook, pushCommit, repoPath]() { std::optional branch = getBranchFromRepoPath( repoPath ); bool pushNewBranch = branch && !branch->name.empty() && branch->remote.empty(); auto res = mGit->commit( msg, ammend, bypassHook, repoPath ); @@ -773,7 +773,7 @@ void GitPlugin::commit( const std::string& repoPath ) { return mGit->push( repoPath ); } } else - mLastCommitMsg = msgBox->getTextEdit()->getText(); + mLastCommitMsg = msg; return res; }, true, true, true, true, true ); @@ -1261,9 +1261,9 @@ void GitPlugin::buildSidePanelTab() { - - - + + + @@ -1413,17 +1413,17 @@ void GitPlugin::buildSidePanelTab() { menu->setId( "git_status_type_menu" ); if ( status->type == Git::GitStatusType::Staged ) { - addMenuItem( menu, "git-commit", "Commit", "git-commit" ); - addMenuItem( menu, "git-unstage-all", "Unstage All" ); + menuAdd( menu, "git-commit", "Commit", "git-commit" ); + menuAdd( menu, "git-unstage-all", "Unstage All" ); } if ( status->type == Git::GitStatusType::Untracked || status->type == Git::GitStatusType::Changed ) - addMenuItem( menu, "git-stage-all", "Stage All" ); + menuAdd( menu, "git-stage-all", "Stage All" ); if ( status->type == Git::GitStatusType::Changed ) { menu->addSeparator(); - addMenuItem( menu, "git-discard-all", "Discard All" ); + menuAdd( menu, "git-discard-all", "Discard All" ); } menu->on( Event::OnItemClicked, [this, model, @@ -1475,17 +1475,17 @@ void GitPlugin::buildSidePanelTab() { menu->setId( "git_repo_type_menu" ); if ( repo->hasStatusType( Git::GitStatusType::Staged ) ) { - addMenuItem( menu, "git-commit", "Commit", "git-commit" ); + menuAdd( menu, "git-commit", i18n( "git_commit", "Commit" ), "git-commit" ); } if ( repo->hasStatusType( Git::GitStatusType::Untracked ) ) { - addMenuItem( menu, "git-stage-all", "Stage All" ); + menuAdd( menu, "git-stage-all", i18n( "git_stage_all", "Stage All" ) ); } - addMenuItem( menu, "git-fetch", "Fetch", "repo-fetch" ); - addMenuItem( menu, "git-pull", "Pull", "repo-pull" ); - addMenuItem( menu, "git-push", "Push", "repo-push" ); - addMenuItem( menu, "git-stash", "Stash All", "git-stash" ); + menuAdd( menu, "git-fetch", i18n( "git_fetch", "Fetch" ), "repo-fetch" ); + menuAdd( menu, "git-pull", i18n( "git_pull", "Pull" ), "repo-pull" ); + menuAdd( menu, "git-push", i18n( "git_push", "Push" ), "repo-push" ); + menuAdd( menu, "git-stash", i18n( "git_stash_all", "Stash All" ), "git-stash" ); menu->on( Event::OnItemClicked, [this, model, repoName, repoPath]( const Event* event ) { @@ -1541,28 +1541,33 @@ void GitPlugin::openBranchMenu( const Git::Branch& branch ) { menu->setId( "git_branch_menu" ); if ( branch.type != Git::RefType::Stash ) { - addMenuItem( menu, "git-fetch", "Fetch", "repo-fetch" ); + menuAdd( menu, "git-fetch", i18n( "git_fetch", "Fetch" ), "repo-fetch" ); if ( gitBranch() != branch.name ) { - addMenuItem( menu, "git-checkout", "Check Out...", "git-fetch" ); + menuAdd( menu, "git-checkout", i18n( "git_checkout_ellipsis", "Check Out..." ), + "git-fetch" ); } if ( branch.type == Git::RefType::Head ) { - addMenuItem( menu, "git-branch-rename", "Rename", "", { KEY_F2 } ); - addMenuItem( menu, "git-pull", "Pull", "repo-pull" ); + menuAdd( menu, "git-branch-rename", i18n( "git_rename", "Rename" ), "", { KEY_F2 } ); + menuAdd( menu, "git-pull", i18n( "git_pull", "Pull" ), "repo-pull" ); if ( branch.ahead ) - addMenuItem( menu, "git-push", "Push", "repo-push" ); + menuAdd( menu, "git-push", i18n( "git_push", "Push" ), "repo-push" ); if ( branch.behind ) - addMenuItem( menu, "git-fast-forward-merge", "Fast Forward Merge" ); + menuAdd( menu, "git-fast-forward-merge", + i18n( "git_fast_forward_merge", "Fast Forward Merge" ) ); menu->addSeparator(); - addMenuItem( menu, "git-branch-delete", "Delete", "remove" ); + menuAdd( menu, "git-branch-delete", i18n( "git_delete_branch", "Delete" ), "remove" ); } - addMenuItem( menu, "git-merge-branch", "Merge Branch", "git-merge" ); - addMenuItem( menu, "git-create-branch", "Create Branch", "repo-forked", { KEY_F7 } ); + menuAdd( menu, "git-merge-branch", i18n( "git_merge_branch", "Merge Branch" ), + "git-merge" ); + menuAdd( menu, "git-create-branch", i18n( "git_create_branch", "Create Branch" ), + "repo-forked", { KEY_F7 } ); } else { - addMenuItem( menu, "git-stash-apply", "Apply Stash", "git-stash-apply" ); - addMenuItem( menu, "git-stash-drop", "Drop Stash", "git-stash-pop" ); + menuAdd( menu, "git-stash-apply", i18n( "git_apply_stash", "Apply Stash" ), + "git-stash-apply" ); + menuAdd( menu, "git-stash-drop", i18n( "git_drop_stash", "Drop Stash" ), "git-stash-pop" ); } menu->on( Event::OnItemClicked, [this, branch]( const Event* event ) { @@ -1602,19 +1607,19 @@ void GitPlugin::openFileStatusMenu( const Git::DiffFile& file ) { UIPopUpMenu* menu = UIPopUpMenu::New(); menu->setId( "git_file_status_menu" ); - addMenuItem( menu, "git-open-file", "Open File", "file" ); - addMenuItem( menu, "git-diff", "Open Diff", "diff-single" ); + menuAdd( menu, "git-open-file", i18n( "git_open_file", "Open File" ), "file" ); + menuAdd( menu, "git-diff", i18n( "git_open_diff", "Open Diff" ), "diff-single" ); if ( file.report.type != Git::GitStatusType::Staged ) { - addMenuItem( menu, "git-stage", "Stage" ); + menuAdd( menu, "git-stage", i18n( "git_stage", "Stage" ) ); } else { - addMenuItem( menu, "git-unstage", "Unstage" ); + menuAdd( menu, "git-unstage", i18n( "git_unstage", "Unstage" ) ); } menu->addSeparator(); if ( file.report.type != Git::GitStatusType::Staged ) - addMenuItem( menu, "git-discard", "Discard" ); + menuAdd( menu, "git-discard", i18n( "git_discard", "Discard" ) ); menu->on( Event::OnItemClicked, [this, file]( const Event* event ) { if ( !mGit ) @@ -1663,15 +1668,14 @@ void GitPlugin::runAsync( std::function fn, bool _updateStatus, b } ); } -void GitPlugin::addMenuItem( UIMenu* menu, const std::string& txtKey, const std::string& txtVal, - const std::string& icon, - const KeyBindings::Shortcut& forcedKeybinding ) { +void GitPlugin::menuAdd( UIMenu* menu, const std::string& cmd, const std::string& text, + const std::string& icon, const KeyBindings::Shortcut& forcedKeybinding ) { - menu->add( i18n( txtKey, txtVal ), iconDrawable( icon, 12 ), - forcedKeybinding.empty() ? KeyBindings::keybindFormat( mKeyBindings[txtKey] ) + menu->add( text, iconDrawable( icon, 12 ), + forcedKeybinding.empty() ? KeyBindings::keybindFormat( mKeyBindings[cmd] ) : getUISceneNode()->getKeyBindings().getShortcutString( forcedKeybinding, true ) ) - ->setId( txtKey ); + ->setId( cmd ); } std::string GitPlugin::repoSelected() { diff --git a/src/tools/ecode/plugins/git/gitplugin.hpp b/src/tools/ecode/plugins/git/gitplugin.hpp index 45bcfc40f..0ec154052 100644 --- a/src/tools/ecode/plugins/git/gitplugin.hpp +++ b/src/tools/ecode/plugins/git/gitplugin.hpp @@ -207,9 +207,9 @@ class GitPlugin : public PluginBase { bool displaySuccessMsg = false, bool updateBranchesOnError = false, bool updateStatusOnError = false ); - void addMenuItem( UIMenu* menu, const std::string& txtKey, const std::string& txtVal, - const std::string& icon = "", - const KeyBindings::Shortcut& forcedKeybinding = KeyBindings::Shortcut() ); + void menuAdd( UIMenu* menu, const std::string& cmd, const std::string& text, + const std::string& icon = "", + const KeyBindings::Shortcut& forcedKeybinding = KeyBindings::Shortcut() ); std::string repoSelected(); diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index 1623376ab..dab2430ad 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -1306,7 +1306,7 @@ bool LinterPlugin::onCreateContextMenu( UICodeEditor* editor, UIPopUpMenu* menu, for ( auto& match : matches ) { if ( match.box[editor].contains( localPos ) ) { menu->addSeparator(); - menu->add( editor->i18n( "copy_error_message", "Copy Error Message" ), + menu->add( editor->i18n( "linter_copy_error_message", "Copy Error Message" ), mManager->getUISceneNode()->findIcon( "copy" )->getSize( PixelDensity::dpToPxI( 12 ) ) ) ->setId( "linter-copy-error-message" ); diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp index 74c75bec6..9ae8d57cf 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp @@ -1348,52 +1348,60 @@ bool LSPClientPlugin::onCreateContextMenu( UICodeEditor* editor, UIPopUpMenu* me menu->addSeparator(); - auto addFn = [this, menu]( const std::string& txtKey, const std::string& txtVal, - const std::string& icon = "" ) { - menu->add( i18n( txtKey, txtVal ), iconDrawable( icon, 12 ), - KeyBindings::keybindFormat( mKeyBindings[txtKey] ) ) - ->setId( txtKey ); + auto addFn = [this, menu]( const std::string& cmd, const std::string& text, + const std::string& icon = "" ) { + menu->add( text, iconDrawable( icon, 12 ), KeyBindings::keybindFormat( mKeyBindings[cmd] ) ) + ->setId( cmd ); }; auto& cap = server->getCapabilities(); - addFn( "lsp-symbol-info", "Symbol Info" ); + addFn( "lsp-symbol-info", i18n( "lsp_symbol_info", "Symbol Info" ) ); if ( cap.definitionProvider ) - addFn( "lsp-go-to-definition", "Go To Definition" ); + addFn( "lsp-go-to-definition", i18n( "lsp_go_to_definition", "Go To Definition" ) ); if ( cap.declarationProvider ) - addFn( "lsp-go-to-declaration", "Go To Declaration" ); + addFn( "lsp-go-to-declaration", i18n( "lsp_go_to_declaration", "Go To Declaration" ) ); if ( cap.typeDefinitionProvider ) - addFn( "lsp-go-to-type-definition", "Go To Type Definition" ); + addFn( "lsp-go-to-type-definition", + i18n( "lsp_go_to_type_definition", "Go To Type Definition" ) ); if ( cap.implementationProvider ) - addFn( "lsp-go-to-implementation", "Go To Implementation" ); + addFn( "lsp-go-to-implementation", + i18n( "lsp_go_to_implementation", "Go To Implementation" ) ); if ( cap.renameProvider ) - addFn( "lsp-rename-symbol-under-cursor", "Rename Symbol Under Cursor" ); + addFn( "lsp-rename-symbol-under-cursor", + i18n( "lsp_rename_symbol_under_cursor", "Rename Symbol Under Cursor" ) ); if ( cap.referencesProvider ) - addFn( "lsp-symbol-references", "Find References to Symbol Under Cursor" ); + addFn( "lsp-symbol-references", i18n( "lsp_find_references_to_symbol_under_cursor", + "Find References to Symbol Under Cursor" ) ); if ( cap.codeActionProvider ) - addFn( "lsp-symbol-code-action", "Code Action", "lightbulb-autofix" ); + addFn( "lsp-symbol-code-action", i18n( "lsp_code_action", "Code Action" ), + "lightbulb-autofix" ); if ( cap.documentRangeFormattingProvider && editor->getDocument().getSelection().hasSelection() ) - addFn( "lsp-format-range", "Format Selected Range" ); + addFn( "lsp-format-range", i18n( "lsp_format_selected_range", "Format Selected Range" ) ); if ( cap.semanticTokenProvider.full || cap.semanticTokenProvider.fullDelta ) - addFn( "lsp-refresh-semantic-highlighting", "Refresh Semantic Highlighting", "refresh" ); + addFn( "lsp-refresh-semantic-highlighting", + i18n( "lsp_refresh_semantic_highlighting", "Refresh Semantic Highlighting" ), + "refresh" ); if ( server->getDefinition().language == "cpp" || server->getDefinition().language == "c" ) - addFn( "lsp-switch-header-source", "Switch Header/Source", "filetype-hpp" ); + addFn( "lsp-switch-header-source", + i18n( "lsp_switch_header_source", "Switch Header/Source" ), "filetype-hpp" ); - addFn( "lsp-plugin-restart", "Restart LSP Client", "refresh" ); + addFn( "lsp-plugin-restart", i18n( "lsp_restart_lsp_client", "Restart LSP Client" ), + "refresh" ); #ifdef EE_DEBUG if ( server->getDefinition().name == "clangd" ) - addFn( "lsp-memory-usage", "LSP Memory Usage" ); + addFn( "lsp-memory-usage", i18n( "lsp_memory_usage", "LSP Memory Usage" ) ); #endif return false; diff --git a/src/tools/ecode/projectbuild.cpp b/src/tools/ecode/projectbuild.cpp index 60a4aa100..72d9bb10c 100644 --- a/src/tools/ecode/projectbuild.cpp +++ b/src/tools/ecode/projectbuild.cpp @@ -711,11 +711,11 @@ void ProjectBuildManager::runBuild( const std::string& buildName, const std::str if ( progressFn ) { progressFn( 0, Sys::getDateTimeStr() + ": " + - String::format( - i18n( "running_steps_for_project", "Running steps for project %s...\n" ) - .toUtf8() - .c_str(), - buildName.c_str() ), + String::format( i18n( "running_steps_for_project_ellipsis", + "Running steps for project %s...\n" ) + .toUtf8() + .c_str(), + buildName.c_str() ), nullptr ); if ( !buildType.empty() ) diff --git a/src/tools/ecode/projectdirectorytree.cpp b/src/tools/ecode/projectdirectorytree.cpp index 9a04edcfc..ca97b043c 100644 --- a/src/tools/ecode/projectdirectorytree.cpp +++ b/src/tools/ecode/projectdirectorytree.cpp @@ -223,10 +223,12 @@ ProjectDirectoryTree::emptyModel( const std::vector& prependCommand } size_t ProjectDirectoryTree::getFilesCount() const { + Lock l( mFilesMutex ); return mFiles.size(); } const std::vector& ProjectDirectoryTree::getFiles() const { + Lock l( mFilesMutex ); return mFiles; } diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp index 3e7e3b8be..5f8e65ce8 100644 --- a/src/tools/ecode/settingsmenu.cpp +++ b/src/tools/ecode/settingsmenu.cpp @@ -41,16 +41,16 @@ void SettingsMenu::createSettingsMenu( App* app ) { getKeybind( "create-new-window" ) ) ->setId( "create-new-window" ); mSettingsMenu - ->add( i18n( "open_file", "Open File..." ), findIcon( "document-open" ), + ->add( i18n( "open_file_ellipsis", "Open File..." ), findIcon( "document-open" ), getKeybind( "open-file" ) ) ->setId( "open-file" ); mSettingsMenu - ->add( i18n( "open_folder", "Open Folder..." ), findIcon( "document-open" ), + ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), findIcon( "document-open" ), getKeybind( "open-folder" ) ) ->setId( "open-folder" ); mSettingsMenu - ->add( i18n( "open_file_from_web", "Open File from Web..." ), findIcon( "download-cloud" ), - getKeybind( "download-file-web" ) ) + ->add( i18n( "open_file_from_web_ellipsis", "Open File from Web..." ), + findIcon( "download-cloud" ), getKeybind( "download-file-web" ) ) ->setId( "download-file-web" ); mSettingsMenu ->addSubMenu( i18n( "recent_files", "Recent Files" ), findIcon( "document-recent" ), @@ -65,7 +65,7 @@ void SettingsMenu::createSettingsMenu( App* app ) { ->add( i18n( "save", "Save" ), findIcon( "document-save" ), getKeybind( "save-doc" ) ) ->setId( "save-doc" ); mSettingsMenu - ->add( i18n( "save_as", "Save as..." ), findIcon( "document-save-as" ), + ->add( i18n( "save_as_ellipsis", "Save as..." ), findIcon( "document-save-as" ), getKeybind( "save-as-doc" ) ) ->setId( "save-as-doc" ); mSettingsMenu @@ -181,7 +181,7 @@ UIMenu* SettingsMenu::createFileTypeMenu() { if ( menu->getCount() == maxItems && names.size() - total > 1 ) { UIPopUpMenu* newMenu = UIPopUpMenu::New(); - menu->addSubMenu( i18n( "more...", "More..." ), nullptr, newMenu ); + menu->addSubMenu( i18n( "more_ellipsis", "More..." ), nullptr, newMenu ); newMenu->addEventListener( Event::OnItemClicked, cb ); mFileTypeMenues.push_back( newMenu ); menu = newMenu; @@ -221,7 +221,7 @@ UIMenu* SettingsMenu::createColorSchemeMenu() { if ( menu->getCount() == maxItems && colorSchemes.size() - total > 1 ) { UIPopUpMenu* newMenu = UIPopUpMenu::New(); - menu->addSubMenu( i18n( "more...", "More..." ), nullptr, newMenu ); + menu->addSubMenu( i18n( "more_ellipsis", "More..." ), nullptr, newMenu ); newMenu->addEventListener( Event::OnItemClicked, cb ); mColorSchemeMenues.push_back( newMenu ); menu = newMenu; @@ -823,13 +823,13 @@ UIMenu* SettingsMenu::createEditMenu() { getKeybind( "find-replace" ) ) ->setId( "find-replace" ); menu->addSeparator(); - menu->add( i18n( "open_containing_folder", "Open Containing Folder..." ), + menu->add( i18n( "open_containing_folder_ellipsis", "Open Containing Folder..." ), findIcon( "folder-open" ), getKeybind( "open-containing-folder" ) ) ->setId( "open-containing-folder" ); - menu->add( i18n( "open_in_new_window", "Open in New Window..." ), findIcon( "window" ), + menu->add( i18n( "open_in_new_window_ellipsis", "Open in New Window..." ), findIcon( "window" ), getKeybind( "open-in-new-window" ) ) ->setId( "open-in-new-window" ); - menu->add( i18n( "copy_containing_folder_path", "Copy Containing Folder Path..." ), + menu->add( i18n( "copy_containing_folder_path_ellipsis", "Copy Containing Folder Path..." ), findIcon( "copy" ), getKeybind( "copy-containing-folder-path" ) ) ->setId( "copy-containing-folder-path" ); menu->add( i18n( "copy_file_path", "Copy File Path" ), findIcon( "copy" ), @@ -907,13 +907,16 @@ UIMenu* SettingsMenu::createWindowMenu() { ->setId( "editor-font-size" ); mWindowMenu->add( i18n( "terminal_font_size", "Terminal Font Size" ), findIcon( "font-size" ) ) ->setId( "terminal-font-size" ); - mWindowMenu->add( i18n( "serif_font", "Serif Font..." ), findIcon( "font-size" ) ) + mWindowMenu->add( i18n( "serif_font_ellipsis", "Serif Font..." ), findIcon( "font-size" ) ) ->setId( "serif-font" ); - mWindowMenu->add( i18n( "monospace_font", "Monospace Font..." ), findIcon( "font-size" ) ) + mWindowMenu + ->add( i18n( "monospace_font_ellipsis", "Monospace Font..." ), findIcon( "font-size" ) ) ->setId( "monospace-font" ); - mWindowMenu->add( i18n( "terminal_font", "Terminal Font..." ), findIcon( "font-size" ) ) + mWindowMenu + ->add( i18n( "terminal_font_ellipsis", "Terminal Font..." ), findIcon( "font-size" ) ) ->setId( "terminal-font" ); - mWindowMenu->add( i18n( "fallback_font", "Fallback Font..." ), findIcon( "font-size" ) ) + mWindowMenu + ->add( i18n( "fallback_font_ellipsis", "Fallback Font..." ), findIcon( "font-size" ) ) ->setId( "fallback-font" ); mWindowMenu->addSeparator(); mWindowMenu @@ -934,12 +937,12 @@ UIMenu* SettingsMenu::createWindowMenu() { mApp->getConfig().ui.showStatusBar, getKeybind( "toggle-status-bar" ) ) ->setId( "toggle-status-bar" ); mWindowMenu - ->add( i18n( "move_panel_left", "Move panel to left..." ), findIcon( "layout-left" ), - getKeybind( "layout-left" ) ) + ->add( i18n( "move_panel_left_ellipsis", "Move panel to left..." ), + findIcon( "layout-left" ), getKeybind( "layout-left" ) ) ->setId( "move-panel-left" ); mWindowMenu - ->add( i18n( "move_panel_right", "Move panel to right..." ), findIcon( "layout-right" ), - getKeybind( "layout-rigth" ) ) + ->add( i18n( "move_panel_right_ellipsis", "Move panel to right..." ), + findIcon( "layout-right" ), getKeybind( "layout-rigth" ) ) ->setId( "move-panel-right" ); mWindowMenu->addSeparator(); mWindowMenu @@ -1138,7 +1141,7 @@ UIMenu* SettingsMenu::createViewMenu() { mViewMenu->addCheckBox( i18n( "highlight_selection_match", "Highlight Selection Match" ) ) ->setActive( mApp->getConfig().editor.highlightSelectionMatch ) ->setId( "highlight-selection-match" ); - mViewMenu->addCheckBox( i18n( "enable-vertical-scrollbar", "Enable Vertical ScrollBar" ) ) + mViewMenu->addCheckBox( i18n( "enable_vertical_scrollbar", "Enable Vertical ScrollBar" ) ) ->setActive( mApp->getConfig().editor.verticalScrollbar ) ->setId( "enable-vertical-scrollbar" ); mViewMenu->addCheckBox( i18n( "enable_horizontal_scrollbar", "Enable Horizontal ScrollBar" ) ) @@ -1289,30 +1292,31 @@ UIMenu* SettingsMenu::createViewMenu() { UIPopUpMenu* SettingsMenu::createToolsMenu() { mToolsMenu = UIPopUpMenu::New(); mToolsMenu - ->add( i18n( "locate", "Locate..." ), findIcon( "search" ), getKeybind( "open-locatebar" ) ) + ->add( i18n( "locate_ellipsis", "Locate..." ), findIcon( "search" ), + getKeybind( "open-locatebar" ) ) ->setId( "open-locatebar" ); mToolsMenu - ->add( i18n( "command_palette", "Command Palette..." ), findIcon( "search" ), + ->add( i18n( "command_palette_ellipsis", "Command Palette..." ), findIcon( "search" ), getKeybind( "open-command-palette" ) ) ->setId( "open-command-palette" ); mToolsMenu - ->add( i18n( "project_find", "Project Find..." ), findIcon( "search" ), + ->add( i18n( "project_find_ellipsis", "Project Find..." ), findIcon( "search" ), getKeybind( "open-global-search" ) ) ->setId( "open-global-search" ); mToolsMenu - ->add( i18n( "show_open_documents", "Show Open Documents..." ), findIcon( "search" ), - getKeybind( "show-open-documents" ) ) + ->add( i18n( "show_open_documents_ellipsis", "Show Open Documents..." ), + findIcon( "search" ), getKeybind( "show-open-documents" ) ) ->setId( "show-open-documents" ); mToolsMenu - ->add( i18n( "workspace_symbol_find", "Search Worskspace Symbol..." ), findIcon( "search" ), - getKeybind( "open-workspace-symbol-search" ) ) + ->add( i18n( "workspace_symbol_find_ellipsis", "Search Worskspace Symbol..." ), + findIcon( "search" ), getKeybind( "open-workspace-symbol-search" ) ) ->setId( "open-workspace-symbol-search" ); mToolsMenu - ->add( i18n( "document_symbol_find", "Search Document Symbol..." ), findIcon( "search" ), - getKeybind( "open-document-symbol-search" ) ) + ->add( i18n( "document_symbol_find_ellipsis", "Search Document Symbol..." ), + findIcon( "search" ), getKeybind( "open-document-symbol-search" ) ) ->setId( "open-workspace-symbol-search" ); mToolsMenu - ->add( i18n( "go_to_line", "Go to line..." ), findIcon( "go-to-line" ), + ->add( i18n( "go_to_line_ellipsis", "Go to line..." ), findIcon( "go-to-line" ), getKeybind( "go-to-line" ) ) ->setId( "go-to-line" ); @@ -1559,11 +1563,13 @@ void SettingsMenu::createProjectTreeMenu() { mProjectTreeMenu = UIPopUpMenu::New(); if ( !mApp->getCurrentProject().empty() ) { - mProjectTreeMenu->add( i18n( "new_file", "New File..." ), findIcon( "file-add" ) ) + mProjectTreeMenu->add( i18n( "new_file_ellipsis", "New File..." ), findIcon( "file-add" ) ) ->setId( "new_file" ); - mProjectTreeMenu->add( i18n( "new_folder", "New Folder..." ), findIcon( "folder-add" ) ) + mProjectTreeMenu + ->add( i18n( "new_folder_ellipsis", "New Folder..." ), findIcon( "folder-add" ) ) ->setId( "new_folder" ); - mProjectTreeMenu->add( i18n( "open_folder", "Open Folder..." ), findIcon( "folder-open" ) ) + mProjectTreeMenu + ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), findIcon( "folder-open" ) ) ->setId( "open_folder" ); mProjectTreeMenu ->add( i18n( "execute_dir_in_terminal", "Open directory in terminal" ), @@ -1580,13 +1586,16 @@ void SettingsMenu::createProjectTreeMenu() { !mApp->getFileSystemModel()->getDisplayConfig().ignoreHidden ) ->setId( "show-hidden-files" ); mProjectTreeMenu->addSeparator(); - mProjectTreeMenu->add( i18n( "refresh_view", "Refresh View..." ), findIcon( "refresh" ) ) + mProjectTreeMenu + ->add( i18n( "refresh_view_ellipsis", "Refresh View..." ), findIcon( "refresh" ) ) ->setId( "refresh-view" ); mProjectTreeMenu->addSeparator(); - mProjectTreeMenu->add( i18n( "configure_ignore_files", "Configure Ignore Files..." ) ) + mProjectTreeMenu + ->add( i18n( "configure_ignore_files_ellipsis", "Configure Ignore Files..." ) ) ->setId( "configure-ignore-files" ); } else if ( !mApp->getFileSystemModel() ) { - mProjectTreeMenu->add( i18n( "open_folder", "Open Folder..." ), findIcon( "folder-open" ) ) + mProjectTreeMenu + ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), findIcon( "folder-open" ) ) ->setId( "open-folder" ); } @@ -1635,11 +1644,13 @@ void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { mProjectTreeMenu = UIPopUpMenu::New(); if ( file.isDirectory() ) { - mProjectTreeMenu->add( i18n( "new_file", "New File..." ), findIcon( "file-add" ) ) + mProjectTreeMenu->add( i18n( "new_file_ellipsis", "New File..." ), findIcon( "file-add" ) ) ->setId( "new_file" ); - mProjectTreeMenu->add( i18n( "new_folder", "New Folder..." ), findIcon( "folder-add" ) ) + mProjectTreeMenu + ->add( i18n( "new_folder_ellipsis", "New Folder..." ), findIcon( "folder-add" ) ) ->setId( "new_folder" ); - mProjectTreeMenu->add( i18n( "open_folder", "Open Folder..." ), findIcon( "folder-open" ) ) + mProjectTreeMenu + ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), findIcon( "folder-open" ) ) ->setId( "open_folder" ); } else { if ( file.isRegularFile() ) { @@ -1647,7 +1658,7 @@ void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { FileSystem::dirAddSlashAtEnd( curDir ); if ( curDir == file.getDirectoryPath() ) { mProjectTreeMenu - ->add( i18n( "new_file_in_file_folder", "New File in File Folder..." ), + ->add( i18n( "new_file_in_file_folder_ellipsis", "New File in File Folder..." ), findIcon( "file-add" ) ) ->setId( "new_file" ); } @@ -1656,20 +1667,21 @@ void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { mProjectTreeMenu->add( i18n( "open_file", "Open File" ), findIcon( "document-open" ) ) ->setId( "open_file" ); mProjectTreeMenu - ->add( i18n( "open_containin_folder", "Open Containing Folder..." ), + ->add( i18n( "open_containing_folder_ellipsis", "Open Containing Folder..." ), findIcon( "folder-open" ) ) ->setId( "open_containing_folder" ); mProjectTreeMenu - ->add( i18n( "new_file_in_directory", "New File in directory..." ), + ->add( i18n( "new_file_in_directory_ellipsis", "New File in directory..." ), findIcon( "file-add" ) ) ->setId( "new_file_in_place" ); mProjectTreeMenu - ->add( i18n( "duplicate_file", "Duplicate File..." ), findIcon( "file-copy" ) ) + ->add( i18n( "duplicate_file_ellipsis", "Duplicate File..." ), findIcon( "file-copy" ) ) ->setId( "duplicate_file" ); } mProjectTreeMenu->add( i18n( "rename", "Rename" ), findIcon( "edit" ), "F2" ) ->setId( "rename" ); - mProjectTreeMenu->add( i18n( "remove", "Remove..." ), findIcon( "delete-bin" ), "Delete" ) + mProjectTreeMenu + ->add( i18n( "remove_ellipsis", "Remove..." ), findIcon( "delete-bin" ), "Delete" ) ->setId( "remove" ); if ( file.isDirectory() || file.isExecutable() ) { @@ -1700,12 +1712,14 @@ void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { mProjectTreeMenu->add( i18n( "expand_all", "Expand All" ), findIcon( "expand-all" ) ) ->setId( "expand-all" ); mProjectTreeMenu->addSeparator(); - mProjectTreeMenu->add( i18n( "refresh_view", "Refresh View..." ), findIcon( "refresh" ) ) + mProjectTreeMenu + ->add( i18n( "refresh_view_ellipsis", "Refresh View..." ), findIcon( "refresh" ) ) ->setId( "refresh-view" ); if ( !mApp->getCurrentProject().empty() ) { mProjectTreeMenu->addSeparator(); - mProjectTreeMenu->add( i18n( "configure_ignore_files", "Configure Ignore Files..." ) ) + mProjectTreeMenu + ->add( i18n( "configure_ignore_files_ellipsis", "Configure Ignore Files..." ) ) ->setId( "configure-ignore-files" ); } diff --git a/src/tools/ecode/terminalmanager.cpp b/src/tools/ecode/terminalmanager.cpp index 511273257..1fbf29a72 100644 --- a/src/tools/ecode/terminalmanager.cpp +++ b/src/tools/ecode/terminalmanager.cpp @@ -213,7 +213,7 @@ UIMenu* TerminalManager::createColorSchemeMenu() { if ( menu->getCount() == maxItems && colorSchemes.size() - total > 1 ) { UIPopUpMenu* newMenu = UIPopUpMenu::New(); - menu->addSubMenu( mApp->i18n( "more...", "More..." ), nullptr, newMenu ); + menu->addSubMenu( mApp->i18n( "more_ellipsis", "More..." ), nullptr, newMenu ); newMenu->addEventListener( Event::OnItemClicked, cb ); mColorSchemeMenues.push_back( newMenu ); menu = newMenu; @@ -311,7 +311,7 @@ UITerminal* TerminalManager::createNewTerminal( const std::string& title, UITabW UIMessageBox* msgBox = UIMessageBox::New( UIMessageBox::INPUT, mApp->i18n( "new_terminal_name", "New terminal name:" ) ); msgBox->setTitle( mApp->getWindowTitle() ); - msgBox->getTextInput()->setHint( mApp->i18n( "any_name", "Any name..." ) ); + msgBox->getTextInput()->setHint( mApp->i18n( "any_name_ellipsis", "Any name..." ) ); msgBox->setCloseShortcut( { KEY_ESCAPE, KEYMOD_NONE } ); msgBox->showWhenReady(); msgBox->addEventListener( Event::OnConfirm, [&, msgBox, term]( const Event* ) { diff --git a/src/tools/ecode/uiwelcomescreen.cpp b/src/tools/ecode/uiwelcomescreen.cpp index 20adff8c0..96bacb279 100644 --- a/src/tools/ecode/uiwelcomescreen.cpp +++ b/src/tools/ecode/uiwelcomescreen.cpp @@ -111,8 +111,8 @@ static const auto LAYOUT = R"xml(