code: private int detectColumnIndexOfLocale(String locale, CSVReader csvReader) throws Exception {
          int indexOfLocale = -1;
          List<String> headerLine = Arrays.asList(ArrayUtils.nullToEmpty(csvReader.readNext()));
  
          if (headerLine == null || headerLine.isEmpty()) {
              throw new Exception("CSV locale file seems to be empty.");
          }
  
          if (headerLine.size() < 3) {
              // we expect at least three columns: component;field;locale1
              throw new Exception("CSV locale file is invalid: Not enough columns.");
          }
  
          // start with the third column as the first two columns must not be a
          // locale column
          for (int i = 2; i < headerLine.size(); i++) {
              String columnName = headerLine.get(i);
              if (locale.equalsIgnoreCase(columnName)) {
                  indexOfLocale = headerLine.indexOf(columnName);
                  break;
              }
          }
          if (indexOfLocale < 0) {
              throw new Exception("Could not find locale " + locale + " in CSV file");
          }
          return indexOfLocale;
      }
docs: Extracts the column index of the given locale in the CSV file.
  
  @param locale
  @param csvReader
  @return
  @throws IOException
  @throws Exception