private boolean replaceValues ( Locale locale ) { try { SortedProperties localization = getLocalization ( locale ) ; if ( hasDescriptor ( ) ) { for ( Object itemId : m_container . getItemIds ( ) ) { Item item = m_container . getItem ( itemId ) ; String key = item . getItemProperty ( TableProperty . KEY ) . getValue ( ) . toString ( ) ; Object value = localization . get ( key ) ; item . getItemProperty ( TableProperty . TRANSLATION ) . setValue ( null == value ? "" : value ) ; } } else { m_container . removeAllItems ( ) ; Set < Object > keyset = m_keyset . getKeySet ( ) ; for ( Object key : keyset ) { Object itemId = m_container . addItem ( ) ; Item item = m_container . getItem ( itemId ) ; item . getItemProperty ( TableProperty . KEY ) . setValue ( key ) ; Object value = localization . get ( key ) ; item . getItemProperty ( TableProperty . TRANSLATION ) . setValue ( null == value ? "" : value ) ; } if ( m_container . getItemIds ( ) . isEmpty ( ) ) { m_container . addItem ( ) ; } } return true ; } catch ( IOException | CmsException e ) { // The problem should typically be a problem with locking or reading the file containing the translation. // This should be reported in the editor, if false is returned here. return false ; } }
Replaces the translations in an existing container with the translations for the provided locale .