Пример #1
0
foreach ($wgLanguages->getLanguages() as $code) {
    # Don't check English or RTL English
    if ($code == 'en' || $code == 'enRTL') {
        continue;
    }
    # Calculate the numbers
    $language = $wgContLang->getLanguageName($code);
    $messages = $wgLanguages->getMessages($code);
    $messagesNumber = count($messages['translated']);
    $requiredMessagesNumber = count($messages['required']);
    $requiredMessagesPercent = $wgOut->formatPercent($requiredMessagesNumber, $wgRequiredMessagesNumber);
    $obsoleteMessagesNumber = count($messages['obsolete']);
    $obsoleteMessagesPercent = $wgOut->formatPercent($obsoleteMessagesNumber, $messagesNumber, true);
    $messagesWithoutVariables = $wgLanguages->getMessagesWithoutVariables($code);
    $emptyMessages = $wgLanguages->getEmptyMessages($code);
    $messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace($code);
    $nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages($code);
    $messagesWithWrongChars = $wgLanguages->getMessagesWithWrongChars($code);
    $problematicMessagesNumber = count(array_unique(array_merge($messagesWithoutVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars)));
    $problematicMessagesPercent = $wgOut->formatPercent($problematicMessagesNumber, $messagesNumber, true);
    # Output them
    $wgOut->blockstart();
    $wgOut->element("{$language}");
    $wgOut->element("{$code}");
    $wgOut->element("{$requiredMessagesNumber}/{$wgRequiredMessagesNumber}");
    $wgOut->element($requiredMessagesPercent);
    $wgOut->element("{$obsoleteMessagesNumber}/{$messagesNumber}");
    $wgOut->element($obsoleteMessagesPercent);
    $wgOut->element("{$problematicMessagesNumber}/{$messagesNumber}");
    $wgOut->element($problematicMessagesPercent);
    $wgOut->blockend();