Item5515: Add translations of time units in language files

pencil
Priority: Normal
Current State: Confirmed
Released In:
Target Release: patch
Applies To: Engine
Component: Translations
Branches:
Reported By: TWiki:Main.ArthurClemens
Waiting For:
Last Change By: KennethLavrsen

Problem

TWiki assumes to know about plurals in other languages: "seconds" is translated as "second" + "s". In Dutch this becomes the incomprehensable "secondens".

The same with "minute" + "s" = "minutens".

Caused by this template text:
"%1 has been editing the topic for %2 and the lease is still active for "
"another %3."

This line is used by Edit.pm and Func.pm, using
$past = TWiki::Time::formatDelta(
                        $t - $lease->{taken}, $session->{i18n} );

$session->{i18n} is the current language. This is only passed when $TWiki::cfg{UseLocale} = 1, which is strange, as the language should be retrieved without it.

OK, we are having both $session->i18n and $session->{i18n}. Only one is correct.
Fixed that in Item5517, but it doesn't solve the problem.

Solution

It appears that Lexicon.pm is fancier than I thought. It has this in the documentation:
    #: Hello.pm:11
    msgid "You have %quant(%1,piece) of mail."
    msgstr "Sie haben %quant(%1,Poststueck,Poststuecken)."

So in the translation file you must write the plural after the singular. For instance with German in de.po:
#. ($days)
#: lib/TWiki/Time.pm:290
msgid "%*(%1,day) "
msgstr "%*(%1,Tag,Tagen) "

This will create a correct translated string:
TestUser bearbeitet das Topic seit 1 Stunde 19 Minuten 20 Sekunden und die Ausleihung ist noch aktiv für weitere 40 Sekunden.

-- TWiki:Main/ArthurClemens - 10 Apr 2008

From the checkins, this appears to be fixed. Arthur?

-- CrawfordCurrie - 04 Jan 2009

This has only been changed in nl.po. Other languages did not change this (and I certainly cannot). I have changed the summary.

-- ArthurClemens - 07 Jan 2009

Please don't leave tasks in "Waiting for Feedback" state without indicating who you want feedback from. I have assumed this is something for the TranslationTaskTeam so have set the "Waiting For" field to that.

-- CrawfordCurrie - 03 Feb 2009

ItemTemplate edit

Summary Add translations of time units in language files
ReportedBy TWiki:Main.ArthurClemens
Codebase
SVN Range TWiki-5.0.0, Thu, 03 Apr 2008, build 16612
AppliesTo Engine
Component Translations
Priority Normal
CurrentState Confirmed
WaitingFor
Checkins TWikirev:16638 TWikirev:16639
TargetRelease patch
ReleasedIn
Topic revision: r9 - 25 Apr 2009, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy