1

我正在使用以下代码片段来检索特定选项列表的选项项

           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()方法只是使用 locale 获取值en_us。那么如果我想获得其他语言环境ar_eg呢?

提前致谢。

4

1 回答 1

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;
                }               
            }
于 2014-10-08T18:32:05.217 回答