docs: protected void updateLocaleNodeSorting() {
  
          // check if the locale nodes require sorting
          List<Locale> locales = new ArrayList<Locale>(m_locales);
          Collections.sort(locales, new Comparator<Locale>() {
  
              public int compare(Locale o1, Locale o2) {
  
                  return o1.toString().compareTo(o2.toString());
              }
          });
          List<Element> localeNodes = new ArrayList<Element>(m_document.getRootElement().elements());
          boolean sortRequired = false;
          if (localeNodes.size() != locales.size()) {
              sortRequired = true;
          } else {
              int i = 0;
              for (Element el : localeNodes) {
                  if (!locales.get(i).toString().equals(el.attributeValue("language"))) {
                      sortRequired = true;
                      break;
                  }
                  i++;
              }
          }
  
          if (sortRequired) {
              // do the actual node sorting, by removing the nodes first
              for (Element el : localeNodes) {
                  m_document.getRootElement().remove(el);
              }
  
              Collections.sort(localeNodes, new Comparator<Object>() {
  
                  public int compare(Object o1, Object o2) {
  
                      String locale1 = ((Element)o1).attributeValue("language");
                      String locale2 = ((Element)o2).attributeValue("language");
                      return locale1.compareTo(locale2);
                  }
              });
              // re-adding the nodes in alphabetical order
              for (Element el : localeNodes) {
                  m_document.getRootElement().add(el);
              }
          }
      }