2012-01-27: A new translation rally has started. Help us to translate FUDforum and claim your bounty of US$50! (Other news...)
User:SPQRobin/sandbox
From translatewiki.net
Contents |
[edit] dd
- Test
- One two three
Something else
- here
- and here
- even more here
- indeed
- yes
- even more here
- Test
- One two three
Something else
- here
- and here
- even more here
- indeed
- yes
- even more here
[edit] nl-be?
Enkele woorden die ik tegengekomen ben in de MediaWiki-localisatie naar het Nederlands, die in België ongewoon zijn (ik beperk mij hier tot de standaardtaal).
- het filter -> de filter
- creditcard -> kredietkaart
- soortgelijk -> gelijkaardig
- Eng. "follow-up" -> opvolgen, geen goed alternatief gevonden in NL-NL
verward -> in de war (maar dit is misschien wat meer spreektaal)past niet in de zin
CLDR:
- Bretons -> Bretoens
[edit] Block log i18n
This changes the block expiry options to only English ones, and then on Special:Block and on the block log they are translated into the user language.
Advantages:
- Everything is translated to the user's language (true i18n)
- Numbers (e.g. in "5 days") are formatted according to the user language
- Translators don't have to translate ipboptions (which is especially hard for RTL languages I assume)
Issues:
- What to do with LanguageFi::translateBlockExpiry()
- Maybe it is hard to translate this into other languages? (however, it is an improvement anyway I think)
See also: http://www.gnu.org/software/shishi/manual/html_node/Relative-items-in-date-strings.html
Index: includes/ProtectionForm.php =================================================================== --- includes/ProtectionForm.php (revision 91810) +++ includes/ProtectionForm.php (working copy) @@ -387,15 +387,15 @@ } $expiryFormOptions .= Xml::option( wfMsg( 'protect-othertime-op' ), "othertime" ) . "\n"; - foreach( explode(',', $scExpiryOptions) as $option ) { - if ( strpos($option, ":") === false ) { - $show = $value = $option; - } else { - list($show, $value) = explode(":", $option); - } - $show = htmlspecialchars($show); - $value = htmlspecialchars($value); - $expiryFormOptions .= Xml::option( $show, $value, $this->mExpirySelection[$action] === $value ) . "\n"; + foreach( explode( ',', $scExpiryOptions ) as $option ) { + $option = trim( $option ); + $translated = $wgLang->translateRelativeTime( $option ); + $value = htmlspecialchars( $option ); + $expiryFormOptions .= Xml::option( + htmlspecialchars( $translated ? $translated : $option ), + $value, + $this->mExpirySelection[$action] === $value + ) . "\n"; } # Add expiry dropdown if( $showProtectOptions && !$this->disabled ) { Index: includes/specials/SpecialBlock.php =================================================================== --- includes/specials/SpecialBlock.php (revision 91810) +++ includes/specials/SpecialBlock.php (working copy) @@ -712,27 +712,23 @@ } /** - * Get an array of suggested block durations from MediaWiki:Ipboptions - * @todo FIXME: This uses a rather odd syntax for the options, should it be converted - * to the standard "**<duration>|<displayname>" format? + * Get an array of suggested block durations from MediaWiki:Block-expiry-options + * The syntax is now like "1 hour,2 days,3 weeks" (always in English, i.e. the values of strtotime().) * @return Array */ - public static function getSuggestedDurations( $lang = null ){ + public static function getSuggestedDurations() { + global $wgLang; $a = array(); - $msg = $lang === null - ? wfMessage( 'ipboptions' )->inContentLanguage()->text() - : wfMessage( 'ipboptions' )->inLanguage( $lang )->text(); + $msg = wfMessage( 'block-expiry-options' )->inContentLanguage()->text(); - if( $msg == '-' ){ + if( $msg == '-' ) { return array(); } foreach( explode( ',', $msg ) as $option ) { - if( strpos( $option, ':' ) === false ){ - $option = "$option:$option"; - } - list( $show, $value ) = explode( ':', $option ); - $a[htmlspecialchars( $show )] = htmlspecialchars( $value ); + $option = trim( $option ); + $translated = $wgLang->translateRelativeTime( $option ); + $a[htmlspecialchars( $translated ? $translated : $option )] = htmlspecialchars( $option ); } return $a; } Index: languages/Language.php =================================================================== --- languages/Language.php (revision 91810) +++ languages/Language.php (working copy) @@ -2995,30 +2995,54 @@ * This translates the duration ("1 week", "4 days", etc) * as well as the expiry time (which is an absolute timestamp). * @param $str String: the validated block duration in English - * @return Somehow translated block duration + * @return String Translated block duration * @see LanguageFi.php for example implementation */ function translateBlockExpiry( $str ) { - $duration = SpecialBlock::getSuggestedDurations( $this ); - foreach( $duration as $show => $value ){ - if ( strcmp( $str, $value ) == 0 ) { - return htmlspecialchars( trim( $show ) ); - } + # Translate relative time expressions + $relative = $this->translateRelativeTime( $str ); + if ( $relative ) { + return $relative; } + # Else it is probably a timestamp, otherwise display the string + if ( strtotime( $str ) ) { + return $this->timeanddate( strtotime( $str ) ); + } + # Otherwise display the original string (this should not happen) + return $str; + } - // Since usually only infinite or indefinite is only on list, so try - // equivalents if still here. - $indefs = array( 'infinite', 'infinity', 'indefinite' ); - if ( in_array( $str, $indefs ) ) { - foreach( $indefs as $val ) { - $show = array_search( $val, $duration, true ); - if ( $show !== false ) { - return htmlspecialchars( trim( $show ) ); - } - } + /* + * @param $str String The relative time expression in English + * @param $msgPrefix The messages to use (defaults to expirytime-*) + * @return String or false + */ + function translateRelativeTime( $str, $msgPrefix = 'expirytime-' ) { + $str = trim( $str ); + # string => message + $exact = array( + 'infinite' => 'infinite', 'indefinite' => 'infinite', + 'infinity' => 'infinite', 'tomorrow' => 'tomorrow', + ); + if ( isset( $exact[$str] ) ) { + return wfMsg( $msgPrefix . $exact[$str] ); } - // If no duration is given, but a timestamp, display that - return ( strtotime( $str ) ? $this->timeanddate( strtotime( $str ) ) : $str ); + $countable = array( 'second', 'minute', 'hour', 'day', 'week', 'month', 'year' ); + $array = explode(' ', $str ); + if( !is_array( $array ) || count( $array ) < 2 ) { + return false; + } + # Translate relative time expressions (X hours/days/...) + $return = array(); + $i = 0; + while( $i < count( $array ) ) { + $txt = trim( $array[$i+1], ' s' ); + if ( !isset( $txt ) || !in_array( $txt, $countable ) ) { break; } + $num = (int)$array[$i]; + $return[] = wfMsgExt( $msgPrefix . $txt, 'parsemag', $num, $this->formatNum( $num ) ); + $i++; $i++; + } + return implode( ' ', $return ); } /** Index: languages/messages/MessagesEn.php =================================================================== --- languages/messages/MessagesEn.php (revision 91810) +++ languages/messages/MessagesEn.php (working copy) @@ -2882,7 +2882,7 @@ ** Counter-productive edit warring ** High traffic page', 'protect-edit-reasonlist' => 'Edit protection reasons', -'protect-expiry-options' => '1 hour:1 hour,1 day:1 day,1 week:1 week,2 weeks:2 weeks,1 month:1 month,3 months:3 months,6 months:6 months,1 year:1 year,infinite:infinite', +'protect-expiry-options' => '1 hour,1 day,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite', # only translate this message to other languages if you have to change it 'restriction-type' => 'Permission:', 'restriction-level' => 'Restriction level:', 'minimum-size' => 'Min size', @@ -3043,7 +3043,6 @@ 'ipbenableautoblock' => 'Automatically block the last IP address used by this user, and any subsequent IP addresses they try to edit from', 'ipbsubmit' => 'Block this user', 'ipbother' => 'Other time:', -'ipboptions' => '2 hours:2 hours,1 day:1 day,3 days:3 days,1 week:1 week,2 weeks:2 weeks,1 month:1 month,3 months:3 months,6 months:6 months,1 year:1 year,indefinite:infinite', 'ipbotheroption' => 'other', 'ipbotherreason' => 'Other/additional reason:', 'ipbhidename' => 'Hide username from edits and lists', @@ -3145,7 +3144,19 @@ Since you do not have the hideuser right, you cannot see or edit the user's block.", 'ipbblocked' => 'You cannot block or unblock other users, because you are yourself blocked', 'ipbnounblockself' => 'You are not allowed to unblock yourself', +'block-expiry-options' => '2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite', # only translate this message to other languages if you have to change it +# Expiry time (currently used only by the block log) +'expirytime-infinite' => 'indefinite', +'expirytime-tomorrow' => 'tomorrow', +'expirytime-second' => '{{PLURAL:$1|one second|$2 seconds}}', +'expirytime-minute' => '{{PLURAL:$1|one minute|$2 minutes}}', +'expirytime-hour' => '{{PLURAL:$1|one hour|$2 hours}}', +'expirytime-day' => '{{PLURAL:$1|one day|$2 days}}', +'expirytime-week' => '{{PLURAL:$1|one week|$2 weeks}}', +'expirytime-month' => '{{PLURAL:$1|one month|$2 months}}', +'expirytime-year' => '{{PLURAL:$1|one year|$2 years}}', + # Developer tools 'lockdb' => 'Lock database', 'unlockdb' => 'Unlock database',
[edit] Cologne Blue specific
-
'qbfind' => 'Find', # Used as alternative of "search" - could be replaced
-
'qbbrowse' => 'Browse', # Used as alternative of "navigation" in sidebar - could be replaced
-
'qbedit' => 'Edit', # Should be replaced by "edit"
-
'qbpageoptions' => 'This page', # Title of action links (tabs in Monobook)
-
'qbpageinfo' => 'Context', # Links to history, whatlinkshere and relatedchanges
-
'qbmyoptions' => 'My pages', # Title of personal links (as in upper right in Monobook)
-
'qbspecialpages' => 'Special pages', # Should be replaced by "specialpages"
-
-
# An extra section in Special:Preferences about where the quickbar (sidebar) should be -
'qbsettings' => 'Quickbar',
-
'qbsettings-none' => 'None',
-
'qbsettings-fixedleft' => 'Fixed left',
-
'qbsettings-fixedright' => 'Fixed right',
-
'qbsettings-floatingleft' => 'Floating left',
-
'qbsettings-floatingright' => 'Floating right',
[edit] Group-*
Waar worden de berichten group-* gebruikt? Want het lijkt erop dat ze evengoed als group-*-member met een kleine letter kunnen geschreven worden.
- Special:Log/rights - hoofdletter is zeker niet nodig (in horizontale lijst)
- Special:Userrights - hier ook zeker niet (in horizontale lijst)
- Special:Preferences - ook niet nodig (in horizontale lijst)
- Special:ListGroupRights - misschien toch wel mooier met hoofdletters / wordt ook gebruikt in horizontale lijst
- In het menu van Special:ListUsers - maakt niet uit
- Special:Statistics
- Waar nog?
[edit] Table
| test bug 30290 |
| test |
| test |