-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3cb3d51
Showing
151 changed files
with
15,457 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/PULL_REQUEST_TEMPLATE.md export-ignore | ||
/ISSUE_TEMPLATE.md export-ignore | ||
/phpcs.xml.dist export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore | ||
/docs export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Check & fix styling | ||
|
||
on: [push] | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Run PHP CS Fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga | ||
with: | ||
args: --config=.php-cs-fixer.dist.php --allow-risky=yes | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: push | ||
name: CI | ||
jobs: | ||
phpunit: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: ['7.0', '7.1', '7.2', '7.3', '7.4'] | ||
|
||
name: PHP ${{ matrix.php-version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: mbstring, intl | ||
coverage: none | ||
|
||
- name: composer install | ||
run: | | ||
composer install | ||
- name: Run PHPUnit | ||
run: | | ||
set -e && composer test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/.idea | ||
/vendor | ||
/.phpunit.cache | ||
/tests/*.json | ||
composer.lock | ||
.php_cs.cache | ||
.phpunit.result.cache | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
$finder = Symfony\Component\Finder\Finder::create() | ||
->in([ | ||
__DIR__ . '/src', | ||
__DIR__ . '/tests', | ||
]) | ||
->name('*.php') | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'ordered_imports' => ['sort_algorithm' => 'alpha'], | ||
'no_unused_imports' => true, | ||
'not_operator_with_successor_space' => true, | ||
'trailing_comma_in_multiline' => true, | ||
'phpdoc_scalar' => true, | ||
'unary_operator_spaces' => true, | ||
'binary_operator_spaces' => true, | ||
'blank_line_before_statement' => [ | ||
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], | ||
], | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_var_without_name' => true, | ||
'class_attributes_separation' => [ | ||
'elements' => [ | ||
'method' => 'one', | ||
], | ||
], | ||
'method_argument_space' => [ | ||
'on_multiline' => 'ensure_fully_multiline', | ||
'keep_multiple_spaces_after_comma' => true, | ||
], | ||
'single_trait_insert_per_statement' => true, | ||
]) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changelog | ||
|
||
All notable changes to `fbt` will be documented in this file. | ||
|
||
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. | ||
|
||
## v3.0 - 2022-02-18 | ||
|
||
### Added | ||
- PHP Internationalization Framework for PHP 7. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Contributing | ||
|
||
Please read and understand the contribution guide before creating an issue or pull request. | ||
|
||
## Etiquette | ||
|
||
This project is an open source project, and as such, the maintainers use their free time to build and maintain it. | ||
The code is freely available and can be used, forked and modified. | ||
|
||
Please be considerate towards maintainers when raising issues or presenting pull requests. | ||
|
||
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient | ||
quality to benefit the project. Many developers have different skill sets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. | ||
|
||
## Viability | ||
|
||
When requesting or submitting new features, first consider whether it might be useful to others. Open | ||
source projects are used by many developers, who may have entirely different needs to your own. Think about | ||
whether or not your feature is likely to be used by other users of the project. | ||
|
||
## How to submit changes? | ||
|
||
- Check the codebase to ensure that your feature doesn't already exist. | ||
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. | ||
- Use the [pull request template](PULL_REQUEST_TEMPLATE.md) | ||
|
||
## How to report a bug? | ||
|
||
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. | ||
- Check to make sure your feature suggestion isn't already present within the project. | ||
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. | ||
- Check the pull requests tab to ensure that the feature isn't already in progress. | ||
- Use the [issue template](ISSUE_TEMPLATE.md) | ||
|
||
## Requirements | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**. - Style will get automatically fixed. | ||
- **Add tests backing up your change!** - You can run the test by running `vendor/bin/phpunit` | ||
- **Document any change in behaviour** - Documentation is located in the `/docs/` folder | ||
- **One feature per Pull Request** | ||
- **Add meaningful commit messages** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Provide a general summary of the issue in the Title above --> | ||
|
||
## Detailed description | ||
|
||
Provide a detailed description of the change or addition you are proposing. | ||
|
||
Make it clear if the issue is a bug, an enhancement or just a question. | ||
|
||
## Context | ||
|
||
Why is this change important to you? How would you use it? | ||
|
||
How can it benefit other users? | ||
|
||
## Possible implementation | ||
|
||
Not obligatory, but suggest an idea for implementing addition or change. | ||
|
||
## Your environment | ||
|
||
Include as many relevant details about the environment you experienced the bug in and how to reproduce it. | ||
|
||
* Version used (e.g. PHP 5.6, HHVM 3): | ||
* Operating system and version (e.g. Ubuntu 16.04, Windows 7): | ||
* Link to your project: | ||
* ... | ||
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) Richard Dobroň | ||
Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
### Requirements | ||
|
||
Please take note of our contributing guidelines: [CONTRIBUTING.md](CONTRIBUTING.md) | ||
Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. | ||
|
||
Mark the following tasks as done: | ||
|
||
* [ ] Checked the codebase to ensure that your feature doesn't already exist. | ||
* [ ] Checked the pull requests to ensure that another person hasn't already submitted the feature or fix. | ||
* [ ] Adjusted the Documentation. | ||
* [ ] Added tests to ensure against regression. | ||
|
||
### Description of the Change | ||
|
||
<!-- | ||
We must be able to understand the design of your change from this description. | ||
If we can't get a good idea of what the code will be doing from the description here, | ||
the pull request may be closed at the maintainers' discretion. | ||
Keep in mind that the maintainer reviewing this PR may not be familiar with or have | ||
worked with the code here recently, so please walk us through the concepts. | ||
--> | ||
|
||
### Why Should This Be Added? | ||
|
||
<!-- Explain why this functionality should be added in Laravel-Excel --> | ||
|
||
### Benefits | ||
|
||
<!-- What benefits will be realized by the code change? --> | ||
|
||
### Possible Drawbacks | ||
|
||
<!-- What are the possible side-effects or negative impacts (e.g. breaking changes) of the code change? --> | ||
|
||
### Verification Process | ||
|
||
<!-- | ||
What process did you follow to verify that your change has the desired effects? | ||
- How did you verify that all new functionality works as expected? | ||
- How did you verify that all changed functionality works as expected? | ||
- How did you verify that the change has not introduced any regressions? | ||
--> | ||
|
||
### Applicable Issues | ||
|
||
<!-- Enter any applicable Issues here --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<h1 align="center"> | ||
<img src="icon.png" height="150" width="150" alt="FBT"/> | ||
</h1> | ||
|
||
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][link-facebook-fbt].** | ||
|
||
## Requirements | ||
* PHP 7.0 or higher | ||
* [Composer](https://getcomposer.org) is required for installation | ||
|
||
## Installing | ||
|
||
```shell | ||
$ composer require richarddobron/fbt | ||
``` | ||
|
||
## Getting started | ||
|
||
[Integrating into your app](docs/getting_started.md) | ||
|
||
## Version Guidance | ||
|
||
| Version | Released | Status | Repo | PHP Version | | ||
|---------|------------|--------|------------------|-------------| | ||
| 3.x | 2022-02-18 | Latest | [v3][fbt-3-repo] | >= 7.0 | | ||
|
||
## Official integrations | ||
|
||
The following integrations are fully supported and maintained: | ||
|
||
- [Laravel](https://github.com/richardDobron/laravel-fbt) | ||
|
||
## How FBT works | ||
FBT works by transforming your `<fbt>` and `fbt(...)` constructs via | ||
[Simple HTML DOM Parser][simplehtmldom]. 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, Laravel, CakePHP, Zend Framework, Nette, ... | ||
- ... | ||
|
||
## License | ||
FBT is MIT licensed, as found in the [LICENSE](LICENSE) file. | ||
|
||
[fbt-3-repo]: https://github.com/richarddobron/fbt | ||
[link-facebook-fbt]: https://github.com/facebook/fbt | ||
[simplehtmldom]: https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/php | ||
<?php | ||
|
||
if (php_sapi_name() !== 'cli') { | ||
exit; | ||
} | ||
|
||
$root_app = dirname(__DIR__); | ||
|
||
if (!is_file($root_app . '/vendor/autoload.php')) { | ||
$root_app = dirname(__DIR__, 4); | ||
} | ||
|
||
require $root_app . '/vendor/autoload.php'; | ||
|
||
use Minicli\App; | ||
|
||
$app = new App([]); | ||
|
||
$app->registerCommand('translate', function (Minicli\Command\CommandCall $app) { | ||
$generateTranslationsService = new \fbt\Services\TranslationsGeneratorService(); | ||
$generateTranslationsService->exportTranslations( | ||
$app->getParam('--path'), | ||
$app->getParam('--translations'), | ||
$app->hasFlag('stdin') ? file_get_contents("php://stdin") : null, | ||
$app->hasFlag('pretty') | ||
); | ||
}); | ||
|
||
$app->runCommand($argv); |
Oops, something went wrong.