Ticket #6742 (reopened enhancement)

Opened 3 months ago

Last modified 1 week ago

Add hook for translating English

Reported by: Viper007Bond Assigned to: anonymous
Priority: lowest Milestone: 2.7
Component: i18n Version: 2.5
Severity: trivial Keywords: has-patch
Cc:

Description

I want to be able to make __('foo') return bar, even if the blog is in English. If WordPress is in any other language besides English, I think you can just use the "gettext" filter to do this. However, my blog is in English, so you can't.

Attached patch adds a backwards compatible pre-translating hook for allowing plugins to switch phrases before they are translated.

It also passes the domain to "gettext" filter for the hell of it.

Attachments

6742.patch (0.5 kB) - added by Viper007Bond on 04/16/08 08:03:53.

Change History

04/16/08 08:03:53 changed by Viper007Bond

  • attachment 6742.patch added.

06/20/08 14:58:59 changed by westi

Can you not create a translation file even for an English blog.

i.e set WP_LANG to en_Viper and have a en_Viper.mo file.

06/26/08 09:39:57 changed by pishmishy

  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

Agreeing with Westi here. Nothing forces you not to use English in translation files. Since there's no response I'll presume that you've tried this method and been successful. Please let us know if there's problems with this approach though.

06/26/08 11:23:14 changed by Viper007Bond

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone set to 2.7.

Sorry, seemed to be missed westi's response.

I'm talking about a plugin here, not my own personal blog.

However, I honestly can't remember what I was trying to do at the time. I think I was trying to use the default widgets page for managing the dashboard and didn't want to use an output buffer.

So yeah, reopening for feedback, but not hard set on wanting it as I can just use an output buffer to modify strings. Still though, having a pre-filter much like you can do with get_option() would be handy and I don't see any harm except maybe extra CPU cycles.

06/26/08 11:35:29 changed by pishmishy

I don't see the harm either, but not convinced I see the need =)