-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added content type constants and translation
- Loading branch information
1 parent
d90ca01
commit e166aae
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Application/Translation/Exception/TranslationException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Novuso\Common\Application\Translation\Exception; | ||
|
||
use Novuso\System\Exception\SystemException; | ||
|
||
/** | ||
* TranslationException is thrown for translation errors | ||
* | ||
* @copyright Copyright (c) 2017, Novuso. <http://novuso.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License | ||
* @author John Nickell <email@johnnickell.com> | ||
*/ | ||
class TranslationException extends SystemException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Novuso\Common\Application\Translation; | ||
|
||
use Novuso\Common\Application\Translation\Exception\TranslationException; | ||
|
||
/** | ||
* TranslatorInterface is the interface for a translator | ||
* | ||
* @copyright Copyright (c) 2017, Novuso. <http://novuso.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License | ||
* @author John Nickell <email@johnnickell.com> | ||
*/ | ||
interface TranslatorInterface | ||
{ | ||
/** | ||
* Translates the message for the given key | ||
* | ||
* @param string $key The message key | ||
* @param array $parameters The message parameters | ||
* @param string|null $domain The message domain or null for default | ||
* @param string|null $locale The locale or null for default | ||
* | ||
* @return string | ||
* | ||
* @throws TranslationException When an error occurs | ||
*/ | ||
public function translate( | ||
string $key, | ||
array $parameters = [], | ||
?string $domain = null, | ||
?string $locale = null | ||
): string; | ||
|
||
/** | ||
* Translates the message choice for the given key and index | ||
* | ||
* This method is generally implemented for pluralization or instances when | ||
* the translation may depend on some dynamic variable. | ||
* | ||
* @param string $key The message key | ||
* @param int $index The message index | ||
* @param array $parameters The message parameters | ||
* @param null|string $domain The message domain or null for default | ||
* @param null|string $locale The locale or null for default | ||
* | ||
* @return string | ||
*/ | ||
public function choice( | ||
string $key, | ||
int $index, | ||
array $parameters = [], | ||
?string $domain = null, | ||
?string $locale = null | ||
): string; | ||
} |