Skip to content

Configuring I18N

BlackyPaw edited this page Aug 1, 2016 · 1 revision

Configuration

Some parts of I18N can be configured and will be explained below. Note, that I18N uses SimpleConfig (see https://github.com/BlackyPaw/SimpleConfig) for its configuration files instead of YAML. The SimpleConfig format is in some ways less restrictive than the YAML format so it might be easier for you to edit.

Parameter Description
fallbackLocale The fallback locale to use for players whose locale could not be resolved (language code only)
useFallbackLocale Whether or not failed translation attempts should be re-attempted using the fallback locale configured above
allowUserTranslations If set to true the localizer used by this plugin itself will be allowed to lazy load user translations inside the translations folder
useNativeLanguageNames If set to true the native names of languages will be displayed. If set to false their english names will be displayed instead
defaultLocaleResolver The locale resolver to be used per default unless another plugin changes it programmatically (CONSTANT or DATABASE)
dbHost For use with DATABASE locale resolver: Hostname of MySQL instance
dbPort For use with DATABASE locale resolver: Port of MySQL instance
dbUser For use with DATABASE locale resolver: Username for MySQL authentication
dbPassword For use with DATABASE locale resolver: Password for MySQL authentication
dbName For use with DATABASE locale resolver: Name of Database for MySQL instance
dbPrefix For use with DATABASE locale resolver: Name prefix for MySQL tables

Locale Resolvers

Unless you have installed a plugin that changes I18N's internal locale resolver programatically you can configure the locale resolver you wish to use yourself. Locale resolvers provide a way of resolving and / or updating the preferred language of any player. Per default you can use the following constants for the defaultLocaleResolver field inside I18N's configuration:

  • CONSTANT - The fallback locale will be returned for each and every player
  • DATABASE - Requires a MySQL database. Stores the preferred language of players inside a MySQL database. Might be slow.

Commands

I18N adds a single command to your server which is the /language command. If no arguments are given it will display your current preferred language. If you specify an ISO639 language code as the command's sole argument (e.g. en, de, fr, es, ...) it will try to change your preferred language. You will be notified of the attempt's result in your chat afterwards. In case you would like to control access to the /language command you may make use of the following permission: com.blackypaw.mc.i18n.command.language