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

Use entered date in poetry project launch template output. #136

Merged
merged 2 commits into from
Dec 31, 2021

Conversation

kgroeneveld
Copy link
Collaborator

Fixes #124.

The concat_date function would return somewhat weird results if any of
the year, month or day parameters were zero. For example, in the generated
project templates the date would be shown as "0-12-00" if the user did
not select a date. The code in Administor_projects.php avoided this by
explicitly checking if any of these components were zero. This check
has now been moved to the concat_date function itself so that the logic
does not need to be repeated in multiple spots. (This function is currently
only used in two spots.)

The updated concat_date function now also makes more use of the standard
date and mktime functions instead of more simple string manipulation. This
increases the chance of getting a valid date as a result with more
consistent formatting. For example, 2021-02-29 (not a valid date) will now
get converted to 2021-03-01. See mktime documentation for more info.

The concat_date function now also accepts an optional parameter (defaults
to 'Y-m-d') to allow other date formats to be used.
Previously the poetry templates would always show "Sunday, DATE" (or a
translated equivalent) as a placeholder that then needed to be manually
updated.

Note that the generated date text in the template output is in English
even if another language is selected. It could be a lot of work to generate
these strings properly in all the languages and currently the poetry
templates are only being used for English. Even if these are used for
non English the results are no worse than before as they already needed
to be manually updated to replace the fixed placeholder.

This fixes LibriVox#124.
@@ -44,7 +44,7 @@
$lang['project_launch_template_end_silence'] = '在录音结尾留出5秒空白。';
$lang['project_launch_template_filename'] = '文件名:';
$lang['project_launch_template_check_back'] = '大约一天后[b]回本页看看[/b]是否有人提出了修改意见。';
$lang['project_launch_template_deadline_poetry'] = '[b]截止时间:[/b]请在日期周日 GMT(格林威治时间) 06:00(即北美中部标准时间 12:00 AM)前提交你的录音。';
$lang['project_launch_template_deadline_poetry'] = '[b]截止时间:[/b]请 %s GMT(格林威治时间) 06:00(即北美中部标准时间 12:00 AM)前提交你的录音。';
Copy link
Member

Choose a reason for hiding this comment

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

The other languages I can guess that the change looks correct, but here I have no idea. I'm assuming you did your homework and that this is fine :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@twinkietoes-on did ask some Chinese speakers on the LibriVox forum for some assistance on this one. In some ways it doesn't matter much as the poetry projects are currently only being used for English anyway but I still wanted to get reasonable results for the other languages.

@notartom notartom merged commit b0e6bc5 into LibriVox:master Dec 31, 2021
@kgroeneveld kgroeneveld deleted the poetry-deadline branch December 31, 2021 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Weekly/Fortnightly Poetry Template: Date doesn't transfer in
2 participants