From 9b8fa85b3272d51b92d837b0e67da5a3c78b8cdf Mon Sep 17 00:00:00 2001 From: Zhuang Jiezhi <840064358@qq.com> Date: Sun, 12 Nov 2023 22:52:54 +0000 Subject: [PATCH] feat:Add python API GetKicadCurrentLanguage --- pcbnew/python/scripting/pcbnew_scripting_helpers.cpp | 8 ++++++++ pcbnew/python/scripting/pcbnew_scripting_helpers.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index 3bd59f8b31..8cab51a955 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -605,3 +605,11 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, return true; } + +wxString GetLanguage() +{ + if( s_PcbEditFrame ) + return GetSettingsManager()->GetCommonSettings()->m_System.language; + else + return ""; +} diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.h b/pcbnew/python/scripting/pcbnew_scripting_helpers.h index 42448acf4b..fc02055c97 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.h +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.h @@ -209,4 +209,11 @@ bool IsActionRunning(); bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, bool aReportAllTrackErrors ); +/** + * Get the language string from COMMON_SETTINGS. + * + * @return the current language string. + */ +wxString GetLanguage(); + #endif // __PCBNEW_SCRIPTING_HELPERS_H