Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ php:
- 5.6
- 7.0
- 7.1
- hhvm

env:
global:
Expand Down
14 changes: 9 additions & 5 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Change Log

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## UNRELEASED

### Changed

- Add meta informations from the profiler to `Translation\Common\Model\Message`

## 0.3.2

### Changed
Expand Down Expand Up @@ -58,19 +62,19 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
### Changed

- `Translation\Bundle\Service\CatalogueFetcher` moved to `Translation\Bundle\Catalogue\CatalogueFetcher`
- Made most (if not all) classes final.
- Made most (if not all) classes final.
- `CatalogueFetcher` requires a `Configuration` object.

### Removed

- Dead code in the `SymfonyProfilerController`
- `FileStorage` was moved to `php-translation/symfony-storage`
- `FileStorage` was moved to `php-translation/symfony-storage`

### Fixed

- The bundle works without any configuration.
- The bundle works without any configuration.
- You may have an config named "default".

## 0.1.0

First release.
First release.
44 changes: 30 additions & 14 deletions Model/SfProfilerMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,36 @@ public static function create(array $data)
return $message;
}

/**
* Convert to a Common\Message.
*
* @return Message
*/
public function convertToMessage()
{
return new Message(
$this->key,
$this->domain,
$this->locale,
$this->translation
);
}
/**
* Convert to a Common\Message.
*
* @return Message
*/
public function convertToMessage()
{
$meta = [];

if (!empty($this->getParameters())) {
// Reduce to only get one value of each parameter, not all the usages.
$meta['parameters'] = array_reduce($this->getParameters(), 'array_merge', []);
}

if (!empty($this->getCount())) {
$meta['count'] = $this->getCount();
}

if (!empty($this->getTransChoiceNumber())) {
$meta['transChoiceNumber'] = $this->getTransChoiceNumber();
}

return new Message(
$this->key,
$this->domain,
$this->locale,
$this->translation,
$meta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems better to me to add parameters, count and transChoiceNumber to the Message value object as fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, I'm not sure: the Message object is a common objet used to represent a translation on the storage, and those parameters, count and transChoiceNumber information are only needed when displaying a translation.

);
}

/**
* @return int
Expand Down