49 global $wgTranslateSandboxLimit;
56 $user = RequestContext::getMain()->getUser();
57 $translations = $store->getTranslations( $user );
61 foreach ( $translations as $translation ) {
62 $title = $translation->getTitle();
64 $index = $title->getNamespace() .
':' . $handle->getKey();
69 $all = MessageIndex::singleton()->getKeys();
75 $max = count( $all ) - 1;
78 for ( $i = count( $list ); $i < 100; $i++ ) {
79 $list[$all[rand( $min, $max )]] =
'';
87 $messagesToProvide = $wgTranslateSandboxLimit * 2;
89 foreach ( $list as $index => &$translation ) {
90 [ $ns, $page ] = explode(
':', $index, 2 );
91 $title = Title::makeTitle( $ns,
"$page/{$this->language}" );
94 if ( MessageGroups::isTranslatableMessage( $handle, $this->language ) ) {
97 if ( $translation ===
null ) {
99 unset( $list[$index] );
100 wfWarn(
"No message definition for $index while preparing the sandbox" );
107 unset( $list[$index] );
114 if ( $count === $messagesToProvide ) {
120 $list = array_slice( $list, 0, $messagesToProvide );
135 $groupId = MessageIndex::getPrimaryGroupId( $handle );
136 $group = MessageGroups::getGroup( $groupId );
139 $source = $group->getMessage( $key, $group->getSourceLanguage() );
140 if ( $source !==
null ) {
145 $keys = $group->getKeys();
148 foreach ( $keys as $realkey ) {
149 if ( $key === strtolower( $realkey ) ) {
155 return $group->getMessage( $key, $group->getSourceLanguage() );