Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drago-ex/translator
:earth_africa: Simple translator. (@nette)
https://github.com/drago-ex/translator
nette translator
Last synced: 2 months ago
JSON representation
:earth_africa: Simple translator. (@nette)
- Host: GitHub
- URL: https://github.com/drago-ex/translator
- Owner: drago-ex
- License: mit
- Created: 2015-10-16T07:15:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-01-12T06:46:41.000Z (about 1 year ago)
- Last Synced: 2024-11-13T19:38:03.667Z (2 months ago)
- Topics: nette, translator
- Language: PHP
- Homepage:
- Size: 170 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
## Drago Translator
Simple translator.[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/drago-ex/translator/master/license.md)
[![PHP version](https://badge.fury.io/ph/drago-ex%2Ftranslator.svg)](https://badge.fury.io/ph/drago-ex%2Ftranslator)
[![Tests](https://github.com/drago-ex/translator/actions/workflows/tests.yml/badge.svg)](https://github.com/drago-ex/translator/actions/workflows/tests.yml)
[![Coding Style](https://github.com/drago-ex/translator/actions/workflows/coding-style.yml/badge.svg)](https://github.com/drago-ex/translator/actions/workflows/coding-style.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/drago-ex/translator/badge)](https://www.codefactor.io/repository/github/drago-ex/translator)
[![Coverage Status](https://coveralls.io/repos/github/drago-ex/translator/badge.svg?branch=master)](https://coveralls.io/github/drago-ex/translator?branch=master)## Technology
- PHP 8.1 or higher
- composer## Installation
```
composer require drago-ex/translator
```## Extension registration
```neon
extensions:
- Drago\Localization\DI\TranslatorExtension(translateDir: %appDir%/locale)
```## Use in the presenter
```php
use Drago\Localization\TranslatorAdapter
```## Currently set language
```php
$this->lang;
```## A method that returns a translator
```php
$this->getTranslator();
```## We will create the translation in neon files
```neon
"Hello, world!": "Hello, world!"
```## Translation in the template
```latte
{_"Hello, world!"}{* filter for translate *}
{$var|translate}
```## Translation in forms
```php
$form->setTranslator($this->getTranslator());
```## Route settings for translation
```php
$router->addRoute('[/]/', 'Presenter:action');
```