Skip to content

Commit

Permalink
Translation 18
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaloop committed Jul 13, 2023
1 parent 7d6e92b commit f8b4ba8
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 159 deletions.
2 changes: 2 additions & 0 deletions ExplorerPatcher/ExplorerPatcher.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="helper.c" />
<ClCompile Include="HideExplorerSearchBar.c" />
<ClCompile Include="ImmersiveFlyouts.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -315,6 +316,7 @@
<ClInclude Include="fmemopen.h" />
<ClInclude Include="getline.h" />
<ClInclude Include="GUI.h" />
<ClInclude Include="helper.h" />
<ClInclude Include="HideExplorerSearchBar.h" />
<ClInclude Include="hooking.h" />
<ClInclude Include="ep_private.h" />
Expand Down
6 changes: 6 additions & 0 deletions ExplorerPatcher/ExplorerPatcher.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<ClInclude Include="osutility.h">
<Filter>Header Files\internal</Filter>
</ClInclude>
<ClInclude Include="helper.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ExplorerPatcher.rc">
Expand Down Expand Up @@ -214,6 +217,9 @@
<ClCompile Include="lvt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="helper.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="settings.reg">
Expand Down
59 changes: 32 additions & 27 deletions ExplorerPatcher/GUI.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <initguid.h>
#include <locale.h>
DEFINE_GUID(LiveSetting_Property_GUID, 0xc12bcd8e, 0x2a8e, 0x4950, 0x8a, 0xe7, 0x36, 0x25, 0x11, 0x1d, 0x58, 0xeb);
#include <oleacc.h>
#include "GUI.h"
Expand Down Expand Up @@ -125,13 +126,15 @@ void PlayHelpMessage(GUI* _this)
swprintf_s(
wszAccText,
1000,
L"Welcome to ExplorerPatcher. "
L"Selected page is: %s: %d of %d. "
L"To switch pages, press the Left or Right arrow keys or press a number (%d to %d). "
L"To select an item, press the Up or Down arrow keys or Shift+Tab and Tab. "
L"To interact with the selected item, press Space or Return. "
L"To close this window, press Escape. "
L"Press a number to switch to the corresponding page: ",
Utf8Text(
"欢迎使用 ExplorerPatcher。"
"当前页面是:%s (%d/%d)。"
"按左右方向键、数字键 %d 到 %d 可以切换页面。"
"按上下方向键、Tab 和 Shift+Tab 可以切换条目。"
"按空格或回车修改选项。"
"按 Esc 关闭设置窗口。"
"数字键对应的页面:"
),
_this->sectionNames[_this->section],
_this->section + 1,
max_section + 1,
Expand All @@ -148,7 +151,7 @@ void PlayHelpMessage(GUI* _this)
swprintf_s(wszAdd, 100, L"%d: %s, ", i + 1, _this->sectionNames[i]);
wcscat_s(wszAccText, 1000, wszAdd);
}
wcscat_s(wszAccText, 1000, L"\nTo listen to this message again, press the F1 key at any time.\n");
wcscat_s(wszAccText, 1000, Utf8Text("\n如需再次阅读此消息,请按 F1。\n"));
SetWindowTextW(_this->hAccLabel, wszAccText);
NotifyWinEvent(
EVENT_OBJECT_LIVEREGIONCHANGED,
Expand Down Expand Up @@ -951,6 +954,7 @@ static void GUI_SetSection(GUI* _this, BOOL bCheckEnablement, int dwSection)

static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
setlocale(LC_ALL, "chs");
GUI* _this;
LONG_PTR ptr = GetWindowLongPtr(hwnd, GWLP_USERDATA);
_this = (int*)(ptr);
Expand Down Expand Up @@ -1343,7 +1347,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
if (GetTimeFormatEx(wszWeatherLanguage[0] ? wszWeatherLanguage : wszLanguage, TIME_NOSECONDS, &stLastUpdate, NULL, wszTime, MAX_PATH))
{
bOk = TRUE;
swprintf_s(text, MAX_LINE_LENGTH, L"Last updated on: %s, %s.", wszDate, wszTime);
swprintf_s(text, MAX_LINE_LENGTH, Utf8Text(L"上次更新时间: %s, %s."), wszDate, wszTime);
}
}
}
Expand Down Expand Up @@ -1501,11 +1505,11 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
swprintf_s(
accText,
1000,
L"%s %s - Button.",
Utf8Text("%s %s - 按键。"),
(_this->dwPageLocation < 0 ?
L"Reached end of the page." :
Utf8Text("已经是最后一个页面") :
(_this->dwPageLocation > 0 ?
L"Reached beginning of the page." : L"")),
Utf8Text("已经是第一个页面") : L"")),
text
);
_this->dwPageLocation = 0;
Expand Down Expand Up @@ -1995,7 +1999,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
GUI_Build(0, hwnd, pt);
fclose(AuditFile);
AuditFile = NULL;
MessageBoxW(hwnd, L"Settings have been exported successfully.", GUI_title, MB_ICONINFORMATION);
MessageBoxW(hwnd, Utf8Text("导出成功。"), GUI_title, MB_ICONINFORMATION);
}
}
}
Expand Down Expand Up @@ -2029,8 +2033,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
else
{
wcscpy_s(title, MAX_PATH, L"Import settings");
wcscpy_s(filter, MAX_PATH, L"Registration Files (*.reg)\0*.reg\0\0");
wcscpy_s(title, MAX_PATH, Utf8Text("导入设置"));
wcscpy_s(filter, MAX_PATH, Utf8Text("注册表文件 (*.reg)\0*.reg\0\0"));
}
WCHAR wszPath[MAX_PATH];
ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));
Expand Down Expand Up @@ -2198,10 +2202,11 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
if (MessageBoxW(
hwnd,
L"Are you sure you want to permanently clear the weather widget's local data?\n\n"
L"This will reset the internal components to their default state, but will preserve "
L"your preferences. This may fix the widget not loading the data properly, or "
L"having layout issues etc.",
Utf8Text(
"确定清空天气小组件的本地数据吗?\n\n"
"这将会重置其内部组件,但是保留自定义设置。\n"
"可能可以解决数据和渲染错误。"
),
_T(PRODUCT_NAME),
MB_ICONQUESTION | MB_YESNO) == IDYES)
{
Expand All @@ -2215,21 +2220,21 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
PleaseWaitCallbackData = &res;
PleaseWaitCallbackFunc = GUI_Internal_DeleteWeatherFolder;
PleaseWaitHook = SetWindowsHookExW(WH_CALLWNDPROC, PleaseWait_HookProc, NULL, GetCurrentThreadId());
MessageBoxW(hwnd, L"Please wait...", _T(PRODUCT_NAME), 0);
MessageBoxW(hwnd, Utf8Text("请稍候..."), _T(PRODUCT_NAME), 0);
}
else
{
res = GUI_DeleteWeatherFolder();
}
if (res == IDOK)
{
MessageBoxW(hwnd, L"Weather widget data cleared successfully.", _T(PRODUCT_NAME), MB_ICONINFORMATION);
MessageBoxW(hwnd, Utf8Text("天气小组件数据已清空"), _T(PRODUCT_NAME), MB_ICONINFORMATION);
}
else
{
if (res == IDABORT)
{
MessageBoxW(hwnd, L"An error has occured while clearing the data.", _T(PRODUCT_NAME), MB_ICONERROR);
MessageBoxW(hwnd, Utf8Text("清空数据时发生错误"), _T(PRODUCT_NAME), MB_ICONERROR);
}
}
if (dwData)
Expand Down Expand Up @@ -3169,9 +3174,9 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
1000,
L"%s %s %s: %s",
(_this->dwPageLocation < 0 ?
L"Reached end of the page." :
Utf8Text("已经是最后一个页面") :
(_this->dwPageLocation > 0 ?
L"Reached beginning of the page." : L"")),
Utf8Text("已经是第一个页面") : L"")),
(lastHeading[0] == 0) ? L"" : lastHeading,
(dwType == 1 || dwType == 2) ? text + 1 : text,
dwType == 1 ? L"Enabled" :
Expand Down Expand Up @@ -3218,11 +3223,11 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
if (dwTypeRepl == 1)
{
swprintf_s(accText, 1000, accText2, L" - Requires registration as shell extension to work in Open or Save file dialogs - ");
swprintf_s(accText, 1000, accText2, Utf8Text(" - 需要注册为外壳扩展插件才能在打开、保存对话框中生效 - "));
}
else
{
swprintf_s(accText, 1000, accText2, L" - Requires File Explorer restart to apply - ");
swprintf_s(accText, 1000, accText2, Utf8Text(" - 需要重启文件管理器生效 - "));
}
//wprintf(L">>> %s\n", accText);
SetWindowTextW(_this->hAccLabel, accText);
Expand Down Expand Up @@ -3320,7 +3325,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
swprintf_s(
wszAccText,
100,
L"Selected page: %s: %d of %d.",
Utf8Text("当前页面:%s (%d/%d)"),
_this->sectionNames[_this->section],
_this->section + 1,
max_section + 1
Expand Down
1 change: 1 addition & 0 deletions ExplorerPatcher/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include "../ep_weather_host/ep_weather_host_h.h"
#include <ExDisp.h>
#include <ShlGuid.h>
#include "helper.h"

#define MAX_LINE_LENGTH 2000
extern HMODULE hModule;
Expand Down
30 changes: 30 additions & 0 deletions ExplorerPatcher/helper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "helper.h"

LPWSTR Utf8Text(LPCCH input)
{
//获取输入字符串大小
// int bufSize = strlen(input);

//获取所需缓冲大小
int cchSize = MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
input,
-1,
NULL,
0
);

LPWSTR output = (wchar_t*)malloc(cchSize*sizeof(wchar_t));

MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
input,
-1,
output,
cchSize
);

return output;
}
8 changes: 8 additions & 0 deletions ExplorerPatcher/helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _H_HELPER_H_
#define _H_HELPER_H_

#include <Windows.h>

LPWSTR Utf8Text(LPCCH input);

#endif
Loading

0 comments on commit f8b4ba8

Please sign in to comment.