code: private static List<BitextRule> getAllBuiltinBitextRules(Language language,
        ResourceBundle messages) {
      List<BitextRule> rules = new ArrayList<>();
      try {
        List<Class<? extends BitextRule>> classes = BitextRule.getRelevantRules();
        for (Class class1 : classes) {
          Constructor[] constructors = class1.getConstructors();
          boolean foundConstructor = false;
          for (Constructor constructor : constructors) {
            Class[] paramTypes = constructor.getParameterTypes();
            if (paramTypes.length == 0) {
              rules.add((BitextRule) constructor.newInstance());
              foundConstructor = true;
              break;
            }
            if (paramTypes.length == 1
                && paramTypes[0].equals(ResourceBundle.class)) {
              rules.add((BitextRule) constructor.newInstance(messages));
              foundConstructor = true;
              break;
            }
            if (paramTypes.length == 2
                && paramTypes[0].equals(ResourceBundle.class)
                && paramTypes[1].equals(Language.class)) {
              rules.add((BitextRule) constructor.newInstance(messages, language));
              foundConstructor = true;
              break;
            }
          }
          if (!foundConstructor) {
            throw new RuntimeException("Unknown constructor type for rule class " + class1.getName()
                    + ", it supports only these constructors: " + Arrays.toString(constructors));
          }
        }
      } catch (Exception e) {
        throw new RuntimeException("Failed to load bitext rules", e);
      }
      return rules;
    }
docs: Use reflection to add bitext rules.