WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 2 years ago

#6007 closed enhancement (fixed)

Template Name et al not localizable

Reported by: SteveAgl Owned by: hansengel
Milestone: 3.4 Priority: normal
Severity: minor Version: 2.5
Component: I18N Keywords:
Focuses: Cc:

Description

In theme editor the tempalte description for archives.php and links.php are correctly gettext but even if tanslated in po file they don't translate.

Attachments (2)

6007.r7098.diff (1.7 KB) - added by hansengel 6 years ago.
Translates file descriptions before showing in theme editor
6007.diff (12.2 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 nbachiyski6 years ago

  • Component changed from Administration to i18n
  • Severity changed from major to minor

hansengel6 years ago

Translates file descriptions before showing in theme editor

comment:2 hansengel6 years ago

  • Keywords has-patch added
  • Owner changed from anonymous to hansengel
  • Status changed from new to assigned

Actually, SteveAgl, the theme file descriptions aren't translated at all. I attached a patch to add translation functionality.

comment:3 ryan6 years ago

You can only pass literal strings to ().

These strings should be translated when $wp_file_descriptions is defined. By the time file.php is loaded, the gettext system should be fully initialized. I'd like to understand why that is apparently not working.

If we can't figure that out, we can change your patch to use translate() instead of ().

comment:4 ryan6 years ago

Oh, we're talking about templates with "Template Name:" in them. The template would have to make a dummy call to () somewhere to get the string in the template. If that is done, then changing your patch to use translate() will work.

comment:5 ryan6 years ago

Actually, it might be better to have get_file_description() do this:

return translate($name[1]);

comment:6 ryan6 years ago

  • Milestone changed from 2.5 to 2.6

Actually, we'd have to call translate with the proper domain for the theme. We're getting into the same issue as with plugins. We've pushed that fix to 2.6, so I'll push this one as well.

comment:7 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.9 to Future Release
  • Type changed from defect (bug) to enhancement

comment:8 Denis-de-Bernardy5 years ago

  • Summary changed from Gettexted file do no translate to Template Name et al not localizable

comment:9 solarissmoke3 years ago

  • Keywords close added; needs-patch removed

Is this still an issue?

comment:11 nacin2 years ago

  • Keywords close removed
  • Milestone changed from Future Release to 3.4

Let's do this and #15858.

Steps to complete this ticket:

  1. Run translate() over these.
  1. Leverage a Text Domain header (where #15858 comes in).
  1. Extract Template Name from individual template files and add them to the pot, which would require some improvements to http://i18n.svn.wordpress.org/tools/trunk/pot-ext-meta.php.

comment:12 Mamaduka2 years ago

  • Cc georgemamadashvili@… added

comment:13 nacin2 years ago

In [19968]:

Add template names to theme pots. see #6007.

comment:15 nacin2 years ago

15858.diff:ticket:15858 more or less fixes this.

nacin2 years ago

comment:16 nacin2 years ago

Since #15858 is a mess, 6007.diff targets just this ticket. A lot of the rewrite of get_theme_data() is from #15858.

comment:17 nacin2 years ago

In [20029]:

Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.

  • Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
  • Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
  • Error Handling: Broken themes have a WP_Error object attached to them.
  • Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
  • Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
  • i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
  • PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.

Functions deprecated:

  • get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
  • get_theme() and current_theme_info() -- use wp_get_theme()
  • get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
  • wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()

see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.

see #20103.

comment:15 nacin2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In [20041]:

Translate page template names! Have WP_Theme::get_page_templates() return templates keyed by filename, not by template name, as it makes more sense. Flip this in get_page_templates() to be compatible. fixes #6007.

Note: See TracTickets for help on using tickets.