Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Internationalize meta-data #203

Closed
wants to merge 3 commits into from

5 participants

@grappler

This edit allows the meta-data in the theme to be translated.

@obenland
Owner

Hm, this is a bit more tricky. When grabbing _s from underscores.me, the textdomain in your pull request would be replaced with the theme name, rather than the theme slug. I'm not sure there is a good way to go about that other than a specific search/replace for just that occurrence.

@grappler

Is the code from underscores.me shared anywhere so that it can be improved on?

@grappler

First I am no expert on this but couldn't this work? Check the third last line. Also please let me know if there is a better place to discuss the underscores.me code.

        // Special treatment for style.css
        if ( 'style.css' == $filename ) {
            $theme_headers = array(
                'Theme Name'  => $this->theme['name'],
                'Theme URI'   => esc_url_raw( $this->theme['uri'] ),
                'Author'      => $this->theme['author'],
                'Author URI'  => esc_url_raw( $this->theme['author_uri'] ),
                'Description' => $this->theme['description'],
                'Version'     => $this->theme['version'],
                'License'     => $this->theme['license'],
                'License URI' => $this->theme['license_uri'],
                'Text Domain' => $this->theme['theme-name'],
                'Tags'        => $this->theme['tags'],
            );
@kovshenin
Owner

@obenland is right. We can make an exception for this on Underscores.me, but users who search and replace manually can be confused.

@grappler

@kovshenin The way I understood @obenland was the opposite to what you understood.

@kovshenin
Owner

@grappler he's right that it's more tricky, and he's right that with a regular search and replace, the text domain will be replaced with the theme name and not its slug:

Search for _s (with a space before it) to capture DocBlocks.

Will capture the text domain in style.css. However, underscores.me is smarter than a simple search and replace. On underscores.me we can do whatever regex magic we want.

@grappler

@kovshenin I see what your saying. With the changes to the instructions it should work.

@obenland
Owner

[...] users who search and replace manually can be confused

Independent from the topic at hand, somewhere in the repository description we should really emphasize that theme authors should go through underscores.me rather than grabbing the zip from here. This will become even more important in the future.

@ianstewart ianstewart referenced this pull request in Automattic/underscores.me
Closed

Internationalized Stylesheet Headers #9

@ianstewart
Owner

I made this an issue for _s.me as well.

Updated instructions and text domain in the stylesheet header seem OK to me.

@obenland obenland closed this in 1f15c20
@grappler grappler deleted the grappler:patch-1 branch
@obenland obenland removed the Suggest Merge label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 22, 2013
  1. @grappler

    Internationalize meta-data

    grappler authored
Commits on Apr 27, 2013
  1. @grappler

    Instructions for Text Domain

    grappler authored
  2. @grappler
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +6 −4 README.md
  2. +1 −0  style.css
View
10 README.md
@@ -21,16 +21,18 @@ Getting Started
If you want to keep it simple, head over to http://underscores.me and generate your `_s` based theme from there. You just input the name of the theme you want to create, click the "Generate" button, and you get your ready-to-awesomize starter theme.
-If you want to set things up manually, download `_s` from github. The first thing you want to do is copy the `_s` directory and change the name to something else — Like, say, `megatherium` — then you'll need to do a three-step find and replace on the name in all the templates.
+If you want to set things up manually, download `_s` from github. The first thing you want to do is copy the `_s` directory and change the name to something else — Like, say, `megatherium` — then you'll need to do a five-step find and replace on the name in all the templates.
1. Search for `'_s'` (inside single quotations) to capture the text domain.
-2. Search for `_s_` to capture all the function names.
-3. Search for ` _s` (with a space before it) to capture DocBlocks.
-4. Search for `_s-` to capture prefixed handles.
+2. Replace Text Domain `_s` in style.css.
+3. Search for `_s_` to capture all the function names.
+4. Search for ` _s` (with a space before it) to capture DocBlocks.
+5. Search for `_s-` to capture prefixed handles.
OR
* Search for: `'_s'` and replace with: `'megatherium'`
+* Replace Text Domain `_s` in style.css with `megatherium`
* Search for: `_s_` and replace with: `megatherium_`
* Search for: <code>&nbsp;_s</code> and replace with: <code>&nbsp;Megatherium</code>
* Search for: `_s-` and replace with: `megatherium-`
View
1  style.css
@@ -7,6 +7,7 @@ Description: Hi. I'm a starter theme called <code>_s</code>, or <em>underscores<
Version: 1.3-wpcom
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Text Domain: _s
Tags:
This theme, like WordPress, is licensed under the GPL.
Something went wrong with that request. Please try again.