Mercurial > hg > isophonics-drupal-site
annotate core/modules/locale/src/StreamWrapper/TranslationsStream.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\locale\StreamWrapper; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\StreamWrapper\LocalStream; |
Chris@0 | 6 use Drupal\Core\StreamWrapper\StreamWrapperInterface; |
Chris@0 | 7 |
Chris@0 | 8 /** |
Chris@0 | 9 * Defines a Drupal translations (translations://) stream wrapper class. |
Chris@0 | 10 * |
Chris@0 | 11 * Provides support for storing translation files. |
Chris@0 | 12 */ |
Chris@0 | 13 class TranslationsStream extends LocalStream { |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * {@inheritdoc} |
Chris@0 | 17 */ |
Chris@0 | 18 public static function getType() { |
Chris@0 | 19 return StreamWrapperInterface::LOCAL_HIDDEN; |
Chris@0 | 20 } |
Chris@0 | 21 |
Chris@0 | 22 /** |
Chris@0 | 23 * {@inheritdoc} |
Chris@0 | 24 */ |
Chris@0 | 25 public function getName() { |
Chris@0 | 26 return t('Translation files'); |
Chris@0 | 27 } |
Chris@0 | 28 |
Chris@0 | 29 /** |
Chris@0 | 30 * {@inheritdoc} |
Chris@0 | 31 */ |
Chris@0 | 32 public function getDescription() { |
Chris@0 | 33 return t('Translation files'); |
Chris@0 | 34 } |
Chris@0 | 35 |
Chris@0 | 36 /** |
Chris@0 | 37 * {@inheritdoc} |
Chris@0 | 38 */ |
Chris@0 | 39 public function getDirectoryPath() { |
Chris@0 | 40 return \Drupal::config('locale.settings')->get('translation.path'); |
Chris@0 | 41 } |
Chris@0 | 42 |
Chris@0 | 43 /** |
Chris@0 | 44 * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl(). |
Chris@0 | 45 * @throws \LogicException |
Chris@0 | 46 * PO files URL should not be public. |
Chris@0 | 47 */ |
Chris@0 | 48 public function getExternalUrl() { |
Chris@0 | 49 throw new \LogicException('PO files URL should not be public.'); |
Chris@0 | 50 } |
Chris@0 | 51 |
Chris@0 | 52 } |