Ignore:
Timestamp:
2023-09-18T14:44:54+12:00 (8 months ago)
Author:
kjdon
Message:

when looking for interface files, in the web/interfaces/xxx/resources folder, we need to remove teh 2 from the name, if its there, eg interface_hnz2.properties will be found in web/interfaces/hnz/resources. also I think we had the list to look through in reverse order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r38004 r38153  
    255255    public static String getInterfaceText(String interface_name, String dictionary_name, String lang, String key, String args_str)
    256256    {
    257           // now we allow looking for files in the interface's resources folder
    258           CustomClassLoader my_loader = new CustomClassLoader(XSLTUtil.class.getClassLoader(), GSFile.interfaceResourceDir(GlobalProperties.getGSDL3Home(), interface_name));
    259                 String[] args = null;
     257        String i_name = interface_name;
     258        if (i_name.endsWith("2")) {
     259        i_name = i_name.substring(0, i_name.length()-1);
     260        }
     261        // now we allow looking for files in the interface's resources folder
     262          CustomClassLoader my_loader = new CustomClassLoader(XSLTUtil.class.getClassLoader(), GSFile.interfaceResourceDir(GlobalProperties.getGSDL3Home(), i_name));
     263
     264      String[] args = null;
    260265        if (args_str != null && !args_str.equals(""))
    261266        {
     
    266271                String result = Dictionary.createDictionaryAndGetString(dictionary_name, my_loader, key, lang, args);
    267272        if (result == null) {
     273
    268274          // fall back to a general interface text search
    269275          return getInterfaceTextWithArgs(interface_name, lang, key, args);
     
    305311  {
    306312    // now we allow looking for files in the interface's resources folder
    307     CustomClassLoader my_loader = new CustomClassLoader(XSLTUtil.class.getClassLoader(), GSFile.interfaceResourceDir(GlobalProperties.getGSDL3Home(), interface_name));
     313      String i_name = interface_name;
     314      if (i_name.endsWith("2")) {
     315      i_name = i_name.substring(0, i_name.length()-1);
     316      }
     317      CustomClassLoader my_loader = new CustomClassLoader(XSLTUtil.class.getClassLoader(), GSFile.interfaceResourceDir(GlobalProperties.getGSDL3Home(), i_name));
    308318    String result = Dictionary.createDictionaryAndGetString("interface_"+interface_name, my_loader, key, lang, args);
    309319    if (result == null)
    310       { 
     320      {
    311321    //if not found, search a separate subdirectory named by the interface name. this is used for eg the flax interface. this could be replaced by new class loader option?
    312322    String sep_interface_dir = interface_name + File.separatorChar + lang + File.separatorChar + "interface";
     
    889899        // The dictionaries to pull keys from
    890900        String[] dictionaries = new String[] {
    891             "interface_" + interfaceName,
    892901            "interface_default",
    893             "interface_default2"
     902            "interface_default2",
     903            "interface_" + interfaceName
     904
    894905        };
    895906
Note: See TracChangeset for help on using the changeset viewer.