2014-10-06 45 views
1

我用下面的代碼片段檢索選擇項目的具體選擇列表IBM FileNet P8的:我怎樣才能選擇列表項的本地化顯示名稱

  Map<Serializable, Serializable> items = new HashMap<Serializable, Serializable>();     
      Iterator<Choice> choiceIterator = choiceList.get_ChoiceValues().iterator(); 
      while(choiceIterator.hasNext()){ 
       Choice choice = choiceIterator.next(); 
       if(choice.get_ChoiceType() == ChoiceType.INTEGER){ 
        itemKey = choice.get_ChoiceIntegerValue(); 
       }else{ 
        itemKey = choice.get_ChoiceStringValue(); 
       } 
       items.put(itemKey, ((LocalizedStringImpl)choice.get_DisplayNames().get(0)).get_LocalizedText()); 
      } 

get_LocalizedText()方法僅僅獲得與價值區域設置en_us。那麼,如果我想獲得其他地區,例如ar_eg

在此先感謝。

回答

1

您需要調用LocalizedString對象上的get_LocaleName()方法,並確定這是否是您正在尋找的正確語言環境。這裏是示例代碼:

  LocalizedStringList lsList = choice.get_DisplayNames(); 
      Iterator<LocalizedString> dit= lsList.iterator(); 
      boolean lnFound = false; 
      while(dit.hasNext()) 
      { 
       LocalizedString ls = dit.next(); 
       String ln = ls.get_LocaleName(); 
       String lt = ls.get_LocalizedText(); 
       if(_locale.equalsIgnoreCase(ln)) 
       { 
        ls.set_LocalizedText(_value); 
        lnFound = true; 
       }    
      } 
相關問題