Make WordPress Core

Opened 18 years ago

Closed 13 years ago

#1762 closed enhancement (worksforme)

permalinks structure not i18n friendly

Reported by: anatman's profile anatman Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1.2
Component: Permalinks Keywords: needs-patch
Focuses: Cc:

Description

The permalinks structure needs to get fields in the admin interface for $author_base, $search_base, $comments_base and $feed_base (all in classes.php), and for choosing the word used in paginating the site ("page" is hardcoded in $pageregex (classes.php) and in $page_modstring and $page_modregex (both in template-functions-links.php)), or these need to be internationalized.
The way it is harcoded now we have the english words "author", "comments", "feed" and "page" appearing in the permalinks.

Attachments (4)

customise_other_bases.diff (5.9 KB) - added by davidhouse 18 years ago.
gettext_perma.diff (1.0 KB) - added by ryan 18 years ago.
Apply gettext to permalink structure elements
1762.diff (2.5 KB) - added by mdawaffe 18 years ago.
reapply ryan's patch to current code. page_number_base (update: fix typo)
1762.redo.diff (16.6 KB) - added by rob1n 17 years ago.

Download all attachments as: .zip

Change History (40)

#1 @markjaquith
18 years ago

should this be customizable via an options interface or via plugins or via i18n? I can think of even English-speakers who would want to change this, like /author/ => /artist/ or /contributer/ or something else, so maybe these should be options on the permalink options page.

#2 @anatman
18 years ago

I agree completely with markjaquith, and his way would probably make it easier to code, wright?

#3 @davidhouse
18 years ago

  • Keywords bg|has-patch bg|squashed added
  • Owner changed from anonymous to davidhouse
  • Status changed from new to assigned

Attached patch allows for customisation of author, feed and comment feed bases. Although all these may not be necessary (and are thus superfluous options and thus harmful), I've left them in because

  1. They can always be removed by the committor (easier to remove than to add them back in if someone decided we need them).
  2. They might be useful for i18n (although we should allow .po/.mo files to customise these bases).

#4 @ryan
18 years ago

  • Milestone set to 1.6

I don't think these need to be provisionable. Simply marking them for translation should suffice. In WP_Rewrite init():

$this->author_base = trim(__('/author/'), '/');

Slashes are included in the translatable string for context and then stripped back out.

This way the strings show up in the po files for translation, and we don't have to clutter the permalink page with settings.

#5 @anatman
18 years ago

Please don't forget the word "page", which is hardcoded in $pageregex (classes.php) and in $page_modstring and $page_modregex (both in template-functions-links.php).
This word is quite important for translation because it is not an internet term like "feed", and it's meaning is the same as in other contexts.

@ryan
18 years ago

Apply gettext to permalink structure elements

#6 @ryan
18 years ago

Patch attached that applies gettext to permalink bases.

I'm wary of this approach since permalinks will change if the translation is changed, making them not so perma. Persisting them in the DB means adding provisioning UI for all of these fields, which is ugly and annoying. Both approaches have drawbacks. Still debating the best way to go.

#7 @anatman
18 years ago

Sorry to insist on this, but the hardcoding of the word "page" as noted above is bearing children: please take a look at the last version (0.41) of the Permalinks Redirect Plugin: http://fucoder.com/code/permalink-redirect/ (line 83). If in the future the word gets marked lots of people will have their permalinks breaking.
I just warned the plugin author.

#8 @matt
18 years ago

  • Milestone changed from 1.6 to 2.1

#9 @pkirk
18 years ago

I would like also to point out that the browser must support "strange" chars if they are in the translation on the permalinks. I don't think that a chinese char is supported in the address bar of the lastests browsers. Am I wrong?

#10 @_ck_
18 years ago

My apologies for being a newbie at how to do this but I would like to vote for these two patches and suggest they fold into the next 2.1 alpha (3?)

The diff is for an old build so I am unable to apply to any 2.x version except for manual editing.

They test and work well, at least on my (US) english site.

I would also suggest a better ticket title, the ability to change permalink structure for "author" etc. is not just a language issue and would be handy to many.

#11 @_ck_
18 years ago

Also note that the search_base can be potentially changed in 2.x

#12 @mdawaffe
18 years ago

1762.diff

  1. Ryan's patch reapplied to current trunk.
  2. Use page_number_base to keep track of /page/

Note: change things and you'll have to update your permalink structure.

@mdawaffe
18 years ago

reapply ryan's patch to current code. page_number_base (update: fix typo)

#13 @matt
17 years ago

  • Milestone changed from 2.1 to 2.2

#14 @rob1n
17 years ago

  • Keywords dev-feedback added; i18n bg|has-patch bg|squashed removed
  • Owner changed from davidhouse to rob1n
  • Status changed from assigned to new

I am +1 for making these options in Options > Permalinks. There are many times I wanted to change things like the feed base, the author base, or etc.

#15 @rob1n
17 years ago

  • Status changed from new to assigned

#16 @rob1n
17 years ago

  • Status changed from assigned to new

#17 @rob1n
17 years ago

  • Version changed from 1.5.2 to 2.1.2

#18 @rob1n
17 years ago

  • Status changed from new to assigned

#19 @rob1n
17 years ago

  • Type changed from defect to enhancement

#20 @rob1n
17 years ago

  • Milestone changed from 2.2 to 2.3

#21 @rob1n
17 years ago

  • Keywords has-patch needs-testing added; dev-feedback removed
  • Milestone changed from 2.3 to 2.2

#22 @matt
17 years ago

  • Milestone changed from 2.2 to 2.3

I think this is too broad for 2.2.

#23 @rob1n
17 years ago

  • Status changed from assigned to new

#24 @rob1n
17 years ago

  • Status changed from new to assigned

#25 @rob1n
17 years ago

  • Keywords needs-testing removed

Okay, that's what I have so far. Feeds+comment feeds aren't working. If you try to click on a link in Kubrick, at the bottom, you'll see what I mean.

I'll keep debugging this in the morning.

@rob1n
17 years ago

#26 @rob1n
17 years ago

  • Status changed from assigned to new

#27 @westi
17 years ago

  • Milestone changed from 2.3 to 2.4 (next)

This sounds like a very good idea.

Although I am not sure about overloading the Permalinks options page with extra options - maybe we should use filters instead and require a plugin to do the name changes?

Moving to 2.4 as it's too late to make a bit change like this to 2.3

#28 @rob1n
16 years ago

  • Owner rob1n deleted

#29 @Nazgul
16 years ago

  • Keywords needs-testing added

Is the attached patch still valid?

#30 @ffemtcj
16 years ago

  • Milestone changed from 2.5 to 2.6

#31 @anatman
15 years ago

  • Type changed from enhancement to defect

Bump. This has been here for 3 years now, and the problem is spreading: in 2.7RC1 we have the words "comment-page" hardcoded on line 1262, and "attachment" on line 1421 (in rewrite.php).

On the other hand tag_base is an option in the admin area (pemalinks) - which is not only nice, but makes sense.

All "bases" should be configurable via the admin interface.

#32 @DD32
15 years ago

  • Component changed from Administration to Permalinks
  • Keywords needs-patch early added; has-patch needs-testing removed
  • Milestone changed from 2.9 to 2.8
  • Type changed from defect to enhancement

I agree that the permalinks should be translatable, and I'm closing #8312 as a duplicate of this.

Attached patch is stale, and probably needs to be reworked either way.

(Its an enhancement, not a defect)

#33 @ryan
15 years ago

  • Milestone changed from 2.8 to 2.9

#34 @ryan
15 years ago

  • Keywords early removed

#35 @ryan
15 years ago

  • Milestone changed from 2.9 to Future Release

Assigning to future release until a patch or direction manifests.

#36 @nacin
13 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Pardon the necromancy of my reply but I'm pretty sure every rewrite base is now a WP_Rewrite property that can be modified by a plugin.

Note: See TracTickets for help on using tickets.