Standalone Example

You can either use this by implementing the interfaces in lang-core itself or using the lang-simple artifact which will use properties files.

Maven Artifact

snippet.xml
<dependency>
    <groupId>de.themoep.utils</groupId>
    <artifactId>lang-simple</artifactId>
    <version>check-for-latest</version>
    <scope>compile</scope>
</dependency>

Example

snippet.java
public class MyProgram implements Languaged {
    private final Logger logger;
    private final File dataFolder;
    private LanguageManager lang;
 
    public static void main(String[] args) {
        this.logger = logger;
        this.dataFolder = dataFolder.toFile();
 
        # Load LanguageManager. Either call that in onEnable or your config loading method.
        # Will automatically save and load any lang.<locale>.properties configs in the languages folder
        # Gets and saves language files to the folder "languages".
        # Default locale is "en"
        lang = new LanguageManager(this, "languages", "en");
 
        # Set the provider for the language of a certain sender.
        # This provider will use the system locale for all users
        lang.setProvider(user -> Locale.getDefault().getLanguage());
        # If you do not set a provider then it will use the default locale.
    }
 
    @Override
    public String getName() {
        return getClass().getAnnotation(Plugin.class).name();
    }
 
    @Override
    public File getDataFolder() {
        return dataFolder;
    }
 
    @Override
    public Logger getLogger() {
        return logger;
    }
 
    /**
     * Get a message from a language config for a certain sender
     * @param sender        The sender to get the string for. (Language is based on this)
     *                      This object needs to implement Languaged.User
     * @param key           The language key in the config
     * @param replacements  An option array for replacements.
     *                (2n)-th will be the placeholder, (2n+1)-th the value. 
     *                Placeholders have to be surrounded by percentage signs: %placeholder%
     * @return The string from the config which matches the sender's language (or the default one) with the replacements replaced (or an error message, never null)
     */
    public String getMessage(Languaged.User sender, String key, String... replacements) {
        return lang.getConfig(sender).get(key, replacements);
    }
}