Ticket #1762 (new enhancement)

Opened 3 years ago

Last modified 8 months ago

permalinks structure not i18n friendly

Reported by: anatman Assigned to:
Priority: normal Milestone: 2.9
Component: Administration Version: 2.1.2
Severity: normal Keywords: has-patch needs-testing
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

customise_other_bases.diff (5.9 kB) - added by davidhouse on 11/06/05 20:56:03.
gettext_perma.diff (1.0 kB) - added by ryan on 11/11/05 00:26:11.
Apply gettext to permalink structure elements
1762.diff (2.5 kB) - added by mdawaffe on 08/30/06 23:29:41.
reapply ryan's patch to current code. page_number_base (update: fix typo)
1762.redo.diff (16.6 kB) - added by rob1n on 05/04/07 02:39:43.

Change History

10/15/05 08:52:45 changed by markjaquith

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.

10/19/05 20:45:28 changed by anatman

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

11/06/05 20:55:40 changed by davidhouse

  • keywords changed from i18n to i18n bg|has-patch bg|squashed.
  • 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).

11/06/05 20:56:03 changed by davidhouse

  • attachment customise_other_bases.diff added.

11/07/05 08:37:21 changed by ryan

  • 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.

11/08/05 22:26:57 changed by anatman

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.

11/11/05 00:26:11 changed by ryan

  • attachment gettext_perma.diff added.

Apply gettext to permalink structure elements

11/11/05 00:29:30 changed by ryan

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.

11/11/05 11:52:35 changed by anatman

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.

11/14/05 10:01:24 changed by matt

  • milestone changed from 1.6 to 2.1.

02/17/06 21:08:07 changed by pkirk

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?

07/31/06 08:32:28 changed by _ck_

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.

07/31/06 08:40:40 changed by _ck_

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

08/30/06 23:20:09 changed by mdawaffe

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.

08/30/06 23:29:41 changed by mdawaffe

  • attachment 1762.diff added.

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

11/29/06 22:52:13 changed by matt

  • milestone changed from 2.1 to 2.2.

02/24/07 17:12:06 changed by rob1n

  • keywords changed from i18n bg|has-patch bg|squashed to dev-feedback.
  • 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.

02/24/07 17:12:10 changed by rob1n

  • status changed from new to assigned.

02/26/07 02:24:57 changed by rob1n

  • status changed from assigned to new.

03/07/07 18:53:40 changed by rob1n

  • version changed from 1.5.2 to 2.1.2.

03/07/07 18:53:45 changed by rob1n

  • status changed from new to assigned.

03/07/07 18:53:50 changed by rob1n

  • type changed from defect to enhancement.

03/09/07 01:42:40 changed by rob1n

  • milestone changed from 2.2 to 2.3.

04/10/07 08:59:55 changed by rob1n

  • keywords changed from dev-feedback to has-patch needs-testing.
  • milestone changed from 2.3 to 2.2.

04/10/07 09:35:33 changed by matt

  • milestone changed from 2.2 to 2.3.

I think this is too broad for 2.2.

04/25/07 02:32:47 changed by rob1n

  • status changed from assigned to new.

05/03/07 03:29:27 changed by rob1n

  • status changed from new to assigned.

05/03/07 04:19:27 changed by rob1n

  • keywords changed from has-patch needs-testing to has-patch.

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.

05/04/07 02:39:43 changed by rob1n

  • attachment 1762.redo.diff added.

05/28/07 18:51:50 changed by rob1n

  • status changed from assigned to new.

09/11/07 19:17:42 changed by westi

  • 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

12/19/07 07:26:42 changed by rob1n

  • owner deleted.

01/24/08 17:28:01 changed by Nazgul

  • keywords changed from has-patch to has-patch needs-testing.

Is the attached patch still valid?

03/19/08 03:34:30 changed by ffemtcj

  • milestone changed from 2.5 to 2.6.