Search code examples
filenet-p8filenetfilenet-content-engine

IBM Filenet P8 : How can i get the localized display names of choice list items


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.


Solution

  • 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;
                    }               
                }