Ticket #14765 (closed enhancement: fixed)

Opened 7 months ago

Last modified 7 months ago

wxrc supports additional tags for string extraction

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

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

wxrc.patch download (1.0 KB) - added by sodev 7 months ago.

Change History

Changed 7 months ago by sodev

  Changed 7 months 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.

follow-up: ↓ 3   Changed 7 months 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.

in reply to: ↑ 2 ; follow-up: ↓ 4   Changed 7 months 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.

in reply to: ↑ 3   Changed 7 months 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.

  Changed 7 months ago by VZ

  • status changed from confirmed to closed
  • resolution set to fixed

(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.