• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5515: Translation of time units is stupid

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine Translations Normal New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary Translation of time units is stupid
ReportedBy TWiki:Main.ArthurClemens
Codebase

SVN Range TWiki-5.0.0, Thu, 03 Apr 2008, build 16612
AppliesTo Engine
Component Translations
Priority Normal
CurrentState New
WaitingFor

Checkins TWikirev:16638 TWikirev:16639
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2008-04-11 - ArthurClemens
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback