1

I am using the following code snippet to retrieve choice items for a specific choice list

           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());
            }

but get_LocalizedText() method just get the value with locale en_us. So what if i want to get other locales i.e ar_eg?

Thanks in advance.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
aomar
  • 500
  • 1
  • 6
  • 23

1 Answers1

1

You need to call get_LocaleName() method on the LocalizedString object and find out if this is the right locale you are looking for. Here is sample code:

            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;
                }               
            }
P777
  • 26
  • 1