forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac765fc
commit 7a20b89
Showing
1 changed file
with
9 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,31 +17,31 @@ | |
|
||
/** | ||
* TranslationLoader loads translation messages from translation files. | ||
* | ||
* | ||
* @author Michel Salib <[email protected]> | ||
*/ | ||
class TranslationLoader | ||
{ | ||
/** | ||
* Loaders used for import. | ||
* | ||
* | ||
* @var array | ||
*/ | ||
private $loaders = array(); | ||
|
||
/** | ||
* Adds a loader to the translation extractor. | ||
* @param string $format The format of the loader | ||
* @param LoaderInterface $loader | ||
* @param LoaderInterface $loader | ||
*/ | ||
public function addLoader($format, LoaderInterface $loader) | ||
{ | ||
$this->loaders[$format] = $loader; | ||
} | ||
|
||
/** | ||
* Loads translation messages from a directory to the catalogue. | ||
* | ||
* | ||
* @param string $directory the directory to look into | ||
* @param MessageCatalogue $catalogue the catalogue | ||
*/ | ||
|
@@ -50,10 +50,10 @@ public function loadMessages($directory, MessageCatalogue $catalogue) | |
foreach($this->loaders as $format => $loader) { | ||
// load any existing translation files | ||
$finder = new Finder(); | ||
$files = $finder->files()->name('*.'.$catalogue->getLocale().$format)->in($directory); | ||
$files = $finder->files()->name('*.'.$catalogue->getLocale().'.'.$format)->in($directory); | ||
foreach ($files as $file) { | ||
$domain = substr($file->getFileName(), 0, strrpos($file->getFileName(), $input->getArgument('locale').$format) - 1); | ||
$catalogue->addCatalogue($loader->load($file->getPathname(), $input->getArgument('locale'), $domain)); | ||
$domain = substr($file->getFileName(), 0, strrpos($file->getFileName(), $catalogue->getLocale().$format) - 1); | ||
$catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain)); | ||
} | ||
} | ||
} | ||
|