Ejemplo n.º 1
0
 public function testCountErrors()
 {
     require_once TEST_FILES . 'config/sources.php';
     $obj = new _LangManager();
     $reference_data = $obj->loadSource($sites[2], 'en-US', 'page.lang');
     $locale_data = $obj->loadSource($sites[2], 'it', 'page.lang');
     $analysis_data = $obj->analyzeLangFile($sites[2], 'it', 'page.lang', $reference_data);
     $this->integer($obj->countErrors($analysis_data['errors'], 'all'))->isEqualTo(6);
     $this->integer($obj->countErrors($analysis_data['errors']))->isEqualTo(6);
     $this->integer($obj->countErrors($analysis_data['errors'], 'python'))->isEqualTo(5);
     $this->integer($obj->countErrors($analysis_data['errors'], 'length'))->isEqualTo(1);
     $this->integer($obj->countErrors($analysis_data['errors'], 'random'))->isEqualTo(0);
 }
Ejemplo n.º 2
0
        }
        foreach (Project::getWebsiteFiles($current_website) as $current_filename) {
            // File not supported
            if (!Project::isSupportedLocale($current_website, $current_locale, $current_filename, $langfiles_subsets)) {
                continue;
            }
            // File marked as obsolete
            if (Project::isObsoleteFile($current_website, $current_filename, $current_locale)) {
                continue;
            }
            // File doesn't exist
            if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) {
                continue;
            }
            $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename);
            $locale_analysis = LangManager::analyzeLangFile($current_website, $current_locale, $current_filename, $reference_data);
            $untranslated[$current_locale] += count($locale_analysis['Identical']) + count($locale_analysis['Missing']);
            $translated[$current_locale] += count($locale_analysis['Translated']);
            $file_count[$current_locale] += 1;
        }
    }
    $all_strings[$current_locale] = $untranslated[$current_locale] + $translated[$current_locale];
}
// I need locales with more untranslated strings first
arsort($untranslated);
if ($json) {
    die(Json::output($untranslated, false, true));
}
// General table with untranslated/translated strings per locale
$rows = '';
foreach ($untranslated as $locale => $untranslated_count) {