Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Russian localization #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Battery/Battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ void CBattery::OnExtenedInfo(ExtendedInfoIndex index, const wchar_t* data)
//从配置文件读取配置
g_data.LoadConfig(std::wstring(data));

break;
case ITMPlugin::EI_TASKBAR_WND_SPERATE_WITH_SPACE:
g_data.m_setting_data.show_space = _wtoi(data);
break;
default:
break;
Expand Down
93 changes: 93 additions & 0 deletions Battery/Battery.rc
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,104 @@ BEGIN
IDS_HOUR "Сʱ"
IDS_MINUTE "����"
IDS_SECOND "��"
IDS_NA "N/A"
END

#endif // ����(���壬�й�) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// ������� (������) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_OPTIONS_DIALOG DIALOGEX 0, 0, 202, 87
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "�������"
FONT 9, "Segoe UI", 400, 0, 0x0
BEGIN
DEFPUSHBUTTON "��",IDOK,87,66,50,14
PUSHBUTTON "������",IDCANCEL,145,66,50,14
LTEXT "������� ��� �������:",IDC_STATIC,7,9,72,8
COMBOBOX IDC_COMBO1,82,7,113,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "���������� � ������� �� ����������� ���������",IDC_SHOW_TOOLTIPS_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,23,181,10
CONTROL "�������� �������",IDC_SHOW_PERCENT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,35,73,10
CONTROL "�������� �������",IDC_SHOW_CHARGING_ANIMATION_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,75,10
CONTROL "<a>�������</a>",IDC_HELP_SYSLINK,"SysLink",WS_TABSTOP,7,70,34,10
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_OPTIONS_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 195
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
END
#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// AFX_DIALOG_LAYOUT
//

IDD_OPTIONS_DIALOG AFX_DIALOG_LAYOUT
BEGIN
0
END


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE
BEGIN
IDS_PLUGIN_NAME "������ �������"
IDS_PLUGIN_DESCRIPTION "������ ������� ��� TrafficMonitor"
IDS_BATTERY "�������"
IDS_BATTYER_TYPE_NUMBER "������ �����"
IDS_BATTYER_TYPE_ICON "������ ������"
IDS_BATTYER_TYPE_NUMBER_IN_ICON "����� ������ ������"
IDS_BATTYER_TYPE_NUMBER_BESIDE_ICON "����� ����� � �������"
IDS_CHARGING "�������� ���������� ����������"
IDS_BATTERY_LIFE_TIME "����� ������ �� ������������"
END

STRINGTABLE
BEGIN
IDS_BATTERY_FULL_LIFE_TIME "����� ������ ������������ ��� ������ �������"
IDS_HOUR "�����"
IDS_MINUTE "�����"
IDS_SECOND "������"
IDS_NA "�/�"
END

#endif // ������� (������) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// Ӣ��(����) resources

Expand Down Expand Up @@ -270,6 +362,7 @@ BEGIN
IDS_HOUR "hour"
IDS_MINUTE "minute"
IDS_SECOND "second"
IDS_NA "N/A"
END

#endif // Ӣ��(����) resources
Expand Down
18 changes: 14 additions & 4 deletions Battery/BatteryItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ const wchar_t* CBatteryItem::GetItemValueText() const
const wchar_t* CBatteryItem::GetItemValueSampleText() const
{
if (g_data.m_setting_data.show_percent)
return L"100%";
{
if (g_data.m_setting_data.show_space)
return L"100 %";
else
return L"100%";
}
else
return L"100";
}
Expand All @@ -63,7 +68,12 @@ int CBatteryItem::GetItemWidthEx(void * hDC) const

CString sample_str;
if (g_data.m_setting_data.show_percent)
sample_str = _T("100%");
{
if (g_data.m_setting_data.show_space)
sample_str = _T("100 %");
else
sample_str = _T("100%");
}
else
sample_str = _T("100");

Expand Down Expand Up @@ -93,14 +103,14 @@ void CBatteryItem::DrawItem(void* hDC, int x, int y, int w, int h, bool dark_mod
icon_point.y = rect.top + (rect.Height() - icon_size) / 2;
::DrawIconEx(pDC->GetSafeHdc(), icon_point.x, icon_point.y, hIcon, icon_size, icon_size, 0, NULL, DI_NORMAL);
//填充电量指示
if (g_data.m_sysPowerStatus.BatteryFlag != 128 && g_data.m_sysPowerStatus.BatteryLifePercent > 0 && g_data.m_sysPowerStatus.BatteryLifePercent <= 100)
if (!(g_data.m_sysPowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY) && g_data.m_sysPowerStatus.BatteryLifePercent != BATTERY_PERCENTAGE_UNKNOWN)
{
Gdiplus::RectF rc_indicater;
rc_indicater.X = icon_point.x + g_data.DPIF(1);
rc_indicater.Y = icon_point.y + g_data.DPIF(6);
double percent = g_data.m_sysPowerStatus.BatteryLifePercent;
//显示充电动画
if (g_data.m_setting_data.show_charging_animation && g_data.IsAcOnline() && g_data.m_sysPowerStatus.BatteryLifePercent < 100)
if (g_data.m_setting_data.show_charging_animation && g_data.IsCharging())
{
percent = g_data.m_sysPowerStatus.BatteryLifePercent + (battery_percent / 100 * (100 - g_data.m_sysPowerStatus.BatteryLifePercent));
}
Expand Down
17 changes: 8 additions & 9 deletions Battery/DataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,26 @@ HICON CDataManager::GetIcon(UINT id)

bool CDataManager::IsAcOnline() const
{
return m_sysPowerStatus.ACLineStatus == 1;
return m_sysPowerStatus.ACLineStatus == AC_LINE_ONLINE;
}

bool CDataManager::IsCharging() const
{
return m_sysPowerStatus.BatteryFlag == 8;
return m_sysPowerStatus.BatteryFlag & BATTERY_FLAG_CHARGING;
}

std::wstring CDataManager::GetBatteryString() const
{
if (m_sysPowerStatus.BatteryFlag == 128)
if (m_sysPowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY)
{
return L"N/A";
return g_data.StringRes(IDS_NA).GetString();
}
else
{
std::wstring str = std::to_wstring(m_sysPowerStatus.BatteryLifePercent);
if (m_setting_data.show_percent)
{
if (m_sysPowerStatus.BatteryLifePercent < 100)
if (g_data.m_setting_data.show_space)
str.push_back(L' ');
str.push_back(L'%');
}
Expand All @@ -155,10 +155,9 @@ std::wstring CDataManager::GetBatteryString() const

COLORREF CDataManager::GetBatteryColor() const
{
if (m_sysPowerStatus.BatteryLifePercent < 20)
if (m_sysPowerStatus.BatteryFlag & BATTERY_FLAG_CRITICAL)
return BATTERY_COLOR_CRITICAL;
else if (m_sysPowerStatus.BatteryLifePercent < 60)
if (m_sysPowerStatus.BatteryFlag & BATTERY_FLAG_LOW)
return BATTERY_COLOR_LOW;
else
return BATTERY_COLOR_HIGH;
return BATTERY_COLOR_HIGH;
}
1 change: 1 addition & 0 deletions Battery/DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct SettingData
bool show_battery_in_tooltip{};
bool show_percent{};
bool show_charging_animation{}; //显示充电动画
bool show_space{};
};

class CDataManager
Expand Down
1 change: 1 addition & 0 deletions Battery/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define IDS_HOUR 113
#define IDS_MINUTE 114
#define IDS_SECOND 115
#define IDS_NA 116
#define IDC_COMBO1 1000
#define IDC_SHOW_PERCENT_CHECK 1002
#define IDC_SHOW_CHARGING_ANIMATION_CHECK 1003
Expand Down
Loading