first commit
This commit is contained in:
27
vendor/php-flasher/flasher/Translation/EchoTranslator.php
vendored
Normal file
27
vendor/php-flasher/flasher/Translation/EchoTranslator.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Prime\Translation;
|
||||
|
||||
final class EchoTranslator implements TranslatorInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function translate($id, $parameters = array(), $locale = null)
|
||||
{
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return 'en';
|
||||
}
|
||||
}
|
63
vendor/php-flasher/flasher/Translation/Language.php
vendored
Normal file
63
vendor/php-flasher/flasher/Translation/Language.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Prime\Translation;
|
||||
|
||||
final class Language
|
||||
{
|
||||
const LTR = 'ltr';
|
||||
const RTL = 'rtl';
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function direction($locale)
|
||||
{
|
||||
if (!\extension_loaded('intl')) {
|
||||
return self::LTR;
|
||||
}
|
||||
|
||||
$resource = \ResourceBundle::create($locale, 'ICUDATA', true);
|
||||
if (null === $resource) {
|
||||
return self::LTR;
|
||||
}
|
||||
|
||||
$layout = $resource->get('layout');
|
||||
if (!$layout instanceof \ResourceBundle) {
|
||||
return self::LTR;
|
||||
}
|
||||
|
||||
$characters = $layout->get('characters');
|
||||
if (!\is_string($characters)) {
|
||||
return self::LTR;
|
||||
}
|
||||
|
||||
return 'right-to-left' === $characters ? self::RTL : self::LTR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRTL($locale)
|
||||
{
|
||||
return self::RTL === self::direction($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLTR($locale)
|
||||
{
|
||||
return self::LTR === self::direction($locale);
|
||||
}
|
||||
}
|
62
vendor/php-flasher/flasher/Translation/Messages.php
vendored
Normal file
62
vendor/php-flasher/flasher/Translation/Messages.php
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Prime\Translation;
|
||||
|
||||
final class Messages
|
||||
{
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static $ar = array(
|
||||
'success' => 'نجاح',
|
||||
'error' => 'خطأ',
|
||||
'warning' => 'تحذير',
|
||||
'info' => 'معلومة',
|
||||
|
||||
'The resource was created' => 'تم إنشاء :resource',
|
||||
'The resource was updated' => 'تم تعديل :resource',
|
||||
'The resource was saved' => 'تم حفظ :resource',
|
||||
'The resource was deleted' => 'تم حذف :resource',
|
||||
|
||||
'resource' => 'الملف',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static $en = array(
|
||||
'success' => 'Success',
|
||||
'error' => 'Error',
|
||||
'warning' => 'Warning',
|
||||
'info' => 'Info',
|
||||
|
||||
'The resource was created' => 'The :resource was created',
|
||||
'The resource was updated' => 'The :resource was updated',
|
||||
'The resource was saved' => 'The :resource was saved',
|
||||
'The resource was deleted' => 'The :resource was deleted',
|
||||
|
||||
'resource' => 'resource',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static $fr = array(
|
||||
'success' => 'Succès',
|
||||
'error' => 'Erreur',
|
||||
'warning' => 'Avertissement',
|
||||
'info' => 'Information',
|
||||
|
||||
'The resource was created' => 'La ressource :resource a été ajoutée',
|
||||
'The resource was updated' => 'La ressource :resource a été mise à jour',
|
||||
'The resource was saved' => 'La ressource :resource a été enregistrée',
|
||||
'The resource was deleted' => 'La ressource :resource a été supprimée',
|
||||
|
||||
'resource' => '',
|
||||
);
|
||||
}
|
21
vendor/php-flasher/flasher/Translation/ResourceInterface.php
vendored
Normal file
21
vendor/php-flasher/flasher/Translation/ResourceInterface.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Prime\Translation;
|
||||
|
||||
interface ResourceInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceType();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName();
|
||||
}
|
25
vendor/php-flasher/flasher/Translation/TranslatorInterface.php
vendored
Normal file
25
vendor/php-flasher/flasher/Translation/TranslatorInterface.php
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Prime\Translation;
|
||||
|
||||
interface TranslatorInterface
|
||||
{
|
||||
/**
|
||||
* @param string $id
|
||||
* @param array<string, mixed> $parameters
|
||||
* @param string|null $locale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function translate($id, $parameters = array(), $locale = null);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale();
|
||||
}
|
Reference in New Issue
Block a user