Download & Extend

Empty source strings should not be stored

Project:Localization server
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:claudiu.cristea
Status:closed (fixed)

Issue Summary

Looks like some clever module and theme authors add the empty string as translatable in their code. Localization server picks this up dutifully, but rather it should report it as a warning in the source code parse warnings. Maybe need to resolve on the potx layer.

AttachmentSizeStatusTest resultOperations
Empty t.png94.7 KBIgnored: Check issue status.NoneNone

Comments

#1

Title:Empty strings should not be stored» Empty source strings should not be stored

#2

In UK L.D.O we have a lot of such strings too and they are marked as translated

subscribe

AttachmentSizeStatusTest resultOperations
empty.jpg156.9 KBIgnored: Check issue status.NoneNone

#3

Assigned to:Anonymous» claudiu.cristea
Status:active» needs review

Coming with a first patch...

Check the TODO that I added there...

AttachmentSizeStatusTest resultOperations
l10n_server_empty_source_strings-D6.patch968 bytesIgnored: Check issue status.NoneNone

#4

Status:needs review» needs work

@podarok: I think you might experience a different bug. Our bug here is that the SOURCE string is empty, while on your screenshot, none of the source strings are empty.

@claudiu.cristea: IMHO, first we should check in potx itself. I'd imagine we need to solve this in the "save string callback" functions, one of which is implemented in potx and another one is implemented in l10n_server. We should IMHO store an error for these strings as well, so the warning report will include these bogus sources.

#5

2Gábor Hojtsy
gm... Oh, I see
In my screenshot there are many marked as translated strings but with empty or non visible translated strings...
Do I need creation for a new issue?

#6

@podarok: Yes, that IMHO should be a new issue.

#7

Opened a sister issue for potx at #609590: Do not store empty strings, signal an error instead which has the potx specific fixes. We need to use the same empty string treatment here, and I've added test coverage for that as well to ensure we have this right. Actually committing this, but don't know the exact time when I can roll this out (not now).

Best would be to also add an update function to convert empty source strings to warnings (since we know the file name and line info for them, we can easily generate these error messages on an update). And then remove these strings. That would help all kinds of sites running this module to update properly instead of just a one-off hackish rollout on localize.drupal.org.

Making needs work on that, but committed the attached patch, so even if this rolls out, such future modules will mark errors.

AttachmentSizeStatusTest resultOperations
empty-string-with-tests.patch3.05 KBIgnored: Check issue status.NoneNone

#8

Status:needs work» fixed

I've did manual update on deployment on drupal.org, did not add update function since this should not be a significant problem for other users most probably. Consider it done.

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#10

Isn't this not also an issue of potx? potx should not extract the empty string or poedit chokes

#11

@hass: read #7 up there please.