Ticket #6007 (accepted enhancement)

Opened 4 years ago

Last modified 33 hours ago

Template Name et al not localizable

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

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

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

Change History

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

Translates file descriptions before showing in theme editor

  • 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   ryan4 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   ryan4 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   ryan4 years ago

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

return translate($name[1]);

comment:6   ryan4 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.

  • Keywords needs-patch added; has-patch removed
  • Type changed from defect (bug) to enhancement
  • Milestone changed from 2.9 to Future Release
  • Summary changed from Gettexted file do no translate to Template Name et al not localizable
  • Keywords close added; needs-patch removed

Is this still an issue?

  • 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.
  • Cc georgemamadashvili@… added

In [19968]:

Add template names to theme pots. see #6007.

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

nacin33 hours ago

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

Note: See TracTickets for help on using tickets.