Languages translation progress report for web pages is available here.
'doc_xsl', // Mageia XSL files translation 'tx_name' => 'doc_xsl', 'git_path' => 'http://gitweb.mageia.org/software/i18n/tools/plain/docs/stylesheets/po', ), array( 'pot_name' => 'help', // Mageia Installer Help 'tx_name' => 'doc_installer', 'git_path' => 'http://gitweb.mageia.org/software/i18n/tools/plain/docs/installer', ), array( 'pot_name' => 'mcc-help', // Mageia Control Center Help 'tx_name' => 'mcc-help', 'git_path' => 'http://gitweb.mageia.org/software/i18n/tools/plain/docs/mcc-help', ), ); } else if ('Cauldron' == $resource_type) { $git_resources = array( array( 'pot_name' => 'drakconf', // Mageia Control Center 'tx_name' => 'control-center', 'git_path' => 'http://gitweb.mageia.org/software/control-center/plain/po', ), array( 'pot_name' => 'desktop-common-data', 'tx_name' => 'desktop-common-data', 'git_path' => 'http://gitweb.mageia.org/software/desktop/common-data/plain/po', ), array( 'pot_name' => 'drak3d', 'tx_name' => 'drak3d', 'git_path' => 'http://gitweb.mageia.org/software/drak3d/plain/po', ), array( 'pot_name' => 'drakguard', 'tx_name' => 'drakguard', 'git_path' => 'http://gitweb.mageia.org/software/drakguard/plain/po', ), array( 'pot_name' => 'draklive-install', 'tx_name' => 'draklive-install', 'git_path' => 'http://gitweb.mageia.org/software/draklive-install/plain/po', ), array( 'pot_name' => 'drakmenustyle', 'tx_name' => 'drakmenustyle', 'git_path' => 'http://gitweb.mageia.org/software/drakmenustyle/plain/po', ), array( 'pot_name' => 'drakpxelinux', 'tx_name' => 'drakpxelinux', 'git_path' => 'http://gitweb.mageia.org/software/drakpxelinux/plain/po', ), array( 'pot_name' => 'drakwizard', 'tx_name' => 'drakwizard', 'git_path' => 'http://gitweb.mageia.org/software/drakwizard/plain/po', ), array( 'pot_name' => 'drakx-kbd-mouse-x11', 'tx_name' => 'drakx-kbd-mouse-x11', 'git_path' => 'http://gitweb.mageia.org/software/drakx-kbd-mouse-x11/plain/po', ), array( 'pot_name' => 'drakx-net', 'tx_name' => 'drakx-net', 'git_path' => 'http://gitweb.mageia.org/software/drakx-net/plain/po', ), array( 'pot_name' => 'DrakX', 'tx_name' => 'drakx_install', 'git_path' => 'http://gitweb.mageia.org/software/drakx/plain/perl-install/install/share/po', ), array( 'pot_name' => 'libDrakX', 'tx_name' => 'drakx_share', 'git_path' => 'http://gitweb.mageia.org/software/drakx/plain/perl-install/share/po', ), array( 'pot_name' => 'libDrakX-standalone', 'tx_name' => 'drakx_standalone', 'git_path' => 'http://gitweb.mageia.org/software/drakx/plain/perl-install/standalone/po', ), array( 'pot_name' => 'indexhtml', 'tx_name' => 'indexhtml', 'git_path' => 'http://gitweb.mageia.org/software/indexhtml/plain/po', ), array( 'pot_name' => 'kde4-splash-mga', 'tx_name' => 'kde4-splash-mga', 'git_path' => 'http://gitweb.mageia.org/software/desktop/kde/splash/plain/po', ), array( 'pot_name' => 'bootloader', 'tx_name' => 'mageia-gfxboot-theme', 'git_path' => 'http://gitweb.mageia.org/software/design/bootloader-theme/plain/po', ), array( 'pot_name' => 'mageia-kde-translation', 'tx_name' => 'mageia-kde-translation', 'git_path' => 'http://gitweb.mageia.org/software/i18n/kde/plain/po', ), array( 'pot_name' => 'mageiawelcome', // 'tx_name' => 'Mageia Welcome', 'tx_name' => 'mageia-welcome', 'git_path' => 'http://gitweb.mageia.org/software/mageiawelcome/plain/po', ), array( 'pot_name' => 'mgaonline', 'tx_name' => 'mgaonline', 'git_path' => 'http://gitweb.mageia.org/software/mgaonline/plain/po', ), array( 'pot_name' => 'msec', 'tx_name' => 'msec', 'git_path' => 'http://gitweb.mageia.org/software/msec/plain/po', ), array( 'pot_name' => 'net_monitor', 'tx_name' => 'net_monitor', 'git_path' => 'http://gitweb.mageia.org/software/net_monitor/plain/po', ), array( 'pot_name' => 'rpmdrake', 'tx_name' => 'rpmdrake', 'git_path' => 'http://gitweb.mageia.org/software/rpmdrake/plain/po', ), array( 'pot_name' => 'system-config-printer', 'tx_name' => 'system-config-printer', 'git_path' => 'http://gitweb.mageia.org/software/i18n/system-config-printer/plain/po', ), array( 'pot_name' => 'transfugdrake', 'tx_name' => 'transfugdrake', 'git_path' => 'http://gitweb.mageia.org/software/transfugdrake/plain/po', ), array( 'pot_name' => 'urpmi', 'tx_name' => 'urpmi', 'git_path' => 'http://gitweb.mageia.org/software/rpm/urpmi/plain/po', ), array( 'pot_name' => 'userdrake', 'tx_name' => 'userdrake2', 'git_path' => 'http://gitweb.mageia.org/software/userdrake/plain/po', ), array( 'pot_name' => 'messages', 'tx_name' => 'identity-catdap', 'git_path' => 'http://gitweb.mageia.org/web/identity/plain/lib/CatDap/I18N', ), array( 'pot_name' => 'index', 'tx_name' => 'indexhtml_about', 'git_path' => 'http://gitweb.mageia.org/software/indexhtml/plain/about/po', ), array( 'pot_name' => 'isodumper', 'tx_name' => 'isodumper', // 'git_path' => 'https://github.com/papoteur-mga/isodumper/raw/master/po', 'git_path' => 'http://gitweb.mageia.org/software/isodumper/plain/po', ), array( 'pot_name' => 'mageiaSync_en.ts', 'tx_name' => 'mageiasync', 'git_path' => 'http://gitweb.mageia.org/qa/MageiaSync/plain/translations/', ), array( 'pot_name' => 'manatools', 'tx_name' => 'manatools', 'git_path' => 'http://gitweb.mageia.org/software/manatools/plain/po', ), ); } // get resources data from TX $tx_resources = tx_call("resources"); $details_wanted = FALSE; if (!empty($wanted_language) && !empty($wanted_resource_name)) { $details_wanted = TRUE; } if ($details_wanted) { $prefixed_resource_name = resource_name_conversion($wanted_resource_name, $wanted_category); $tx_file = tx_call("resource/$prefixed_resource_name/translation/$wanted_language/"); $tx_file_content = $tx_file['content']; $tx_file_content = explode("\n", $tx_file_content); $parsed_tx_file_content = phpmo_parse_po_file($tx_file_content, FALSE); } else { $parsed_tx_file_content = NULL; } // create separate array ($tx_resources_info) and add statistics to it from TX $tx_resources_info = array(); $tx_cauldron_resources = array(); $tx_stat_for_resource = array(); foreach ($tx_resources as $one_resource) { $tx_resource_name = $one_resource['slug']; $category = $one_resource['categories'][0]; $add_data = FALSE; if ('Cauldron' == $category) { $tx_cauldron_resources[] = $tx_resource_name; } // limit resource type to one if ($category == $resource_type) { if ('Cauldron' == $category) { // add data for Cauldron category // if name is required if (!empty($wanted_resource) && $tx_resource_name == resource_name_conversion($wanted_resource_name, $category)) { $add_data = TRUE; // if only language is required } else if (!empty($wanted_language) && empty($wanted_resource)) { $add_data = TRUE; } } else { // add data for Webpages and Documentation category if (empty($wanted_resource) && empty($wanted_language)) { $add_data = TRUE; } } // add data if details are needed if ($details_wanted && $tx_resource_name == resource_name_conversion($wanted_resource_name, $category)) { $add_data = TRUE; } } if ($add_data) { // add statistic if (empty($wanted_language)) { $tx_stat_for_resource = tx_call("resource/$tx_resource_name/stats"); } else { $tx_stat_for_resource[$wanted_language] = tx_call("resource/$tx_resource_name/stats/$wanted_language"); } $tx_resource_name = str_replace('page-', '', $tx_resource_name); // unify resource names $one_resource['tx_resource_name'] = $tx_resource_name; $one_resource['statistic'] = $tx_stat_for_resource; $tx_resources_info[$tx_resource_name] = $one_resource; } } $tx_languages = array(); if (empty($wanted_language)) { if ('Webpages' == $resource_type || 'Documentation' == $resource_type) { $tx_stat_for_resource = tx_call("resource/page-index/stats"); $tx_languages = array_keys($tx_stat_for_resource); } else { foreach ($tx_stat_for_resource as $tx_resource_language => $tx_resource_language_stat) { $tx_languages[] = $tx_resource_language; } } } else { $tx_stat_for_resource = tx_call("resource/$tx_resource_name/stats"); $tx_languages = array_keys($tx_stat_for_resource); } // create array ($report) with statistics from git $report = array(); if ('Webpages' == $resource_type) { if (empty($wanted_resource) && empty($wanted_language)) { $enFiles = array_merge(array('../_nav/langs/en.pot'), get_lang_references('*.pot')); // added navigation file $report = generating_report(get_other_langs(), $enFiles); } else { $enFiles = array($wanted_resource); $report = generating_report(array($wanted_language), $enFiles, NULL, NULL, $parsed_tx_file_content); } } else { $tx_resources_not_yet_in_git = array(); $translated_in_tx = ' translated in Transifex'; foreach ($git_resources as $git_resource_details) { $tx_name = $git_resource_details['tx_name']; if (!empty($wanted_resource) && $tx_name != $wanted_resource) { continue; } $git_path = $git_resource_details['git_path']; $pot_name = $git_resource_details['pot_name']; $raw_html_dump = file_get_contents($git_path); if (FALSE === $raw_html_dump) { $errors['file_get_contents_failed'] = "Access to $git_path failed."; } // list all po files from links within $raw_html_dump if (false !== strpos($pot_name, '_en.ts')) { // treat TS files differently $first_part_pot_name = substr($pot_name, 0, -5); // cuts 'en.ts' from mageiaSync_en.ts preg_match_all("/('>$first_part_pot_name)([a-z_A-Z0-9@-]+)(\.ts<)/", $raw_html_dump, $language_codes); } else { preg_match_all("/('>)([a-z_A-Z0-9@-]+)(\.po<)/", $raw_html_dump, $language_codes); } $git_language_codes = $language_codes[2]; if (empty($wanted_language)) { $report_language_codes = $git_language_codes; } else { if (in_array($wanted_language, $git_language_codes)) { $report_language_codes = array($wanted_language); } else { $report_language_codes = array(); $completion = $tx_resources_info[$tx_name]['statistic'][$wanted_language]['completed']; $completion .= $translated_in_tx; $translated_in_tx = ''; $tx_resources_not_yet_in_git[] = "$tx_name ($completion)"; $resources_not_yet_in_git = implode(", ", $tx_resources_not_yet_in_git); $errors['lang_not_in_git'] = "Language $wanted_lang_name is not present in git for $resources_not_yet_in_git resource."; } } $one_report = generating_report(array_values($report_language_codes), array($tx_name), $git_path, $pot_name, $parsed_tx_file_content); $report = array_merge($one_report, $report); } } // core part: building the data $tx_lang_completed_treshold = 75; // report new languages above this treshold from 0 to 100 (%) $langs_and_res_names_done = FALSE; $tx_all_languages = array(); $tx_all_langs_above_treshold = array(); $git_all_languages = array(); $tx_all_resource_names = array(); $git_all_resource_names = array(); $git_compare_resources = array(); $tx_git_difference = array(); $parse_errors = array(); $nonequal_num_of_all_strings = array(); foreach ($tx_resources_info as $tx_resource_info) { $tx_resource_name = $tx_resource_info['tx_resource_name']; if (!in_array($tx_resource_name, $tx_all_resource_names)) { $tx_all_resource_names[] = $tx_resource_name; } foreach ($tx_resource_info['statistic'] as $tx_resource_language => $tx_resource_language_stat) { $completed = sprintf("%d", $tx_resource_language_stat['completed']); if (!in_array($tx_resource_language, $tx_all_languages)) { $tx_all_languages[] = $tx_resource_language; } if ($tx_lang_completed_treshold <= $completed && 'en' != $tx_resource_language) { $tx_all_langs_above_treshold[$tx_resource_language][] = $tx_resource_name; } foreach ($report as $git_resource_info) { $git_resource_name = $git_resource_info['resource_name']; $git_compare_resource_name = str_replace('/', '-', $git_resource_name); $git_resource_language = $git_resource_info['web_language_code']; if (!$langs_and_res_names_done) { $git_all_languages[] = $git_resource_language; $git_all_resource_names[] = $git_resource_name; $git_compare_resources[] = $git_compare_resource_name; } // if names and languages match but skip English as a source language if ($tx_resource_language == $git_resource_language && 'en' != $git_resource_language && $tx_resource_name == $git_compare_resource_name) { $tx_resource_untrans_in_lang = $tx_resource_language_stat['untranslated_entities']; $tx_resource_all_strings_in_lang = $tx_resource_untrans_in_lang + $tx_resource_language_stat['translated_entities']; $git_resource_num_of_all_strings = $git_resource_info['num_of_all_strings']; $git_resource_untrans_in_lang = $git_resource_info['num_of_not_fully_trans']; $git_resource_path = $git_resource_info['webgit_path']; $git_resource_pot_name = $git_resource_info['pot_name']; $git_resource_differences = $git_resource_info['differences']; // compare l10n level or differences if ($tx_resource_untrans_in_lang != $git_resource_untrans_in_lang || count($git_resource_differences) != 0) { $tx_git_difference[$tx_resource_language][$git_resource_name]['tx_num_of_all_strings'] = $tx_resource_all_strings_in_lang; $tx_git_difference[$tx_resource_language][$git_resource_name]['tx_untranslated'] = $tx_resource_untrans_in_lang; $tx_git_difference[$tx_resource_language][$git_resource_name]['git_untranslated'] = $git_resource_untrans_in_lang; $tx_git_difference[$tx_resource_language][$git_resource_name]['webgit_path'] = $git_resource_path; $tx_git_difference[$tx_resource_language][$git_resource_name]['pot_name'] = $git_resource_pot_name; $tx_git_difference[$tx_resource_language][$git_resource_name]['differences'] = $git_resource_differences; } // it seems like a parse error if (0 == $git_resource_num_of_all_strings) { $parse_errors[$git_resource_name][] = $git_resource_language; // this below should normaly only happen inside of a tx sync window so remember it } else if ($tx_resource_all_strings_in_lang != $git_resource_num_of_all_strings) { if (!array_key_exists($git_resource_name, $nonequal_num_of_all_strings)) { $nonequal_num_text = "$git_resource_name git:$git_resource_num_of_all_strings/tx:$tx_resource_all_strings_in_lang"; $nonequal_num_of_all_strings[$git_resource_name] = $nonequal_num_text; } } } } if (!$langs_and_res_names_done) { $git_all_languages = array_unique($git_all_languages); $git_all_resource_names = array_unique($git_all_resource_names); $git_compare_resources = array_unique($git_compare_resources); $langs_and_res_names_done = TRUE; } } }; // sorting data sort($tx_all_resource_names, SORT_STRING); sort($git_all_resource_names, SORT_STRING); sort($git_compare_resources, SORT_STRING); sort($tx_all_languages); ksort($tx_all_langs_above_treshold); // sort by lang sort($git_all_languages); sort($nonequal_num_of_all_strings, SORT_STRING); $tx_all_resources_above_treshold = array(); foreach ($tx_all_langs_above_treshold as $tx_only_language => $resource_above_treshold_for_lang) { foreach ($resource_above_treshold_for_lang as $resource_above_treshold) { $tx_all_resources_above_treshold[] = $resource_above_treshold; } } $tx_all_resources_above_treshold = array_unique($tx_all_resources_above_treshold); sort($tx_all_resources_above_treshold, SORT_STRING); $tx_only_resources = array_diff($tx_all_resources_above_treshold, $git_compare_resources); $git_only_resources = array_diff($git_compare_resources, $tx_all_resource_names); $tx_only_languages = array_diff(array_keys($tx_all_langs_above_treshold), $git_all_languages); $git_only_languages = array_diff($git_all_languages, $tx_all_languages); // preparing text for languages not present yet in our git repositories $tx_only_languages_details = ''; if (0 < count($tx_only_languages)) { if (!empty($wanted_language) && !empty($wanted_resource)) { $tx_only_languages_details = "Original string | Translated string from git | And translated string from Transifex |
---|---|---|
$curr_msgid | "; $row .= "$target_l_str | "; $row .= "$compared_str |
" . implode(" | ", $row) . " |
---|---|
" . implode(" | ", $row) . " |
You can also see reports about differences in ' . implode(" or ", $links) . '.
'; $reports_links .= "For software translations please choose one of it's $num_of_tx_cauldron_resources resources ($resources_link) or one of a $num_of_tx_langs languages ($languages_link).
"; $reports_links .= 'There is a nice '; $reports_links .= 'wiki page about Transifex and git synchronising.
'; echo $reports_links . PHP_EOL; // print out any errors if (0 < count($errors)) { $error_text = 'To avoid further alienation and confusion please synchronise them.
'; echo 'They differs on number of untranslated strings in resources:
'; // print a detailed strings difference table if wanted if ($details_wanted) { echo $table_w_details . PHP_EOL; // else print table if there are only a few resources with differences otherwise print a list } else if ($table_num_diff) { echo $table_difference . PHP_EOL; } else if ($list_num_diff) { echo $list_of_lang_diff . PHP_EOL; echo 'Source code for this website is available on git.