Releases: newlandpe/libLanguage
v0.1.1
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
.jsonfiles 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.1License
This library remains licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).
v0.1.0
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
LanguageHuband 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
PluginTranslatoris now the primary, self-contained entry point for all translation needs. - Improved Flexibility:
- The
LocaleResolveris 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.
- The
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
LanguageLoaderto automate the loading of.ymland.yamlfiles from your plugin's directories.
Installation
Update your .poggit.yml to use the new version:
libs:
- src: newlandpe/libLanguage/libLanguage
version: ^0.1.0License
This library remains licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).
v0.0.1
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
LanguageHubsingleton that acts as a central registry for all language-related operations and plugin registrations. - Per-Plugin Localization: The
PluginTranslatorclass ensures that each plugin maintains its own isolated translation context. - Extensible Locale Resolution: Includes a
LocaleResolverInterfacewith aDefaultLocaleResolverthat automatically detects a player's language viaPlayer::getLocale(). - Placeholder Integration: Built-in support for custom placeholders (e.g.,
%player%) and seamless integration with thePlaceholderAPIplugin. - Locale Validation: A predefined list of 29 valid Minecraft locales to ensure consistency across translations.
- Data-Driven Translations: A simple
Languagedata 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.1License
This library is licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2).