Changeset 33771 for main


Ignore:
Timestamp:
2019-12-09T11:33:34+13:00 (4 years ago)
Author:
kjdon
Message:

use the new Dictionary.getTExtSTring instead of repeating all the code here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r32549 r33771  
    226226    }
    227227
    228     protected String getTextString(String key, String lang, String dictionary, String[] args)
    229     {
    230       logger.error("lang = "+lang);
    231         if (dictionary != null)
    232         {
    233             // just try the one specified dictionary
    234           Dictionary dict = new Dictionary(dictionary, lang);
    235             String result = dict.get(key, args);
    236             if (result == null)
    237             { // not found
    238                 return "_" + key + "_";
    239             }
    240             return result;
    241         }
    242 
    243         // otherwise we try class names for dictionary names
    244         String class_name = this.getClass().getName();
    245         class_name = class_name.substring(class_name.lastIndexOf('.') + 1);
    246         Dictionary dict = new Dictionary(class_name, lang);
    247         String result = dict.get(key, args);
    248         if (result != null)
    249         {
    250             return result;
    251         }
    252 
    253         // we have to try super classes
    254         Class c = this.getClass().getSuperclass();
    255         while (result == null && c != null)
    256         {
    257             class_name = c.getName();
    258             class_name = class_name.substring(class_name.lastIndexOf('.') + 1);
    259             if (class_name.equals("ServiceRack"))
    260             {
    261                 // this is as far as we go
    262                 break;
    263             }
    264             dict = new Dictionary(class_name, lang);
    265             result = dict.get(key, args);
    266             c = c.getSuperclass();
    267         }
    268         if (result == null)
    269         {
    270             return "_" + key + "_";
    271         }
    272         return result;
    273 
     228    protected String getTextString(String key, String lang, String[] args)
     229    {
     230        return Dictionary.getTextString(key, lang, args, null, null, null, null);
    274231    }
    275232
Note: See TracChangeset for help on using the changeset viewer.