After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 117147 - gtranslator doesn't open po-files with plural forms
gtranslator doesn't open po-files with plural forms
Status: VERIFIED FIXED
Product: gtranslator
Classification: Other
Component: Parse engine
HEAD
Other All
: High major
: 1.0
Assigned To: Fatih Demir
Fatih Demir
: 113960 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-07-10 18:31 UTC by ellebrecht-edv
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The test case from Frank in a new, ext. UTF-8 version for testing issues (908 bytes, application/octet-stream)
2003-08-02 15:38 UTC, Fatih Demir
Details

Description ellebrecht-edv 2003-07-10 18:31:07 UTC
Try to open the following sample in gtranslator. The program will claim an
error in line 17, probably because of the use of a msgid_plural string. 

msgid ""
msgstr ""
"Project-Id-Version: de\n"
"POT-Creation-Date: 2003-06-17 16:41-0400\n"
"PO-Revision-Date: 2003-07-04 06:32+0200\n"
"Last-Translator: Frank Ellebrecht <ellebrecht-edv(at)gmx.de>\n"
"Language-Team: None\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"


#: src/liflines/add.c:62
#, c-format
msgid "There was %d unresolved reference."
msgid_plural "There were %d unresolved references."
msgstr[0] "%d Datensatz mit diesem Schlüssel oder Bezug gibt es nicht."
msgstr[1] "%d Datensätze mit diesem Schlüssel oder Bezug gibt es nicht."
Comment 1 Fatih Demir 2003-07-10 18:42:19 UTC
*** Bug 113960 has been marked as a duplicate of this bug. ***
Comment 2 Fatih Demir 2003-07-13 10:34:47 UTC
Well, here we need to have a tactic or logic or something like that to
get this going - one easy, cracking and stupido method came into my
mind with which one could get this working:

We could parse the msgid and then if the msgid_plural follows we could
make the original GtrMsg->msgid string a "string container" for both
of the strings with a simple separator between the two messages like a
non used string part like EAT_MORE_CHICKEN or alike ;-)

Then the same could be also done for the msgstr parts so that the
parsed entries would look for gtranslator in the GtrMsg structure like
that according to the above delivered example message:

msgid "There was %d unresolved reference."
msgid_plural "There were %d unresolved references."

Gets -> GtrMsg->msgid="There was %d unresolved
reference.EAT_MORE_CHICKENThere were %d unresolved references.".

The same then for the msgstr, it's crapped and would require some
grater changes in the source; another way would be to change the parse
routines but then to define a new attr for GtrMsg like "group" or such
to group the together bound messages together like:

GtrMsg 1 -> msgid = There was %d unresolved reference.
GtrMsg 1 -> group = 1

GtrMsg 2 -> msgid = There were %d unresolved references.
GtrMsg 2 -> group = 1

GtrMsg 3 -> msgid = Whatever comes here...

So it would be possible after building the msgid correspondingly in
the parsing routines to get the messages also alltogether while saving
to make the work of the translators good.

Any comments, desires hints?! /me would vote for way #2 here...
Comment 3 Fatih Demir 2003-07-13 10:38:18 UTC
Ah well, what I did forget - in the GUI the messages would look like
different messages (group 1 would representate then 2 messages) but this
logic has got one big disadvantage - for messages with more then just 2
translations (like in Polnish AFAIR) this would make the resting msgstr
parts useless and got forgotten about them :-(

Hmm...
Comment 4 Ross Golder 2003-07-19 14:32:37 UTC
First, the GtrMsg struct needs to be changed to accomodate plural
records. I suggest that we add 'gchar *msgplural' under 'gchar
*msgid', and convert 'gchar *msgstr' to 'glist *msgstrs' or something.
Normal messages would only occupy one element of the list, and
'gboolean is_plural = (msgplural != NULL)'.

Next, the parser need to be updated to read and write with the updated
GtrMsg. This wouldn't be too hard.

The hardest bit, for me anyway, would be designing the most
appropriate GUI way to present singular and plural messages to the
user for editting.

Just my thoughts, in brief.

--
Ross
Comment 5 Fatih Demir 2003-07-20 17:35:22 UTC
This means we add:

 gchar *msgid_plural;
 GList *msgstrs;
 
Making for normal messages the msgid_plural=NULL and the 1st msgstrs
entry the default msgstr from today.
 
For the GUI, the best approach would be to display the different
translations as different messsages; or: a table with the translations
where you can Add/Delete additional translations for the different
counts like

WINDOW---------------------------------------------------------------
 
Message---------------------------------------------------------frame
 
 Single | msgid
 Plural | msgid_plural
 
 Translation-----------------------------------------------------frame
 
 
 Translation #
 
 0 | msgstr[0]
 1 | msgstr[1]
  etc...
 
with [Add] [Edit] [Delete] [Close] buttons. Would mean slower editing
of such messages but maybe a more beautiful handling of these messages

On [Edit] we could display the messsage in the normal GUI for editing.
Comment 6 Fatih Demir 2003-08-02 15:38:52 UTC
Created attachment 18848 [details]
The test case from Frank in a new, ext. UTF-8 version for testing issues
Comment 7 Fatih Demir 2003-08-10 17:06:19 UTC
Fixed in CVS and the latest CVS Debian snapshots, the plural forms are
now parsed, saved and displayed with a special dialog. You can even
edit the plural forms. The implementation is a bit old-styled code but
I guess most languages will stick with msgstr_2 as the maximum # of
plural forms so that gtranslator should be good with that now :-)

A (end-august) coming R 1.0 will solve this issue...