Changeset 37908 for main


Ignore:
Timestamp:
2023-08-09T17:34:57+12:00 (11 months ago)
Author:
anupama
Message:

Improvement to previous commit. Now the create_glihelp_zip_file is only explicitly called if the glihelp/langcode folder doesn't exist. That function is quite long, so to avoid running through it every time the submit button is called seemed wasteful, so I'm first quickly checking if, when the module is glihelp, the necessary glihelp/langcode folder doesn't already exist. Previous commit message: Tigran Zargaryan noticed an Internal Server Error ,message when trying to use the GTI to translate the glihelp module. The problem was that this module was never yet translated into Armenian and the module for the language had not been initialised, missing the necessary folders and starting files. The quick code-less fix was to press the Download File link in GTI for this module, above the translation boxes. This will initialise the glihelp module for a new language, so that submissions would go through. But this commit ensures the initialisation is done when necessary for glihelp on pressing the submit button. The function create_glihelp_zip_file is now always called on submit if the module is glihelp, as this function already would check if the necessary folders existed or, if not, ensure they do.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/gti.pl

    r37907 r37908  
    167167
    168168    # For the first translation of glihelp into a new language, glihelp folders need to be
    169     # initialised. The folders & files are not yet present on submit, so do this then:
     169    # initialised. The folders & files are not yet present on submit press, so do this then:
    170170    if($gti_command =~ /^submit-translations$/i && $module && $module eq "glihelp") {
    171     &create_glihelp_zip_file(@gti_command_arguments);
     171    my $langcode = shift(@_);
     172    my $target_language_code = lc($langcode);
     173    unshift(@_, $langcode); # put it back into args list
     174   
     175    my $glihelp_lang_dir = &util::filename_cat($gsdl_root_directory, "gli", "help",$target_language_code);
     176   
     177    if(!&FileUtils::directoryExists($glihelp_lang_dir)) {
     178        # This command cannot produce any output since it reads input
     179        &create_glihelp_zip_file(@gti_command_arguments);
     180    }
     181    #&log_message("@@@ Got cmd: $gti_command");
    172182    }
    173183   
Note: See TracChangeset for help on using the changeset viewer.