Translating custom page template names

Have you ever wondered how to translate custom page template names? I know I have. I want to translate everything what it comes to WordPress.

You now that custom page template starts with header like this.

`
/*
Template Name: My Custom Page
*/
`

But how to translate it? Thanks to this advice it’s pretty easy. First, make that page template look like this.

`
/*
Template Name: My Custom Page
*/
__( ‘My Custom Page’, ‘my-text-domain’ );
`
After that open your theme’s `style.css` and add this line in header.

`
Text Domain: my-text-domain
`

`my-text-domain` should be replaced by your actual text domain for your theme. So `style.css` header could look like this.

`
/*
* Theme Name: Twenty some
* Theme URI: http://wordpress.org/
* Description: The 2010 default theme for WordPress.
* Author: wordpressdotorg
* Author URI: http://wordpress.org/
* Version: 1.0
* Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, * translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
* Text Domain: my-text-domain
* License: GNU General Public License v2.0
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
`

After that translate your theme files with your favourite software, I use Poedit for that.

Edit: If you generate .pot file with i18n tools you might not need this info at all.