Skip to content

Commit

Permalink
switching to @krinkle/intuition which I installed with composer
Browse files Browse the repository at this point in the history
converting translations to JSON and deleting the php versions
all needed for TranslationWiki support (issue #8)
no clue if I should have added anything in order to retrieve intuition
  • Loading branch information
FlominatorTM committed Oct 15, 2015
1 parent cb59341 commit e4e82f9
Show file tree
Hide file tree
Showing 13 changed files with 246 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
/log
/cached
/vendor
5 changes: 5 additions & 0 deletions composer.json
@@ -0,0 +1,5 @@
{
"require": {
"Krinkle/intuition": "^0.2.2"
}
}
90 changes: 90 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 12 additions & 14 deletions foto_check.php
Expand Up @@ -16,11 +16,11 @@
}
}

$server = "$lang.$project.org";

$allOfferPages = new OfferPages($server);

echo '<h1>'. $messages['foto_check'].'</h1>';
echo '<a href="foto_range.php">'. $messages['back_to_range'] .'</a>';
echo '<h1>'. $I18N->msg( 'foto_check').'</h1>';
echo '<a href="foto_range.php">'. $I18N->msg( 'back_to_range') .'</a>';

foreach($allOfferPages->Items as $oneOfferPage)
{
Expand All @@ -32,9 +32,9 @@
echo '<col width="100">';
echo '</colgroup>';
echo '<tr>';
echo '<th>' .$messages['column_user'].'</th>';
echo '<th>' .$messages['column_location'].'</th>';
echo '<th>' .$messages['column_problem'].'</th>';
echo '<th>' .$I18N->msg( 'column_user').'</th>';
echo '<th>' .$I18N->msg( 'column_location').'</th>';
echo '<th>' .$I18N->msg( 'column_problem').'</th>';
echo '</tr>';

$count= 0;
Expand All @@ -51,18 +51,18 @@
echo '<td>';
if(!$usr->location->exists)
{
echo $messages['problem_no_article'];
echo $I18N->msg( 'problem_no_article');
}
else
{
if(!$usr->location->hasCoordinates)
{
echo $messages['problem_no_coordinates'];
echo $I18N->msg( 'problem_no_coordinates');
}
else if($usr->location->onlyFallback)
{
echo $messages['problem_no_coordinates'].'<br>';
echo '<i>'.$messages['problem_fallback'].'</i>';
echo $I18N->msg( 'problem_no_coordinates').'<br>';
echo '<i>'.$I18N->msg( 'problem_fallback').'</i>';
}
}
echo '</td>';
Expand All @@ -71,8 +71,8 @@

}
echo '</table>';
echo str_replace('__NUMBER_OF_ITEMS__', $count, $messages['items_found']);
echo ' - <a href="?purge=' . $oneOfferPage->server . '">' .$messages['purge_cache'] . '</a>';
echo $I18N->msg( 'items_found', array('variables'=> array( $count) , 'parsemag' => true ));
echo ' - <a href="?purge=' . $oneOfferPage->server . '">' .$I18N->msg( 'purge_cache') . '</a>';
}

function print_debug($str)
Expand All @@ -83,6 +83,4 @@ function print_debug($str)
echo $str."\n";
}
}


?>
26 changes: 13 additions & 13 deletions foto_range.php
Expand Up @@ -9,47 +9,47 @@
}
if($article_to == "")
{
echo '<h1>' . $messages['headline'] . '</h1>';
echo '<h1>' . $I18N->msg( 'headline' ) . '</h1>';
echo '<form>';
echo $messages['lang'] . ': <input name="lang" value="' . $lang .'"/> ' . $messages['lang_example'] .'<br>';
echo $messages['project'] . ': <input name="project" value="' . $project .'"/>' . $messages['project_example'] .'<br>';
echo $messages['article_to'] . ': <input name="article_to" value="' . $article_to .'"/>' . $messages['article_to_descr'] .'<br>';
echo '<input type="submit" value="'. $messages['find_next'] .'"/>';
echo $I18N->msg( 'lang') . ': <input name="lang" value="' . $lang .'"/> ' . $I18N->msg( 'lang_example') .'<br>';
echo $I18N->msg( 'project') . ': <input name="project" value="' . $project .'"/>' . $I18N->msg( 'project_example') .'<br>';
echo $I18N->msg( 'article_to') . ': <input name="article_to" value="' . $article_to .'"/>' . $I18N->msg( 'article_to_descr') .'<br>';
echo '<input type="submit" value="'. $I18N->msg( 'find_next') .'"/>';
echo '</form>';
}
else
{
log_search();
$footNote = "";
$linkToArticleTo = "<a href=\"https://$server/wiki/".name_in_url($article_to)."\">$article_to</a>";
echo '<h1>' . str_replace('_ARTICLE_TO_', $linkToArticleTo, $messages['distance_to']) .'</h1>';
echo '<h1>' . $I18N->msg( 'distance_to', array('variables' =>array($linkToArticleTo))) .'</h1>';
$locTo = new GeoLocation($article_to, $server);
if($locTo->IsValid())
{
$allOfferPages = new OfferPages($server);
$allOfferPages->MergeOffers($locTo);
$allOfferPages->ListUsersToRequest();
$homePage = $allOfferPages->HomeOfferPage;
$footNote = str_replace('_OFFER_PAGE_', $homePage->Link, $messages['you_on_list']);
$footNote = str_replace('_OFFER_PAGE_', $homePage->Link, $I18N->msg( 'you_on_list'));
$footNote = str_replace($homePage->server.'<', $homePage->OfferPageName.'<', $footNote);
}
else
{
echo str_replace('_LOCATION_', $linkToArticleTo, $messages['no_coordinates']);
echo $I18N->msg( 'no_coordinates', array('variables' => array($linkToArticleTo)) );
}

echo "<br><br><a href=\"?lang=$lang&project=$project\">".$messages['new_request']."</a>";
echo "<br><br><a href=\"?lang=$lang&project=$project\">".$I18N->msg( 'new_request')."</a>";
echo "<br><hr>$footNote";
}

echo "<br><hr>";
echo '<a href="' . $messages['manual_link'] . '">'. $messages['manual'] . '</a>';
echo '<a href="' . $I18N->msg( 'manual_link') . '">'. $I18N->msg( 'manual') . '</a>';
echo " - ";
echo '<a href="' . $messages['issue_link'] . '">'. $messages['issues'] . '</a>';
echo '<a href="' . $I18N->msg( 'issue_link') . '">'. $I18N->msg( 'issues') . '</a>';
echo " - ";
echo '<a href="foto_check.php">'. $messages['check_users'] . '</a>';
echo '<a href="foto_check.php">'. $I18N->msg( 'check_users') . '</a>';
echo ' - by <a href="http://de.wikipedia.org/wiki/Benutzer:Flominator">Flominator</a>';

echo $I18N->getPromoBox( 32, TSINT_HELP_ALL );

This comment has been minimized.

Copy link
@Krinkle

Krinkle Oct 19, 2015

The first parameter is now optional, you may use $I18N->getFooterLine( TSINT_HELP_ALL ); (new in v0.2.2, which you are using).

function print_debug($str)
{
global $is_debug;
Expand Down
6 changes: 3 additions & 3 deletions next_inc/OfferPage.php
Expand Up @@ -15,7 +15,7 @@ abstract function __construct($theServer, $OfferPageName,$MoreConfig) ;
abstract function GenerateUsers($page_src);
function Init($theServer, $OfferPageName)
{
global $messages, $is_debug;
global $is_debug;
//echo "page=".$page;
$this->server = $theServer;
$this->OfferPageName = $OfferPageName;
Expand Down Expand Up @@ -79,10 +79,10 @@ function Init($theServer, $OfferPageName)

protected function BuildNewCache($cacheFile)
{
global $messages;
global $I18N;
print_debug("cache is not fine");

echo str_replace('__PAGE__', $this->Link, $messages['cache_outdated']).'<br>';
echo $I18N->msg( 'cache_outdated', array('variables' => array($this->Link))).'<br>';

if(file_exists($cacheFile))
{
Expand Down
64 changes: 32 additions & 32 deletions next_inc/OfferPages.php
Expand Up @@ -9,30 +9,31 @@ class OfferPages

public function __construct($homeServer)
{
$allServers = get_language_list(self::$CONFIG_DIR);
//if the following line is not commented out,
//then I fucked up by checking in development code
//$allServers = array("fr.wikipedia.org");

$i=0;
foreach($allServers as $oneServer)
{
$ConfigFile = self::$CONFIG_DIR . '/' . $oneServer . '.php';
if(!file_exists($ConfigFile))
{
die(str_replace('_PROJECT_', $this->server, $messages['proj_not_supported']));
}
else
{
include($ConfigFile);
}
$this->Items[]= $createdPage;
if($oneServer == $homeServer)
{
$this->HomeOfferPage = $createdPage;
}
$i++;
}
global $I18N;
$allServers = get_language_list(self::$CONFIG_DIR);
//if the following line is not commented out,
//then I fucked up by checking in development code
//$allServers = array("fr.wikipedia.org");

$i=0;
foreach($allServers as $oneServer)
{
$ConfigFile = self::$CONFIG_DIR . '/' . $oneServer . '.php';
if(!file_exists($ConfigFile))
{
die($I18N->msg( 'proj_not_supported', array('variables' => array( $this->server ))));
}
else
{
include($ConfigFile);
}
$this->Items[]= $createdPage;
if($oneServer == $homeServer)
{
$this->HomeOfferPage = $createdPage;
}
$i++;
}
}

function MergeOffers($locTo)
Expand All @@ -54,12 +55,12 @@ function MergeOffers($locTo)

public function ListUsersToRequest()
{
global $messages;
global $I18N;
echo '<table border="1">';
echo "<tr>";
echo "<th>" . $messages['column_user'] ."</th>";
echo "<th>" . $messages['column_distance'] ."</th>";
echo "<th>" . $messages['column_wiki'] ."</th>";
echo "<th>" . $I18N->msg( 'column_user') ."</th>";
echo "<th>" . $I18N->msg( 'column_distance') ."</th>";
echo "<th>" . $I18N->msg( 'column_wiki') ."</th>";
echo "</tr>";
foreach($this->AllOffers as $usr)
{
Expand Down Expand Up @@ -90,17 +91,16 @@ public function ListUsersToRequest()
{
if($usr->dateTo < $now)
{
echo str_replace('_DATE_', strftime("%x", $usr->dateTo), $messages['until_date_over']);
echo $I18N->msg( 'until_date_over', array('variables' => aray(strftime("%x", $usr->dateTo))));
}
else
{
echo str_replace('_DATE_', strftime("%x", $usr->dateTo), $messages['until_date']);
echo $I18N->msg( 'until_date'), array('variables' => aray(strftime("%x", $usr->dateTo)));
}
}
else
{
$out = str_replace('_FIRST_DATE_', strftime("%x", $usr->dateFrom), $messages['between_dates']);
echo str_replace('_SECOND_DATE_', strftime("%x", $usr->dateTo), $out);
echo $I18N->msg( 'between_dates'), array('variables' => aray(strftime("%x", $usr->dateFrom), strftime("%x", $usr->dateTo)));
}
}
//echo "<br>";
Expand Down
4 changes: 2 additions & 2 deletions next_inc/OfferingUser.php
Expand Up @@ -45,8 +45,8 @@ public function IsValid()

public function IsBeingRetrieved()
{
global $messages;
print_debug(str_replace('__USER__', $this->name, $messages['user_retrieval'].'<br>'));
global $I18N;
print_debug($I18N->msg( 'user_retrieval', array("variables" => array($this->name))).'<br>');
}

public function IsInRange()
Expand Down

0 comments on commit e4e82f9

Please sign in to comment.