WordPress.org

GlotPress

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#172 closed defect (fixed)

Do not export untranslated strings for mo files

Reported by: nacin Owned by: somebody
Milestone: Priority: critical
Version: Component: general
Keywords: has-patch Cc:

Description

[574] ensured that only current strings are included in exports.

[639] also allowed untranslated strings to be included. However, this applies to mo and po files equally, when in reality a mo file should not receive untranslated strings. If you're exporting and deploying mo files from GlotPress, this can have some pretty bad consequences, namely blank translations in place of their English fallbacks.

Attached patch continues the abstraction approach in [574], providing context to for_export() so it may determine the default status.

Attachments (1)

172.diff (1.6 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (6)

nacin2 years ago

comment:1 nacin2 years ago

Additionally, the test [639] did not call for_export() correctly:

$for_export = GP::$translation->for_export( $set->project, $set, 0, array('status' => 'current'), array('by' => 'translation', 'how' => 'asc') );

This should become for_export( $set->project, $set ). The test won't fail as 0 ends up being false so the default current_or_untranslated is used.

The test could be easily enhanced to test for a mo export versus a po export, at this point.

comment:2 petervanderdoes2 years ago

  • Keywords has-patch added

comment:3 nbachiyski2 years ago

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

(In [655]) Don't include strings with empty translations in MO export

Fixes #172

comment:4 nbachiyski2 years ago

Nacin, I decided to go a little bit further down the road and make sure exporting MO files will never include empty translations, not only done via the web interface.

Also added a test.

Many thanks for finding the core of the problem.

Could you file a new ticket for the erroneous test in [639]. Otherwise, we will probably forget it.

comment:5 nacin2 years ago

Nacin, I decided to go a little bit further down the road and make sure exporting MO files will never include empty translations, not only done via the web interface.

Works for me. I had thought about it after doing 172.diff but figured you would make a decision and go that route.

Note: See TracTickets for help on using tickets.