Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs #135

Merged
merged 5 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 9 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ standalone PHP applications.

## Installation

The package could be installed with composer:
The package could be installed with [Composer](https://getcomposer.org):

```shell
composer require yiisoft/translator
Expand All @@ -43,16 +43,16 @@ PHP arrays or GNU gettext. Message formatters provide extra syntax that is recog

## Built-in message formatters

- [Simple formatter](docs/en/simple-formatter.md) just replaces parameters in messages. Does not take into account the
- [Simple formatter](docs/guide/en/simple-formatter.md) just replaces parameters in messages. Does not take into account the
locale.
- [`intl` formatter](docs/en/intl-formatter.md) utilizes PHP intl extension message formatting capabilities.
- [`intl` formatter](docs/guide/en/intl-formatter.md) utilizes PHP intl extension message formatting capabilities.

## Extracting messages

The message extraction is done via [console extractor](https://github.com/yiisoft/translator-extractor) that searches
for translator message calls and builds translation files.

In some cases you need to do so without using console. If that is your case, check [extractor guide](docs/en/extractor.md).
In some cases you need to do so without using console. If that is your case, check [extractor guide](docs/guide/en/extractor.md).

## Configuration

Expand Down Expand Up @@ -295,32 +295,13 @@ echo $translator->withDefaultCategory($newDefaultCategoryId);

The package contains interfaces for development of custom formatters, readers, and writers.

## Testing
## Documentation

### Unit testing
- Guide: [English](docs/guide/en/README.md), [Português - Brasil](docs/guide/pt-BR/README.md)
- [Internals](docs/internals.md)

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

### Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

### Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"issues": "https://github.com/yiisoft/translator/issues?state=open",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/translator"
},
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/en/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Documentation

- [Extractor](extractor.md)
- [`intl` formatter](intl-formatter.md)
- [Simple Formatter](simple-formatter.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions docs/guide/pt-BR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Documentation

- [Extractor](extractor.md)
- [`intl` formatter](intl-formatter.md)
- [Simple Formatter](simple-formatter.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions docs/internals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Internals

## Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

## Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

## Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```

## Code style

Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or
use either newest or any specific version of PHP:

```shell
./vendor/bin/rector
```

## Dependencies

This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if
all dependencies are correctly defined in `composer.json`. To run the checker, execute the following command:

```shell
./vendor/bin/composer-require-checker
```