richarddobron / fbt
An Internationalization Framework for PHP.
Installs: 1 683
Dependents: 2
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.2 || ^8.0
- ext-dom: *
- ext-iconv: *
- ext-json: *
- ext-mbstring: *
- minicli/minicli: 1.0.4
- nikic/php-parser: ^4.1
Requires (Dev)
- phpunit/phpunit: ^8.5.5 || ^9.3.5
This package is auto-updated.
Last update: 2024-11-01 15:39:45 UTC
README
FBT is an internationalization framework for PHP designed to be not just powerful and flexible, but also simple and intuitive. It helps with the following:
- Organizing your source text for translation
- Composing grammatically correct translatable UI
- Eliminating verbose boilerplate for generating UI
This library is based on the JavaScript implementation of Facebook's FBT.
Requirements
- PHP 7.0 or higher
- Composer is required for installation
Installing
$ composer require richarddobron/fbt:^4
Features
- Parameters and interpolation
- Implicit parameters
- Auto-parameterization
- Plurals
- Enumerations
- Pronouns
- Number formatting
- Phrase extracting
- Inline translating
Getting started
Version Guidance
Official integrations
The following integrations are fully supported and maintained:
How FBT works
FBT works by transforming your <fbt>
and fbt(...)
constructs via
Simple HTML DOM Parser. This library serve to extract strings from source and
lookup translated payloads generated while execution. FBT creates tables
of all possible variations for the given fbt phrase and accesses this
at runtime.
Full documentation
https://github.com/richardDobron/fbt/tree/main/docs
TODO
- Add driver-agnostic support for multiple database systems.
- Add integrations for Symfony, CakePHP, Zend Framework, Nette, ...
- ...
License
FBT is MIT licensed, as found in the LICENSE file.