Skip to content
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

Add l18n support to the Cron component #94

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

alexmartinfr
Copy link

@alexmartinfr alexmartinfr commented Feb 13, 2021

This PR adds internationalization support to the Cron component:

  • Translate a cron to the specified locale
  • Default to English with an unsupported locale
  • Option to display time in the 24-hour format

These are new features brought by the new 0.2.0 release of cron-translator.

PS: The documentation PR is here.

This release brings support for:
- String localization
- 24 hour time format
New tests:

- It can translate a cron to a supported locale
- It defaults to English with an unknown locale
- It can display time in the 24-hour format
New tests:

- It can translate a cron to a supported locale
- It defaults to English with an unknown locale
- It can display time in the 24-hour format
@alexmartinfr alexmartinfr marked this pull request as ready for review February 13, 2021 16:27
@alexmartinfr
Copy link
Author

Regarding the 24-hour time format option, I'm not fully satisfied with the use24hour attribute.

Cleaner solutions are welcome!

src/Components/Support/Cron.php Outdated Show resolved Hide resolved
Reorder the constructor arguments to prevent breaking changes.
Cf: blade-ui-kit#94 (review)
/** @var bool */
public $use24hour = false;

public function __construct(string $schedule, bool $human = false, string $locale = 'en', bool $use24hour = false)

Choose a reason for hiding this comment

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

Maybe $is24Hour is closer to convention?

Suggested change
public function __construct(string $schedule, bool $human = false, string $locale = 'en', bool $use24hour = false)
public function __construct(string $schedule, bool $human = false, string $locale = 'en', bool $is24Hour = false)

@danharrin danharrin marked this pull request as draft February 2, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants