Skip to content

Fix build and complete the Simplified Chinese localization - #95

Open
Yangta0-L1yu wants to merge 3 commits into
voidtools:masterfrom
Yangta0-L1yu:master
Open

Yangta0-L1yu wants to merge 3 commits into
voidtools:masterfrom
Yangta0-L1yu:master

Conversation

@Yangta0-L1yu

Copy link
Copy Markdown

Master currently does not compile, and the Simplified Chinese localization
looks like it was never built. This PR fixes the build and finishes the
localization that is already in the tree.

The build failure

src/viv.c has already been switched to the
IDC_*_STATIC / _BUTTON / _COMBOBOX / _CHECKBOX naming, but
res/resource.h and res/voidImageViewer.rc still use the old control names,
and several dialog labels still share the single IDC_STATIC id:

src\viv.c(8726): error C2065: 'IDC_WINDOWEDBACKGROUNDCOLOR_BUTTON': undeclared identifier
src\viv.c(8755): error C2065: 'IDC_MAGNIFY_BLIT_MODE_COMBOBOX': undeclared identifier
src\viv.c(9685): error C2065: 'IDC_CUSTOM_RATE_STATIC': undeclared identifier
... (and ~25 more)

Providing the ids alone is not enough: while the labels share IDC_STATIC,
os_SetDlgItemText_localization_id() can only ever reach the first one, so the
Chinese text silently never appears on the other labels of the same page.

What this changes

  • res/resource.h - new unique ids 1055-1066 for the labels that are set
    at runtime, and the remaining control ids aligned with the names viv.c
    already uses. Previous names kept as aliases.
  • res/voidImageViewer.rc - controls renamed to match. Dialog text stays a
    design-time placeholder, because every visible string is assigned from the
    localization table at runtime; that keeps the script plain ASCII and
    independent of any code page.
  • src/localization_zh_cn.h - corrections on top of the initial contribution:
    blit mode wording (位图模式 -> 绘制模式, the old term reads as a file
    format), view presets (极简 / 紧凑 / 标准), 删除到回收站 /
    永久删除, and the association descriptions, which were still English
    (Bitmap Image, PNG Image, ...) and are what Explorer shows in the
    "Open with" list. Two labels were shortened because they were wider than
    their control.

Two build details are worth knowing if someone tries this locally:

  1. /utf-8 is required. Without it the UTF-8 table is read as ANSI and
    the UI shows mojibake.
  2. UNICODE / _UNICODE must be defined, matching the CharacterSet
    that Release|x64 already declares. Without them the wide buffers are
    filled by the ANSI variants of the Win32 APIs and the process starts
    without ever creating its main window.

Testing

MSVC 14.34.31933, SDK 10.0.19041.0, Release|x64. On a Simplified Chinese
system I checked the main window, all menus, the three options pages, About,
Rename, Jump To, custom rate and the keyboard shortcut dialogs. Each label was
measured against its control width to confirm nothing is clipped.

No functional change: no image loading, rendering, playlist or config code is
touched, and the version stays at 1.0.0.15.

Notes

All dialog text is populated at runtime, so the English build is untouched -
the language is still picked from the system UI language.

Happy to split this into "build fix" and "translation polish" as two commits,
or to drop the translation part entirely, if that is easier to review.

AI assistance

Worth stating plainly: the analysis, the patch and the build were produced with
the help of an AI coding agent (WorkBuddy), working from this source tree. I am
the one submitting it and I will answer for it - if something here is wrong,
that is on me, not on the tool.

I have also run the resulting build and gone through the menus and dialogs
myself, so the testing notes below reflect what I saw, not just what the agent
reported.

The patch is deliberately small and contains no logic changes - three files:
resource ids, the resource script, and strings. It should be reviewable on its
own merits rather than on trust in whatever produced it. If any part looks off,
I am happy to explain it or rework it by hand.
screenshot-1-main-window
screenshot-2-options-dialog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant