Skip to content

Releases: newlandpe/libLanguage

v0.1.1

05 Feb 18:50
e28a08d

Choose a tag to compare

libLanguage v0.1.1

This release enhances the library with improved locale handling, JSON support, and better documentation.

What's New

  • Locale Validation Refactor: Replaced regex-based locale validation with a predefined list of supported locales for better accuracy and performance.
  • JSON Support: LanguageLoader now supports .json files in addition to YAML.
  • Documentation Improvements: Updated README with new LanguageLoader features and API enhancements.
  • Predefined Locales: Built-in support for 25+ common locales without regex overhead.

Installation

Update your .poggit.yml to use the new version:

libs:
  - src: newlandpe/libLanguage/libLanguage
    version: ^0.1.1

License

This library remains licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).

v0.1.0

04 Feb 15:43
2587dda

Choose a tag to compare

libLanguage v0.1.0

This release introduces a complete architectural rewrite to better support PocketMine-MP virion shading and modern development workflows. The "Global Hub" pattern has been replaced with a more robust, per-plugin isolated approach.

Key Changes

  • Architectural Rewrite: Removed LanguageHub and global singleton patterns. This ensures that when the virion is shaded into multiple plugins, each maintains its own isolated and functional translation state.
  • Refined API: The PluginTranslator is now the primary, self-contained entry point for all translation needs.
  • Improved Flexibility:
    • The LocaleResolver is now optional; if not provided, it defaults to using the player's client-side locale.
    • Removed strict locale validation to allow for custom language codes and dialects.

New Features

  • Support for Nested Keys: You can now use dot notation (e.g., commands.help.description) in your translation keys. The library will automatically flatten nested YAML/JSON structures.
  • Automatic Colorization: All translated strings are now automatically processed through TextFormat::colorize(), allowing the use of the & symbol for color codes in your language files.
  • Simplified Initialization: Introduced LanguageLoader to automate the loading of .yml and .yaml files from your plugin's directories.

Installation

Update your .poggit.yml to use the new version:

libs:
  - src: newlandpe/libLanguage/libLanguage
    version: ^0.1.0

License

This library remains licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).

v0.0.1

04 Feb 15:30
ef0fec0

Choose a tag to compare

v0.0.1 Pre-release
Pre-release

libLanguage v0.0.1

This is the initial public release of the libLanguage virion, providing a structured way to handle localizations in PocketMine-MP plugins.

Features

  • Centralized Language Management: A LanguageHub singleton that acts as a central registry for all language-related operations and plugin registrations.
  • Per-Plugin Localization: The PluginTranslator class ensures that each plugin maintains its own isolated translation context.
  • Extensible Locale Resolution: Includes a LocaleResolverInterface with a DefaultLocaleResolver that automatically detects a player's language via Player::getLocale().
  • Placeholder Integration: Built-in support for custom placeholders (e.g., %player%) and seamless integration with the PlaceholderAPI plugin.
  • Locale Validation: A predefined list of 29 valid Minecraft locales to ensure consistency across translations.
  • Data-Driven Translations: A simple Language data class to encapsulate locale-specific translation keys and values.

Installation

You can include this virion in your project by adding it to your .poggit.yml:

libs:
  - src: newlandpe/libLanguage/libLanguage
    version: ^0.0.1

License

This library is licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).