Search in sources :

Example 1 with IGherkinDialectProvider

use of io.cucumber.gherkin.IGherkinDialectProvider in project cucumber-jvm by cucumber.

the class CommandlineOptionsParser method printI18n.

private byte printI18n(String language) {
    IGherkinDialectProvider dialectProvider = new GherkinDialectProvider();
    List<String> languages = dialectProvider.getLanguages();
    if (language.equalsIgnoreCase("help")) {
        if (language.equalsIgnoreCase("help")) {
            List<GherkinDialect> dialects = new ArrayList<>();
            for (String code : languages) {
                GherkinDialect dialect = dialectProvider.getDialect(code, null);
                dialects.add(dialect);
            }
            int widestLanguage = findWidest(dialects, GherkinDialect::getLanguage);
            int widestName = findWidest(dialects, GherkinDialect::getName);
            int widestNativeName = findWidest(dialects, GherkinDialect::getNativeName);
            for (GherkinDialect dialect : dialects) {
                printDialect(dialect, widestLanguage, widestName, widestNativeName);
            }
            return 0x0;
        }
    }
    if (languages.contains(language)) {
        return printKeywordsFor(dialectProvider.getDialect(language, null));
    }
    out.println("Unrecognised ISO language code");
    return 0x1;
}
Also used : ArrayList(java.util.ArrayList) IGherkinDialectProvider(io.cucumber.gherkin.IGherkinDialectProvider) GherkinDialectProvider(io.cucumber.gherkin.GherkinDialectProvider) IGherkinDialectProvider(io.cucumber.gherkin.IGherkinDialectProvider) GherkinDialect(io.cucumber.gherkin.GherkinDialect)

Aggregations

GherkinDialect (io.cucumber.gherkin.GherkinDialect)1 GherkinDialectProvider (io.cucumber.gherkin.GherkinDialectProvider)1 IGherkinDialectProvider (io.cucumber.gherkin.IGherkinDialectProvider)1 ArrayList (java.util.ArrayList)1