LocaleAPI - Locale API for Sponge plugins

This is a discussion topic for the Ore project, LocaleAPI. View the full project on Ore for downloads and more information.


LocaleAPI Codacy Badge

What is it for? Developers using this API can provide the ability to
simultaneously use multiple languages.
For example. On your server there are players from different countries
and they understand only their language. If there is a localization file
in which there will be messages corresponding to the client language
chosen by them, they will see the messages of your plugin in that
language.

For server admin:

All localization files are saved in the following path, where “pluginid”
is the directory for the localization files of a particular plugin.
./{ConfigDir}/localeapi/{pluginid}/[LocaleFiles]
This only applies to plugins that use LocaleAPI.
You can add translation files you need to the plugin localization
directory. When you add a localization file, it will be downloaded automatically. If you make changes to existing files, they will also be automatically reloaded. The load/reload operation cannot be performed more than once every 10 seconds(API8-10). This time limit has been added to eliminate the possibility of server performance degradation.

For developers:

The localization file name must be in the format en-US, ru-RU, etc.
Select the file type depending on which configuration you prefer to
choose.
For the correct work of the plugin is necessary to generate a default localization file - en-US.

A new version has been released for LocaleAPI, it is available for download here.


Version for API7.
Further development of this version has been discontinued.

A new version has been released for LocaleAPI, it is available for download here.


Version for API8.
API has become easier.
Now there will be tracking changes in localization files.
Localization by default is now always en-US.
Added the ability to serialize ItemStack. For configuration files, you must specify options that can also be obtained from this plugin. Localization files already use these options.
Changed the way to get API for localizations. Now events are used. The old way is marked as deprecated.

Great work!it is very elegant and useful.

1 Like

A new version has been released for LocaleAPI, it is available for download here.


Adding functionality to the SerializedItemStack class.
Addition of localization creation/reloading events.
Adding text replacement functionality.
Fixed localizations tracking in json files.

A new version has been released for LocaleAPI, it is available for download here.


Added TextUtils class

A new version has been released for LocaleAPI, it is available for download here.


During the previous plugin update, the wrong file was loaded on ORE by mistake.

A new version has been released for LocaleAPI, it is available for download here.


Various fixes and improvements to the API.

A new version has been released for LocaleAPI, it is available for download here.


Fixed stopping the tracking of changes in localization files when the server is shut down. Now the stop is correct.

A new version has been released for LocaleAPI, it is available for download here.


Added DataContainer serializer.

A new version has been released for LocaleAPI, it is available for download here.


1.19.4+ !!!

Java 17 is used.
Update to SpongeAPI10.
Improved plugin and text processing API.
Changed text record in json format. Now it has expanded view instead of single line view.
Added serializers for ItemStack and JsonObject classes.

A new version has been released for LocaleAPI, it is available for download here.


Added the ability to use ValueReference.

Now it is possible to assign serializable classes to localizations.
This functionality should simplify the use of localizations, as well as slightly improve performance when getting objects of type Component, because it will not be necessary to deserialize it from the configuration every time.
The new functionality applies only to file formats supported by Sponge.

A new version has been released for LocaleAPI, it is available for download here.


Implemented 2 new ways to change NBT tags of items.
Added implementation of placeholders.
Improved JsonObject serialization.
Minor fixes.

A new version has been released for LocaleAPI, it is available for download here.


Upgrade to SpongeAPI 11.

  • The API for writing tags to items has been replaced by an API for writing components. Backward compatibility is not - guaranteed.
  • Added annotation to localize comments in the configuration.
  • Added annotation to localize comments in the main plugin configuration.
  • The placeholder API has been improved.
  • Added default placeholders.

A new version has been released for LocaleAPI, it is available for download here.


API12


  • Added logger creation with conversion of Minecraft/RGB/Hex colors to ANSI format.
  • If the serializable class has been changed, when it is saved again, the new elements will be scanned and added to the config.
  • The automatic reloading of localizations has been redesigned.

Due to ORE restrictions on the number of colors for tags possible when publishing a new version of the plugin, all new versions will be published with one of two tags - Release or UNSTABLE.

A new version has been released for LocaleAPI, it is available for download here.


  • The performance of tracking changes to files has been significantly improved. The file tracking code has been completely replaced.
  • The plugin no longer causes the server to hang on shutdown.

A new version has been released for LocaleAPI, it is available for download here.


  • Localization file events have been returned.

aw ivan, i was about to develop the same thing.

A new version has been released for LocaleAPI, it is available for download here.


Redesigned the API. It should be more convenient now.
An API has been added to simplify working with plugin configurations. It will be redesigned in the future for more convenience.
Support for '.properties` files has been removed. It may be returned in the future, but that’s not for sure.

A new version has been released for LocaleAPI, it is available for download here.


  • The plugin’s API has been improved for greater convenience when working with it.
  • Previously, the plugin could only work with Hocon, Json, and Yml. The plugin can now work with the following list of configuration file loaders:
  1. Hocon - Standard Sponge configuration. Has some similarities with Json. Supports comments.
  2. Json - Alternative configuration format. Classic Json. Does not support comments.
  3. Yaml - An alternative Sponge configuration format that uses a block structure and is easy to read. Currently, it does not support comments, but this may be fixed in the future by the Sponge team.
  4. GeyserYaml - An alternative Sponge configuration format that uses a block structure and is easy to read. It supports comments. Support for this loader is experimental.
  5. Jackson - An alternative Sponge configuration format in json format that does not support comments.
  6. XML - An alternative Sponge configuration view that supports comments but is not easy to read.
  7. Toml - Using the LocaleAPI-generated Toml format configuration loader. Easy to read. Supports comments. It is not recommended for localizations, as errors may occur during subsequent conversion from it to any other format due to the incompatibility of Toml with the json data format.

  • The server administrator will now be able to override the configuration type used for other plugins that depend on the LocaleAPI. The change can be global or applicable to a specific plugin.
  • Now the server administrator will be able to change the directory for saving localization files.