From e1244544c68141b24d5409aee36ea74e3f08fa8f Mon Sep 17 00:00:00 2001 From: filip Date: Fri, 19 Mar 2021 13:52:40 +0100 Subject: add testing for new resources & adding 10 of them + some bugfixes - GitHub resources are now also supported --- langs/report_tx_git.php | 73 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 19 deletions(-) (limited to 'langs/report_tx_git.php') diff --git a/langs/report_tx_git.php b/langs/report_tx_git.php index 30b8ecefb..d06369df6 100644 --- a/langs/report_tx_git.php +++ b/langs/report_tx_git.php @@ -32,6 +32,9 @@

Languages translation progress report for web pages is available here.

$first_part_pot_name)([a-z_A-Z0-9@-]+)(\.ts<)/", $raw_html_dump, $language_codes); + if (isset($git_resource_details['github_path'])) { // treat resources on GitHub differently + $github_raw_path = $git_resource_details['github_path']; + $github_raw_html_dump = file_get_contents($github_raw_path); + preg_match_all('/\"(\w*)\.po\"/m', $github_raw_html_dump, $language_codes); + $git_language_codes = $language_codes[1]; } else { - preg_match_all("/('>)([a-z_A-Z0-9@-]+)(\.po<)/", $raw_html_dump, $language_codes); + $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([a-z_A-Z0-9@-]+)\.poYou 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 .= "

For software translations please choose one of it's $num_of_tx_cauldron_resources resources ($resources_link) or "; +$reports_links .= "one of a $num_of_tx_langs languages ($languages_link) currently present in Transifex.

"; $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 = '

There seems to be some errors during processing this time :(

'; + $error_text = '

There seems to be some errors, warnings or notices during processing this time :(

'; $error_text .= '