50 global $wgTranslateSandboxLimit;
57 $user = RequestContext::getMain()->getUser();
58 $translations = $store->getTranslations( $user );
62 foreach ( $translations as $translation ) {
63 $title = $translation->getTitle();
65 $index = $title->getNamespace() .
':' . $handle->getKey();
70 $all = MessageIndex::singleton()->getKeys();
76 $max = count( $all ) - 1;
79 for ( $i = count( $list ); $i < 100; $i++ ) {
80 $list[$all[rand( $min, $max )]] =
'';
88 $messagesToProvide = $wgTranslateSandboxLimit * 2;
90 foreach ( $list as $index => &$translation ) {
91 [ $ns, $page ] = explode(
':', $index, 2 );
92 $title = Title::makeTitle( $ns,
"$page/{$this->language}" );
95 if ( MessageGroups::isTranslatableMessage( $handle, $this->language ) ) {
98 if ( $translation ===
null ) {
100 unset( $list[$index] );
101 wfWarn(
"No message definition for $index while preparing the sandbox" );
108 unset( $list[$index] );
115 if ( $count === $messagesToProvide ) {
121 $list = array_slice( $list, 0, $messagesToProvide );
136 $groupId = MessageIndex::getPrimaryGroupId( $handle );
137 $group = MessageGroups::getGroup( $groupId );
140 $source = $group->getMessage( $key, $group->getSourceLanguage() );
141 if ( $source !==
null ) {
146 $keys = $group->getKeys();
149 foreach ( $keys as $realkey ) {
150 if ( $key === strtolower( $realkey ) ) {
156 return $group->getMessage( $key, $group->getSourceLanguage() );