[PATCH 2/2] Fix plurals translation

Dirk Hohndel dirk at hohndel.org
Thu Oct 29 12:33:12 PDT 2015


On Thu, Oct 29, 2015 at 12:17:05PM -0700, Dirk Hohndel wrote:
> On Thu, Oct 29, 2015 at 09:59:06PM +0300, Sergey Starosek wrote:
> > On Thu, Oct 29, 2015 at 9:25 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> > 
> > > > > So we had a bunch of problems with the plural forms and just dropped
> > > them
> > > > > for 4.5
> > > > >
> > > > > Are these resolved?
> > > > >
> > > >
> > > > I've spotted only two using 'git grep'. Likely this needs more thorough
> > > > search. And/or a kind of guidelines
> > > > for coders/translators.
> > >
> > > I seem to remember that the problem was that the translations didn't
> > > actually work correctly.
> > >
> > >
> > > https://www.mail-archive.com/subsurface@subsurface-divelog.org/msg06917.html
> > >
> > > So unless this has been resolved, I don't think this patch makes sense :-(
> > >
> > 
> > Tested locally with 'linguist' (not sure about transifex) against en-GB and
> > ru-RU locales. Works for me (c).
> > I.e. I get
> > 
> >    - 1 *дайв* for one dive in RU
> >    - 2-3-4 *дайва* for 2-4 dives
> >    - 5-... *дайвов* for more than four dives
> > 
> > One have to explicitly provide translations for singular (Rule 1), plural
> > (Rule 3) and dual (Rule 2 in case of 'ru' locale).
> > Also one have to translate plural forms in the base (en) locale and load it
> > explicitly in order to make plurals work.
> > 
> > What am I missing?
> 
> I think the problem was that what we extracted with our tools and then
> sent to transifex was incorrectly encoded...
> 
> But since we are in the "let's go wild" phase of development... let me
> apply your patch, push the strings to transifex and see how this works.
> 
> Give me a few minutes and check transifex, please.

Yep, same problem we used to have, I think.

Transifex (for German) now shows "5 untranslated strings", but only offers
3 to translate - the other two being the plural forms.

The .ts file for those looks like this:

    <message numerus="yes">
        <location filename="../qt-ui/modeldelegates.cpp" line="546"/>
        <source>, %n dive(s) here)</source>
        <translation type="unfinished">
            <numerusform></numerusform>
        </translation>
    </message>

    <message numerus="yes">
        <location filename="../qthelper.cpp" line="1077"/>
        <source>(%n dive(s))</source>
        <translation type="unfinished">
            <numerusform></numerusform>
        </translation>
    </message>

and clearly transifex does not like this. Some googling seems to imply
that transifex is aware of the bug and promised a fix more than a year ago
(and then instead just shut down their forums - nice). But I also found a
workaround and it appears to do the trick. Now I just need to remember to
manually fix our .ts file before I send it - or somehow automate the
workaround (which is to duplicate the "<numerusform></numerusform>" line)

/D


More information about the subsurface mailing list