TransChat | Chat Translation Plugin

That’s unfortunate. :frowning:

I was hoping for something a little more dynamic. Looking for alternatives, but the obvious working solution until then is @Kornagan’s.

The only other way is a local dictionary converter file, word for word, or phrase by phrase.

Something like this for syntax.

I was thinking, though. Taking the following, for instance:
/lang spanish

That looks fantastic for English users. However, what if someone is entirely unfamiliar with English?

If we do the following:

public enum TransLang {
    ENGLISH("eng", "english"),
    SPANISH("esp", "espanol");

    private final List<String> possibilities;

    private TransLang(String... possibilities) {
        this.possibilities = new ArrayList<String>(Arrays.asList(possibilities));
    }

    public static TransLang getLang(String str) {
        for (TransLang lang : TransLang.values()) {
            if (lang.getPossibilities().contains(str)) {
                return lang;
            }
        }
        return null; // We'll probably end up using @Nullable or Optional, here.
    }

    public List<String> getPossibilities() {
        return this.possibilities();
    }
}

We could have any number of language identifiers to pick from, quite easily.

TransLang language = TransLang.getLang(args[1]);

EDIT: If you all wouldn’t mind my on-the-fly naming of methods. xD I chose TransLang because I feel as though Langauge is probably taken by the Java API somewhere, and I like to avoid conflicting names where possible.

2 Likes

@octoshrimpy @Kornagan Since you two seemed interested, I figured I’d inform you that I’ve decided to (attempt, at least) get this project started.

1 Like

Ohh, be nice for a translator plugin, I get lots of people who speak portages(May be spelled wrong) on my server and this would be something nice to have.

2 Likes

Any intention to continue development?

Sure thing. Just trying to find a decent API for the translations. I don’t much fancy building a library from scratch, as English is my sole language. :stuck_out_tongue:

1 Like

Oh damn, forgot this was a thing. Anyway I decided to create one since I was missing a plugin like this from my old Bukkit server.