Added start date in TextTransformer#161
Added start date in TextTransformer#161libertjeremy wants to merge 3 commits intosimshaun:masterfrom
Conversation
|
I'm hesitant on this one because it makes many of the strings read awkwardly and maybe a bit too verbose. e.g. In my personal usages of Recurr, I like that it just describes the recurrence rule and doesn't include the start date. I think that if one wants to include the start date, it would be better to manually prepend something like "Starting on %date%, ". I'm open to other opinions though. Test suite: |
|
What do you think about adding a parameter to the "transform" function, containing an array of elements to exclude? public function transform(Rule $rule, $exclude = array())if (!in_array('startDate', $exclude)) {
$startDate = $rule->getStartDate();
if ($startDate instanceof \DateTimeInterface) {
$dateFormatted = $this->translator->trans('day_date', array('date' => $startDate->format('U')));
$this->addFragment($this->translator->trans('from %date%', array('date' => $dateFormatted)));
}
}And why not the same thing for "until"? |
|
I love the idea of being able to make the text output more granular. For example, I like the idea of showing the day of the month on monthly events, and would like to see the time included for weekly events. Personally I wouldn't want to see the start date included, but overall I think it would be great if this could be configurable in some way to allow it to meet the needs of a particular site. |
| } | ||
|
|
||
| public function transform(Rule $rule) | ||
| public function transform(Rule $rule, $exclude = array()) |
There was a problem hiding this comment.
| public function transform(Rule $rule, $exclude = array()) | |
| public function transform(Rule $rule, $exclude = []) |
https://github.com/simshaun/recurr/blob/master/composer.json#L16
Old PHP 5.3 compat is not needed :) (https://github.com/wdes/coding-standard#rules-to-disable-for-php--54-compatibility)
Hi,
For more verbosity on the Rule, I added the start date to the translations for TextTransformer.
Please check the translations (except french haha).
If everything is ok, I will add the associated tests.