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

feat: Support for localized strings #120

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dimtrovich
Copy link
Contributor

@dimtrovich dimtrovich commented Nov 29, 2024

Introduction of translation support.
Until now, all the texts generated by the CLI have been in English. The problem is that some people run commands in other languages (French in my case) and so you get a mixture of English and French, which isn't very cool to see.

image

This subject has already been discussed here #64

With this PR, the texts are translated and the developer can therefore use the language best suited to his project
image

// example

<?php

use Ahc\Cli\Application;
use Ahc\Cli\Translations\Translator;

include './vendor/autoload.php';

Translator::$locale = 'ru';  // en, fr, es, de, ru 
$app = new Application('My Application');

$app->command('rmdir');

$app->handle($_SERVER['argv']);

en (default)
image

fr - French
image

es - Spanish
image

de - German
image

ru - Russian
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant