Changeset 30581
- Timestamp:
- 2016-06-17T19:59:44+12:00 (7 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gti.pl
r30562 r30581 103 103 'source_file' => "greenstone3", 104 104 'target_file' => "greenstone3" 105 }, 106 107 # collection config display items of GS3 demo collections. Checked out as gs3-collection-configs 108 # from http://svn.greenstone.org/main/trunk/gs3-collection-configs 109 { 'key' => "gs3colcfg", 110 'file_type' => "resource_bundle", 111 'source_file' => "gs3-collection-configs", 112 'target_file' => "gs3-collection-configs" 105 113 } 106 114 ]; 115 116 my @gs3_col_cfg_files = ("lucene-jdbm-demo", "solr-jdbm-demo"); 107 117 108 118 my @gs3_interface_files = ("interface_default", "ServiceRack", "metadata_names"); … … 148 158 if ($gti_command =~ /^get-all-chunks$/i) { 149 159 # Check that GS3 interface is the target 150 if ($module eq "gs3interface" ) {160 if ($module eq "gs3interface" || $module eq "gs3colcfg") { 151 161 print &get_all_chunks_for_gs3(@gti_command_arguments); 152 162 } else { … … 155 165 } 156 166 elsif ($gti_command =~ /^get-first-n-chunks-requiring-work$/i) { 157 if ($module eq "gs3interface" ) {167 if ($module eq "gs3interface" || $module eq "gs3colcfg") { 158 168 print &get_first_n_chunks_requiring_work_for_gs3(@gti_command_arguments); 159 169 } else { … … 162 172 } 163 173 elsif ($gti_command =~ /^get-uptodate-chunks$/i) { 164 if ($module eq "gs3interface" ) {174 if ($module eq "gs3interface" || $module eq "gs3colcfg") { 165 175 print &get_uptodate_chunks_for_gs3(@gti_command_arguments); 166 176 } else { … … 397 407 my $target_file_name = ""; 398 408 399 if ($translation_file->{'key'} eq "gs3interface" ) {409 if ($translation_file->{'key'} eq "gs3interface" || $translation_file->{'key'} eq "gs3colcfg") { 400 410 my (%source_file_key_to_text_mapping, %target_file_key_to_text_mapping, %source_file_key_to_last_update_date_mapping, %target_file_key_to_last_update_date_mapping ) = (); 401 &build_gs3_configuration($t arget_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, \%source_file_key_to_last_update_date_mapping, \%target_file_key_to_last_update_date_mapping );411 &build_gs3_configuration($translation_file->{'key'}, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, \%source_file_key_to_last_update_date_mapping, \%target_file_key_to_last_update_date_mapping ); 402 412 403 413 my @target_file_keys_requiring_translation = &determine_chunks_requiring_translation(\%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping); … … 491 501 492 502 493 if ($translation_file_key ne "gs3interface" ) {503 if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") { 494 504 # Get (and check) the translation configuration 495 505 ($source_file, $target_file, $translation_file_type) = &get_translation_configuration($target_language_code, $translation_file_key); … … 518 528 # Not needed in this case 519 529 my (%source_file_key_to_gti_command_mapping, %target_file_key_to_gti_command_mapping) = (); 520 &build_gs3_configuration($t arget_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping,530 &build_gs3_configuration($translation_file_key, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, 521 531 \%source_file_key_to_gti_command_mapping, \%target_file_key_to_gti_command_mapping, 1); 522 532 } … … 580 590 581 591 582 if ($translation_file_key ne "gs3interface" ) {592 if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") { 583 593 # Get (and check) the translation configuration 584 594 ($source_file, $target_file, $translation_file_type) … … 597 607 } 598 608 else { 599 &build_gs3_configuration($t arget_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping,609 &build_gs3_configuration($translation_file_key, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, 600 610 \%source_file_key_to_gti_comment_mapping, \%target_file_key_to_gti_comment_mapping, 1); 601 611 } … … 700 710 } 701 711 702 if ($translation_file_key ne "gs3interface" ) {712 if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") { 703 713 eval "&write_translated_${translation_file_type}(\$source_file, \\\@source_file_lines, \\\%source_file_key_to_text_mapping, \$target_file, \\\@target_file_lines, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)"; 704 714 } else { 705 eval "&write_translated_gs3interface(\ \\%source_file_key_to_text_mapping, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)";715 eval "&write_translated_gs3interface(\$translation_file_key, \\\%source_file_key_to_text_mapping, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)"; 706 716 } 707 717 } … … 1873 1883 my %target_files_key_to_last_update_date_mapping = (); 1874 1884 1875 &build_gs3_configuration($t arget_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);1885 &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping); 1876 1886 1877 1887 &log_message("Total number of source chunks: " . scalar(keys(%source_files_key_to_text_mapping))); … … 1902 1912 my %target_files_key_to_last_update_date_mapping = (); 1903 1913 1904 &build_gs3_configuration($t arget_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping,1914 &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 1905 1915 \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping); 1906 1916 … … 1925 1935 # will generate a tar file containing a folder called "greenstone3" with the specified *.properties files 1926 1936 1927 my $sourcedir = "greenstone3";1928 1937 my $zip = &FileUtils::filenameConcatenate("tmp", "gs3interface_".$target_language_code.".tar.gz"); 1929 1938 my $tar_cmd = "tar -cvzf $zip"; … … 1934 1943 chdir $gsdl_root_directory; 1935 1944 1936 my $filelisting = ""; 1937 foreach my $interface_file (@gs3_interface_files) { 1945 $tar_cmd .= " " . &get_gs3_zip_file_listing($target_language_code, "greenstone3", \@gs3_interface_files); 1946 $tar_cmd .= " " . &get_gs3_zip_file_listing($target_language_code, "gs3-collection-configs", \@gs3_col_cfg_files); 1947 1948 # tar command will overwrite the previous version, but want to check we've created it 1949 if(&FileUtils::fileExists($zip)) { 1950 &FileUtils::removeFiles($zip); 1951 } 1952 1953 #my $tar_result = system($tar_cmd); # works but then interface breaks 1954 `$tar_cmd`; 1955 my $tar_result = $?; 1956 1957 if(&FileUtils::fileExists($zip)) { ## if($tar_result == 0) {, # breaks the interface 1958 $download_target_filepath = $zip; 1959 } else { 1960 &log_message("Unable to generate zip containing gs3interface files " . $download_target_filepath . "$!"); 1961 } 1962 1963 # change back to original working directory (cgi-bin/linux probably) 1964 chdir $curdir; 1965 1966 # ************** END RUDIMENTARY VERSION OF DOWNLOADING LANGUAGE FILES FOR GS3 ************* # 1967 1968 1969 my $xml_response = &create_xml_response_for_chunks_requiring_work($translation_file_key, $download_target_filepath, scalar(keys(%source_files_key_to_text_mapping)), 1970 \@target_files_keys_requiring_translation, \@target_files_keys_requiring_updating, 1971 $num_chunks_to_return, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 1972 \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping); 1973 1974 return $xml_response; 1975 } 1976 1977 # helper function 1978 # gets the listing of gs3 files for a gs3 interface module (gs3interface, gs3colcfg) 1979 # formatted correctly to go into a zip file 1980 sub get_gs3_zip_file_listing 1981 { 1982 my $target_language_code = shift(@_); 1983 my $sourcedir = shift(@_); 1984 my $files_array = shift(@_); # reference to an array of the interfaces files for the gs3 module 1985 1986 my $filelisting = ""; 1987 foreach my $interface_file (@$files_array) { 1938 1988 1939 1989 my $source_filepath = &FileUtils::filenameConcatenate($sourcedir, $interface_file.".properties"); … … 1945 1995 } 1946 1996 } 1947 $tar_cmd .= " $filelisting"; 1948 1949 # tar command will overwrite the previous version, but want to check we've created it 1950 if(&FileUtils::fileExists($zip)) { 1951 &FileUtils::removeFiles($zip); 1952 } 1953 1954 #my $tar_result = system($tar_cmd); # works but then interface breaks 1955 `$tar_cmd`; 1956 my $tar_result = $?; 1957 1958 if(&FileUtils::fileExists($zip)) { ## if($tar_result == 0) {, # breaks the interface 1959 $download_target_filepath = $zip; 1960 } else { 1961 &log_message("Unable to generate zip containing gs3interface files " . $download_target_filepath . "$!"); 1962 } 1963 1964 # change back to original working directory (cgi-bin/linux probably) 1965 chdir $curdir; 1966 1967 # ************** END RUDIMENTARY VERSION OF DOWNLOADING LANGUAGE FILES FOR GS3 ************* # 1968 1969 1970 my $xml_response = &create_xml_response_for_chunks_requiring_work($translation_file_key, $download_target_filepath, scalar(keys(%source_files_key_to_text_mapping)), 1971 \@target_files_keys_requiring_translation, \@target_files_keys_requiring_updating, 1972 $num_chunks_to_return, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 1973 \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping); 1974 1975 return $xml_response; 1997 1998 return $filelisting; 1976 1999 } 1977 2000 … … 1995 2018 my %target_files_key_to_last_update_date_mapping = (); 1996 2019 1997 &build_gs3_configuration($t arget_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping,2020 &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 1998 2021 \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping); 1999 2022 … … 2022 2045 sub build_gs3_configuration 2023 2046 { 2024 my ($t arget_language_code, $source_files_key_to_text_mapping, $target_files_key_to_text_mapping,2047 my ($translation_file_key, $target_language_code, $source_files_key_to_text_mapping, $target_files_key_to_text_mapping, 2025 2048 $source_files_key_to_gti_comment_or_last_updated_mapping, $target_files_key_to_gti_comment_or_last_updated_mapping, $get_gti_comments_not_last_updated) = @_; 2026 2049 2027 2050 my $source_file_directory = "greenstone3"; # my $source_file_directory = &util::filename_cat("WEB-INF","classes"); 2051 my $files_array = \@gs3_interface_files; 2052 2053 if($translation_file_key eq "gs3colcfg") { 2054 $source_file_directory = "gs3-collection-configs"; 2055 $files_array = \@gs3_col_cfg_files; 2056 } 2028 2057 my $translation_file_type = "resource_bundle"; 2029 2058 2030 foreach my $interface_file_key (@ gs3_interface_files) {2059 foreach my $interface_file_key (@$files_array) { 2031 2060 2032 2061 &log_message("Greenstone 3 interface file: " . $interface_file_key); … … 2087 2116 sub write_translated_gs3interface 2088 2117 { 2118 my $translation_file_key = shift(@_); 2089 2119 my $source_file_key_to_text_mapping = shift(@_); 2090 2120 my $target_file_key_to_text_mapping = shift(@_); … … 2105 2135 2106 2136 my $source_file_directory = "greenstone3"; 2107 2137 $source_file_directory = "gs3-collection-configs" if $translation_file_key eq "gs3colcfg"; 2138 2108 2139 foreach my $interface_file_key (keys(%translated_interface_file_keys)) { 2109 2140 -
main/trunk/greenstone2/macros/gti.dm
r29416 r30581 191 191 _gtiviewgs3interfaceinaction_ {It is not possible to view translations of the GS3 interface in action in a GS2 installation.} 192 192 193 _gtiviewgs3colcfginaction_ {It is not possible to view translations of the GS3 demo collections' config strings in action in a GS2 installation.} 194 193 195 _gtiglihelpzipfilepath_ {} 194 196 -
other-projects/gti/translation_status.sh
r29832 r30581 14 14 fi 15 15 16 filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties" "greenstone3/*.properties" "g reenstoneorg/website/classes/Gsc*.properties")16 filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties" "greenstone3/*.properties" "gs3-collection-configs/*.properties" "greenstoneorg/website/classes/Gsc*.properties") 17 17 18 18 date=`date +"%d-%m-%y"`
Note:
See TracChangeset
for help on using the changeset viewer.