#16459 closed defect (bug) (fixed)
get_post_format_link() and problem with translated post format slug
Reported by: | pavelevap | Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | I18N | Keywords: | |
Focuses: | Cc: |
Description
Hi, using latest WP trunk, Twenty Ten.
Post format slug "gallery" was translated to "galerie", but in Twenty Ten there is a following call (loop.php):
echo get_post_format_link( 'gallery' );
So, there are visible links to ?post_format=gallery (Nothing found) instead of translated ?post_format=galerie
Attachments (3)
Change History (21)
#2
@
14 years ago
Sorry, they should never be translated in the DB but I think we do perform translation for the sake of permalinks.
#3
@
14 years ago
Yes, it makes sense to me to translate them to have permalinks with translated words galerie instead of gallery. But they are translated on the fly and not in database, I guess.
But the problem is in Twenty Ten or get_post_format_link() function which calls not translated post format slugs. Maybe it should be direct part of this function to call translated slug to be compatible with other themes (and not change it only in Twenty Ten).
#4
@
14 years ago
Without pretty permalinks turned on, ?post_format=gallery is correct. The actual post format saved in the DB is never translated and post_format= is an explicit requests for what is in the DB. With pretty permalinks turned on, I believe you will see /type/galerie/ permalinks that will map to a post_format=gallery query.
#5
@
14 years ago
But I have one post with "Galerie" format and for ?post_format=gallery there is "Nothing found" and for ?post_format=galerie is this post correctly listed. And problem is that get_post_format_link() generates wrong link to not translated ?post_format=gallery
#9
@
14 years ago
Can't reproduce get_post_format_link() getting 'galerie' versus 'gallery' with permalinks disabled. I'm probably doing something wrong.
Noticed some other issues with canonical which a patch will address soon. Will look again later tonight.
#10
@
14 years ago
I can reproduce, using the latest French .mo
file.
The link generated by Twenty Ten is:
http://wp.dev/?post_format=gallery
It 404s. But this works:
http://wp.dev/?post_format=galerie
The first problem is that WordPress is generating that link. The second is that it doesn't redirect to the correct link. I suppose it can't be avoided that if the translation changes, the links will break.
#11
@
14 years ago
There's a fix for the faulty link generation. It just wasn't being passed through the slug translator like the pretty permalink was.
#12
@
14 years ago
post_format should always use the real slugs. Why do an on the fly translation for the slug and still have the english "post_format" in the URL? Formats are internal keys (like type, status, and ID) that should not be translated.
#13
@
14 years ago
There's a patch that removes translation altogether, for both default and pretty permalinks.
#15
in reply to:
↑ 14
@
14 years ago
Replying to pavelevap:
So why are post format slugs enabled for translation?
That was intended for the /type/format/ pretty permalinks, but I think we might remove translation there too since using translations for permalinks is fragile.
Post format slugs should never be translated.