-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added start date in TextTransformer #161
base: master
Are you sure you want to change the base?
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. |
@@ -14,7 +14,7 @@ public function __construct(TranslatorInterface $translator = null) | |||
$this->translator = $translator ?: new Translator('en'); | |||
} | |||
|
|||
public function transform(Rule $rule) | |||
public function transform(Rule $rule, $exclude = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.