Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#29630 closed enhancement (invalid)

Translatable slug in register_post_type and register_taxonomy

Reported by: gugaalves Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 4.0
Severity: normal Keywords:
Cc: Focuses:

Description (last modified by ocean90)

When registering a Custom Post Type or a Custom Taxonomy, we're able to pass translations to labels, but can't do it in slugs.

Why we can't do this:

'rewrite' => array( 
     'slug' => _x('Books', 'post type general name', 'your-plugin-textdomain' )
),

In sites like WordCamp sites, for example, its weird to a Brazilian Sponsor see /sponsor instead of /patrocinador in post slug.

Change History (4)

#1 follow-up: @ocean90
12 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added

Hello gugaalves,

this is already possible, what doesn't work for you in detail?

Last edited 12 years ago by ocean90 (previous) (diff)

#2 @nacin
12 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

This works. You just have to make sure you're calling register_post_type() after translations are loaded. Since in this case you need to call it after WP_Rewrite is initialized, then you should be good.

For WordCamp sites, you can submit a ticket to ​https://meta.trac.wordpress.org/ if you'd like it supported there.

#3 in reply to: ↑ 1 @gugaalves
12 years ago

Replying to ocean90:

Hello gugaalves,

this is already possible, what does't work for you in detail?

I'll test again then, some may have been my mistake or my local environment.

That should already be in use on WordCamps themes then, I thought this test after seeing that it didn't happen in the WordCamp Rio de Janeiro site, i'll register this in the other trac, thanks :)

Last edited 12 years ago by gugaalves (previous) (diff)

#4 @SergeyBiryukov
12 years ago

  • Keywords reporter-feedback removed
  • Summary Translatable slug in registe_post_type and register_taxonomy → Translatable slug in register_post_type and register_taxonomy
Note: See TracTickets for help on using tickets.