#43864 closed defect (bug) (worksforme)
A comment inside an i18n function will cause makepot/extract.php to miss the string
Reported by: | julesaus | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.1 |
Component: | I18N | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
If you put a comment inside a translation function, makepot misses the entire string. For example, none of these strings will appear in a generated pot file:
<?php __( /* */ 'missing' ); __( // 'multiline missing' ); __( // translators: This seems like a reasonable place to put a comment 'A reasonable looking example' );
You might pop the attached test-file.php
into test-dir/
and run php ../makepot.php generic $PWD /dev/stdout; echo;
if you'd like to see it yourself.
This is valid PHP and gettext
handles this syntax fine, so it can be quite tricky to recognize the problem when it occurs.
Attachments (2)
Change History (6)
#1
@
7 years ago
- Version set to trunk
Props @akirk for test_find_function_calls_with_inline_c_style_comment()
#2
@
6 years ago
This would certainly be a lower priority if we're using the wp i18n
command (see https://meta.trac.wordpress.org/ticket/3748), but it still seems worth fixing this behaviour to me as long as makepot/extract.php
is in the codebase.
Even with a better alternative, It seems like that many users will continue to use the old tool for some time before they update their existing processes.
#3
@
6 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
Closing as we now use https://github.com/wp-cli/i18n-command on WordPress.org for core, plugins, and themes, and recommend using that instead of makepot.php.
That WP-CLI command should work very well with these cases.
Patch