1 17 package org.alfresco.repo.dictionary; 18 19 import java.util.Locale ; 20 21 import org.alfresco.i18n.I18NUtil; 22 import org.alfresco.service.cmr.dictionary.ModelDefinition; 23 import org.alfresco.service.namespace.QName; 24 import org.springframework.util.StringUtils; 25 26 27 32 public class M2Label 33 { 34 35 45 public static String getLabel(Locale locale, ModelDefinition model, String type, QName item, String label) 46 { 47 String key = model.getName().toPrefixString(); 48 if (type != null) 49 { 50 key += "." + type; 51 } 52 if (item != null) 53 { 54 key += "." + item.toPrefixString(); 55 } 56 key += "." + label; 57 key = StringUtils.replace(key, ":", "_"); 58 return I18NUtil.getMessage(key, locale); 59 } 60 61 70 public static String getLabel(ModelDefinition model, String type, QName item, String label) 71 { 72 return getLabel(I18NUtil.getLocale(), model, type, item, label); 73 } 74 75 } 76 | Popular Tags |