Load translation from Windows resources whose id contains `@` (Issue #22589)

42 views
Skip to first unread message

Mike Wang

unread,
Jul 1, 2022, 11:35:57 AM7/1/22
to wx-...@googlegroups.com, Subscribed

Describe the problem

My program loads translations from Windows resources using wxResourceTranslationsLoader, however some language identifications contains charactor @, which is not a valid token in .rc files.
For example:

foo_sr@latin    MOFILE  "sr@latin/foo.mo"

windres will not compile it.

Are there any solutions?

Platform and version information

  • wxWidgets version you use: 3.1.7
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 10.0.22000.376
  • Compiler being used: MSYS2/clang


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22589@github.com>

VZ

unread,
Jul 2, 2022, 7:56:21 PM7/2/22
to wx-...@googlegroups.com, Subscribed

We'd need to implement some kind of escaping schema for @ here, e.g. replace __at__ with it or something like this. Alternatively, we could just replace any non-alphanumeric characters with _, as it's probably not going to create any ambiguity here.

In any case, it shouldn't be difficult to add this to wxResourceTranslationsLoader::LoadCatalog(). If you decide to do it, please document the chosen schema in the class docs in interface/wx/translation.h and make a PR with your changes. TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22589/1172980345@github.com>

Mike Wang

unread,
Jul 4, 2022, 12:12:50 PM7/4/22
to wx-...@googlegroups.com, Subscribed

After some investigations, I found that it should be valid to write like

"foo_sr@latin"    MOFILE  "sr@latin/foo.mo"

in .rc file as it's valid in Microsoft rc.exe.

It's llvm-rc not supporting the syntax(llvm/llvm-project#56338), and GNU windres has some parser bugs that will cause rc compilation 99% likely to fail.

So that's not wxWidgets' flaw. Even though, I made a PR to avoid these headaches.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22589/1173975641@github.com>

VZ

unread,
Jul 12, 2022, 9:49:59 AM7/12/22
to wx-...@googlegroups.com, Subscribed

Closed #22589 as completed via d8eddbd.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/22589/issue_event/6977790982@github.com>

Reply all
Reply to author
Forward
0 new messages