Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
accgit authored and scrs_zdenek committed Nov 29, 2021
1 parent 4adacf8 commit ca85780
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ composer require drago-ex/translator
```

## Extension registration
```php
```neon
extensions:
- Drago\Localization\DI\TranslatorExtension(translateDir: %appDir%/locale)
```
Expand All @@ -44,20 +44,19 @@ $this->lang;
$this->getTranslator();
```

## We will create the translation in ini files
```php
hello.world = Hello, world'!'
## We will create the translation in neon files
```neon
'Hello, world!': 'Hello, world!'
```

## Translation in the template
```latte
{_'hello.world'}
{_'Hello, world!'}
```

## Translation in forms
```php
$form->setTranslator($this->getTranslator());
$form->addText('hello', 'hello.world');
```

## Route settings for translation
Expand Down
2 changes: 1 addition & 1 deletion tests/Translator/DI/TranslatorExtension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TestTranslatorExtension extends TestCase
public function test02(): void
{
$class = $this->getTranslatorByType();
Assert::same('Hello, world!', $class->translate('hello.world'));
Assert::same('Hello, world!', $class->translate('Hello, world!'));
}


Expand Down
2 changes: 1 addition & 1 deletion tests/locale/en.neon
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hello.world: 'Hello, world!'
'Hello, world!': 'Hello, world!'

0 comments on commit ca85780

Please sign in to comment.