Opened 2 years ago

Closed 23 months ago

#14765 closed enhancement (fixed)

wxrc supports additional tags for string extraction

Reported by: sodev Owned by:
Priority: low Milestone:
Component: XRC Version: stable-latest
Keywords: wxrc gettext i18n Cc:
Blocked By: Blocking:
Patch: yes

Description

After checking the xml handler sources i discovered that these contain more tags that contain text that needs to be translated than wxrc currently supports when using the --gettext parameter. I have added all missing tags to that hardcoded if-then-else block and also added the tag 'caption' that might be quite useful if you happen to have a xml handler that reads wxAuiPaneInfo objects ;).

Attachments (1)

wxrc.patch download (1.0 KB) - added by sodev 2 years ago.

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by sodev

comment:1 Changed 2 years ago by vadz

  • Priority changed from normal to low
  • Status changed from new to confirmed

Are you sure that "defaultdirectory" needs to be translated? AFAIK this is something like "C:\" so IMHO it shouldn't be.

comment:2 follow-up: Changed 2 years ago by sodev

Yes, there are two reasons why it needs to be translated. The handler that uses this property, wxFileCtrlXmlHandler, uses GetText() to read this property and GetText() translates, so it needs to be extracted :). The second reason is that the default directory can be more than just "C:\", e.g. something like "C:\Documents and Settings". In recent windows versions these directories are all named in english and only the explorer translates them but that might not be true for other platforms and it might be desired by the user to use a localized default directory, like its possible to use a localized filename as well.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 2 years ago by vadz

Replying to sodev:

Yes, there are two reasons why it needs to be translated. The handler that uses this property, wxFileCtrlXmlHandler, uses GetText() to read this property and GetText() translates, so it needs to be extracted :).

Sorry but doesn't it rather mean that the handler shouldn't be using GetText()?

The second reason is that the default directory can be more than just "C:\", e.g. something like "C:\Documents and Settings". In recent windows versions these directories are all named in english and only the explorer translates them but that might not be true for other platforms and it might be desired by the user to use a localized default directory, like its possible to use a localized filename as well.

It's a very bad idea to translate these strings, wxStandardPaths should be used to retrieve them dynamically.

So I don't think there is any reason to add them.

comment:4 in reply to: ↑ 3 Changed 2 years ago by sodev

Replying to vadz:
Ok, bad example, new example: C:\Projects\New Project.prj. Why shouldn't it be possible to localize this? After all these parameters are only strings and the handlers are dumb, they just pass them to the control as is, you can't even use wxStandardPaths there.

comment:5 Changed 23 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [72725]) Recognize more XRC elements as containing translatable strings.

This allows to translate the text of these elements in wxrc-generated code
using gettext.

Closes #14765.

Note: See TracTickets for help on using tickets.