[wp-trac] [WordPress Trac] #39587: link problems with language settings

WordPress Trac noreply at wordpress.org
Fri Jan 25 19:23:30 UTC 2019


#39587: link problems with language settings
--------------------------+------------------------------
 Reporter:  aansel        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  I18N          |     Version:  4.7
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by eddhurst):

 @tferry noticed this issue earlier this week, and we've been
 investigating. I agree, this still happens and is relatively easy to
 reproduce:

 0. Make sure to have at least another language installed to help demo
 this...

 1. Set site language to German
 2. Create new custom post type, set slug to use a translatable string
 ("media" is good example that WP has a translatable string for in core)
 3. Regenerate permalinks

 ''Note: Permalinks should now go to: wp.local/Medien/postname''

 4. Change user preferred language to english
 5. Go to CPT page and hover on "view"

 ''Note: Permalink should suggest that the permalink is
 wp.local/media/postname''

 6. Regenerate permalinks again

 ''Note: Permalinks will now actually change to wp.local/media/postname''


 As mentioned earlier - we can see that the slug ends up changing based on
 the admin preferred language rather than the site language - which isn't
 immediately obvious why.

 Ultimately the localisation scripts are running first and doing all the
 translation - including the slug. This seems reasonable, as we do need the
 other strings (CPT labels etc) to be translated.

 To fix this at the highest level it seems like it would make sense to
 hijack the arguments in the class definition of WP_Post_Type and re-
 translate based on site language, that way we can reliably ensure that it
 will always be correct anywhere else that it is used.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39587#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list