db strings extract script needs to skip empty strings

RESOLVED FIXED

Status

support.mozilla.org
General
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: mathjazz, Assigned: willkg)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
Empty strings are not allowed in Gettext:
http://viewvc.svn.mozilla.org/vc/projects/sumo/locales/templates/LC_MESSAGES/messages.pot?limit_changes=0&view=markup&pathrev=149751#l5901

Their representation in locale files (and consequently in Pontoon, Verbatim , poEdit and all other tolls) is weird - empty string is shown as original and the PO file header as translation (LOL?).

Check it out in SVN:
http://viewvc.svn.mozilla.org/vc/projects/sumo/locales/de/LC_MESSAGES/messages.po?revision=149757&view=markup&pathrev=149758#l5020

But that's actually what the spec says:
"This also has another advantage, as the empty string in a PO file GNU gettext is usually translated into some system information attached to that particular MO file, and the empty string necessarily becomes the first in both the original and translated tables, making the system information very easy to find."

Sources:
http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files
http://framework.zend.com/issues/browse/ZF-2914
This is coming from the db strings extract script. It should be skipping empty strings. I adjusted the title accordingly. This is an easy fix, so if no one gets to it today, I'll do it.
Summary: Empty strings not allowed in Gettext → db strings extract script needs to skip empty strings
Further, this is a problem with Input, too. I'll write up a bug for that later.
Grabbing this to do now.
Assignee: nobody → willkg
Status: NEW → ASSIGNED
I tweaked the extract_db.py script. However, there's nothing in the db that creates an empty string and I spent some time looking back in time and I don't know where those strings came from. That fuzzy block should get removed.

In a PR: https://github.com/mozilla/kitsune/pull/2749
That PR landed in master: https://github.com/mozilla/kitsune/commit/e2da7b3c4dec28b69dcc70cc0ccd697501525b68

After Mike traced down the strings, we think what happened was we did a db strings extraction with an empty db. I added a "Are you sure...?" kind of prompt to the command.

PR and some discussion about how to do that better in: https://github.com/mozilla/kitsune/pull/2752
After some discussion, I nixed PR 2752.

I think the only outstanding thing here is to re-extract the strings. I don't know if we need to additionally go through all the .po files and clean them up.

matjaz: Do we need to go through and clean up the .po files or do you think the natural flow of the universe will sort it out?
Flags: needinfo?(m)
(Reporter)

Comment 7

2 years ago
I suspect re-extract means the problematic string will be gone for all locales:
http://viewvc.svn.mozilla.org/vc/projects/sumo/locales/de/LC_MESSAGES/messages.po?revision=149757&view=markup&pathrev=149758#l5020

So that should be enough.

If it doesn't mean that it's gone, we need to find another way to make it gone. ;)
Flags: needinfo?(m)
I think the issues are fixed now. I'm going to mark this FIXED. If there are still outstanding issues, someone can reopen it so we can investigate.
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.